2014-10-10 18:54:07 +04:00
|
|
|
// ### Page URL Helper
|
|
|
|
//
|
|
|
|
// *Usage example:*
|
|
|
|
// `{{page_url 2}}`
|
|
|
|
//
|
2017-11-01 16:44:54 +03:00
|
|
|
// Returns the URL for the page specified in the current object context.
|
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-11-01 16:44:54 +03:00
|
|
|
// We use the name page_url to match the helper for consistency:
|
|
|
|
module.exports = function page_url(page, options) { // eslint-disable-line camelcase
|
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
|
|
|
};
|