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
|
2017-04-04 19:07:35 +03:00
|
|
|
var proxy = require('./proxy'),
|
|
|
|
getPaginatedUrl = proxy.metaData.getPaginatedUrl;
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2017-04-04 19:07:35 +03:00
|
|
|
module.exports = function page_url(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
|
|
|
};
|