@nakedcreativity/cee-ms-node 0.3.37 → 0.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -220,7 +220,10 @@ function ceems(config) {
|
|
|
220
220
|
},
|
|
221
221
|
render: function (scope, hash) {
|
|
222
222
|
|
|
223
|
-
var filepath = Liquid.
|
|
223
|
+
var filepath = Liquid.evalValue(this.match[0], scope)
|
|
224
|
+
if(!filepath){
|
|
225
|
+
filepath = Liquid.lexical.parseLiteral(this.match[0])
|
|
226
|
+
}
|
|
224
227
|
var jsonData = JSON.parse(fs.readFileSync(filepath, 'utf8'))
|
|
225
228
|
|
|
226
229
|
var scopeObj = {}
|
|
@@ -531,8 +534,6 @@ ceems.prototype.render = function(req, res, page=null) {
|
|
|
531
534
|
})
|
|
532
535
|
}
|
|
533
536
|
|
|
534
|
-
console.log('pagination, ', page.pagination)
|
|
535
|
-
|
|
536
537
|
var renderedRegions = {}
|
|
537
538
|
var renderedColumns = {}
|
|
538
539
|
var renderedModules = {}
|
|
@@ -543,13 +544,11 @@ ceems.prototype.render = function(req, res, page=null) {
|
|
|
543
544
|
_.each(page.regions, function(region, key){
|
|
544
545
|
|
|
545
546
|
renderedRegions[key] = []
|
|
546
|
-
console.log(key)
|
|
547
547
|
|
|
548
548
|
if(region.containers){
|
|
549
549
|
|
|
550
550
|
region.containers.forEach((container, index)=>{
|
|
551
551
|
|
|
552
|
-
console.log(container)
|
|
553
552
|
if(container.module){
|
|
554
553
|
|
|
555
554
|
var html = `{% ${container.module} %}`
|
|
@@ -561,22 +560,27 @@ ceems.prototype.render = function(req, res, page=null) {
|
|
|
561
560
|
container.class = 'container'
|
|
562
561
|
}
|
|
563
562
|
|
|
563
|
+
console.log(container)
|
|
564
|
+
|
|
564
565
|
var html = ''
|
|
565
566
|
if(container.wrapper){
|
|
566
|
-
html += `<div class="${container.wrapper}">`
|
|
567
|
+
html += `<div class="${container.wrapper}" data-container-id="${container._id}"><div class="${container.class}">`
|
|
568
|
+
}else {
|
|
569
|
+
html += `<div class="${container.class}" data-container-id="${container._id}">`
|
|
567
570
|
}
|
|
568
571
|
|
|
569
|
-
html += `<div class="${container.class}">`
|
|
570
572
|
|
|
571
573
|
container.rows.forEach(row=>{
|
|
572
574
|
|
|
573
|
-
html += `<div class="row ${row.class}">`
|
|
575
|
+
html += `<div class="row ${row.class}" data-row-id="${row._id}">`
|
|
574
576
|
row.columns.forEach(column=>{
|
|
575
577
|
|
|
578
|
+
console.log(column)
|
|
579
|
+
|
|
576
580
|
var modules = _.reduce(column.modules, (modules, id)=>{
|
|
577
581
|
return modules + '{% '+id+' %}'
|
|
578
582
|
}, '')
|
|
579
|
-
html += `<div class="col ${column.class}">${modules}</div>` // inserts placeholder in format {% id %}
|
|
583
|
+
html += `<div data-column-id="${column._id}" class="col ${column.class}">${modules}</div>` // inserts placeholder in format {% id %}
|
|
580
584
|
|
|
581
585
|
})
|
|
582
586
|
|
|
@@ -595,8 +599,6 @@ ceems.prototype.render = function(req, res, page=null) {
|
|
|
595
599
|
})
|
|
596
600
|
}
|
|
597
601
|
|
|
598
|
-
console.log(renderedRegions)
|
|
599
|
-
|
|
600
602
|
_.each(region.modules, function(module, index){
|
|
601
603
|
|
|
602
604
|
var moduleTemplate = fs.readFileSync('./views/'+module.type+'.liquid');
|