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.
|
2020-04-08 18:56:37 +03:00
|
|
|
const {metaData} = require('../services/proxy');
|
2020-03-30 23:23:02 +03:00
|
|
|
const getPaginatedUrl = 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
|
|
|
};
|