From eb450064a65465080b106e27181e6a6650f9c9d8 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 11 Jan 2016 23:32:19 +1100 Subject: [PATCH] Added a range swig function I found it useful when generating pagination for example {{ range(maxNumPages) }} --- libs/swig_functions.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/swig_functions.js b/libs/swig_functions.js index 97d524c..8c51e5e 100644 --- a/libs/swig_functions.js +++ b/libs/swig_functions.js @@ -475,6 +475,10 @@ module.exports.swigFunctions = function(swig) { return self.maxPage; }; + var range = function(args) { + return _.range.apply(this, arguments); + }; + var getPageUrl = function(pageNum) { if(pageNum == 1) { return self.paginationBaseUrl; @@ -628,6 +632,7 @@ module.exports.swigFunctions = function(swig) { getCurPage: getCurPage, getMaxPage: getMaxPage, getPageUrl: getPageUrl, + range: range, url: url, getCurrentUrl: getCurrentUrl, getSetting: getSetting, @@ -668,4 +673,4 @@ module.exports.swigFunctions = function(swig) { return this; -}; \ No newline at end of file +};