@nakedcreativity/cee-ms-node 0.3.33 → 0.3.34

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.
Files changed (3) hide show
  1. package/.DS_Store +0 -0
  2. package/index.js +28 -2
  3. package/package.json +1 -1
package/.DS_Store ADDED
Binary file
package/index.js CHANGED
@@ -162,6 +162,12 @@ function ceems(config) {
162
162
  },
163
163
  render: function(scope, hash){
164
164
  // var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
165
+
166
+ if(this.match[2]){
167
+ var itemsPerPage = this.match[2]
168
+ }else{
169
+ var itemsPerPage = 10
170
+ }
165
171
 
166
172
  var collectionName = Liquid.evalValue(this.match[0], scope)
167
173
 
@@ -171,6 +177,20 @@ function ceems(config) {
171
177
 
172
178
  var scopeObj = {}
173
179
  scopeObj['collection'] = collection
180
+
181
+ if(scope.scopes[0].page && scope.scopes[0].page.pagination){
182
+ scopeObj.pagination = scope.scopes[0].page.pagination
183
+ }else {
184
+ scopeObj.pagination = 1
185
+ }
186
+
187
+ scopeObj.itemsPerPage = parseInt(itemsPerPage);
188
+
189
+ scopeObj.start = itemsPerPage * (scopeObj.pagination - 1)
190
+ scopeObj.end = scopeObj.start + itemsPerPage
191
+
192
+ scopeObj.lastPage = Math.ceil(collection.data.length / itemsPerPage)
193
+
174
194
  scope.push(scopeObj)
175
195
 
176
196
  //console.log(scope)
@@ -327,8 +347,12 @@ function ceems(config) {
327
347
  this.match = tagToken.args.split(' ')
328
348
  },
329
349
  render: function(scope, hash){
330
-
331
- var articlesPerPage = 10
350
+
351
+ if(this.match[2]){
352
+ var articlesPerPage = this.match[2]
353
+ }else{
354
+ var articlesPerPage = 10
355
+ }
332
356
 
333
357
  if(!site.blogs[this.match[0]]){
334
358
  return
@@ -340,6 +364,8 @@ function ceems(config) {
340
364
  blog.pagination = 1
341
365
  }
342
366
 
367
+ blog.articlesPerPage = parseInt(articlesPerPage);
368
+
343
369
  blog.start = articlesPerPage * (blog.pagination - 1)
344
370
  blog.end = blog.start + articlesPerPage
345
371
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakedcreativity/cee-ms-node",
3
- "version": "0.3.33",
3
+ "version": "0.3.34",
4
4
  "description": "Cee.ms for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {