Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 945fa25

Browse files
committed
Added a range swig function
I found it useful when generating pagination for example {{ range(maxNumPages) }}
1 parent f35b9b6 commit 945fa25

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libs/swig_functions.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,10 @@ module.exports.swigFunctions = function(swig) {
475475
return self.maxPage;
476476
};
477477

478+
var range = function(args) {
479+
return _.range(args);
480+
};
481+
478482
var getPageUrl = function(pageNum) {
479483
if(pageNum == 1) {
480484
return self.paginationBaseUrl;
@@ -628,6 +632,7 @@ module.exports.swigFunctions = function(swig) {
628632
getCurPage: getCurPage,
629633
getMaxPage: getMaxPage,
630634
getPageUrl: getPageUrl,
635+
range: range,
631636
url: url,
632637
getCurrentUrl: getCurrentUrl,
633638
getSetting: getSetting,
@@ -668,4 +673,4 @@ module.exports.swigFunctions = function(swig) {
668673

669674

670675
return this;
671-
};
676+
};

0 commit comments

Comments
 (0)