2014-10-10 18:54:07 +04:00
|
|
|
// ### Page URL Helper
|
|
|
|
//
|
|
|
|
// *Usage example:*
|
|
|
|
// `{{page_url 2}}`
|
|
|
|
//
|
|
|
|
// Returns the URL for the page specified in the current object
|
|
|
|
// context.
|
|
|
|
//
|
|
|
|
// We use the name page_url to match the helper for consistency:
|
|
|
|
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
2016-10-06 21:47:37 +03:00
|
|
|
var getPaginatedUrl = require('../data/meta/paginated_url'),
|
|
|
|
page_url;
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2016-03-21 00:48:15 +03:00
|
|
|
page_url = function (page, options) {
|
2016-04-14 13:22:23 +03:00
|
|
|
if (!options) {
|
|
|
|
options = page;
|
|
|
|
page = 1;
|
|
|
|
}
|
2016-03-21 00:48:15 +03:00
|
|
|
return getPaginatedUrl(page, options.data.root);
|
2014-10-10 18:54:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = page_url;
|