twig-layout
Advanced tools
Comparing version 0.1.4 to 0.1.5
13
block.js
@@ -73,4 +73,4 @@ /*! | ||
*/ | ||
this.data = {} | ||
this.data = options.data ? options.data : {} | ||
//bind block in data | ||
@@ -248,2 +248,11 @@ this.data.this = this; | ||
/** | ||
* Get parent block instance | ||
* | ||
* @return {Block} Block instance | ||
*/ | ||
getParent() { | ||
return this.parent | ||
} | ||
/** | ||
* Render the block | ||
@@ -250,0 +259,0 @@ * |
@@ -271,5 +271,6 @@ /*! | ||
let script = config.script ? config.script : null | ||
let data = config.data ? config.data : null | ||
//load the block | ||
loadBlocks.push(this._loadBlock(config.name, config.template, config, script, parent)) | ||
loadBlocks.push(this._loadBlock(config.name, config.template, data, config, script, parent)) | ||
} | ||
@@ -293,3 +294,3 @@ | ||
*/ | ||
async _loadBlock(name, template, config, script, parent) { | ||
async _loadBlock(name, template, data, config, script, parent) { | ||
//check if the block have no name and no template connot load the block | ||
@@ -305,3 +306,3 @@ if (!name && !template) { | ||
//create block | ||
block = await this.createBlock({ name: name, template: template, config: config, script: script, parent: parent }) | ||
block = await this.createBlock({ name, template, data, config, script, parent }) | ||
} catch (error) { | ||
@@ -388,2 +389,3 @@ const params = {} | ||
parent: options.parent, | ||
data: options.data, | ||
template: options.template || null, | ||
@@ -435,3 +437,3 @@ cache: this._cache | ||
if (childrenBlock && childrenBlock.length) { | ||
await this._loadBlocks(childrenBlock, block.name) | ||
await this._loadBlocks(childrenBlock, block) | ||
} | ||
@@ -438,0 +440,0 @@ |
@@ -14,3 +14,3 @@ { | ||
"string-hash": "^1.1.3", | ||
"twig": "^1.13.2" | ||
"twig": "^1.13.3" | ||
}, | ||
@@ -45,3 +45,3 @@ "description": "A layout system build on top of twig js", | ||
}, | ||
"version": "0.1.4" | ||
"version": "0.1.5" | ||
} |
@@ -5,2 +5,4 @@ ## express-twig-layout | ||
[documentation](https://metaisfabien.github.io/node-twig-layout/) | ||
## Instalation | ||
@@ -74,3 +76,4 @@ | ||
## /views/page/default.html | ||
The template for the page | ||
The template for the page. | ||
For the template syntax read the twig js [documentation](https://github.com/twigjs/twig.js/wiki) | ||
@@ -77,0 +80,0 @@ ```html |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 4 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
1
284
1
36528
7
1050
Updatedtwig@^1.13.3