mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-12 10:31:09 +03:00
Do not use style path for pagination generation
This commit is contained in:
parent
84094ad38b
commit
7c1e123ad6
@ -29,10 +29,9 @@ use Handlebars\Template;
|
|||||||
*
|
*
|
||||||
* Example of usage:
|
* Example of usage:
|
||||||
* <code>
|
* <code>
|
||||||
* {{generatePagination stylePath paginationInfo bottom}}
|
* {{generatePagination paginationInfo bottom}}
|
||||||
* </code>
|
* </code>
|
||||||
* where:
|
* where:
|
||||||
* - "stylePath" is expression for path to current style.
|
|
||||||
* - "paginationInfo" is 'info' key from the result of setup_pagination
|
* - "paginationInfo" is 'info' key from the result of setup_pagination
|
||||||
* function.
|
* function.
|
||||||
* - "bottom": optional argument that indicate if pagination block shoud
|
* - "bottom": optional argument that indicate if pagination block shoud
|
||||||
@ -48,16 +47,14 @@ class GeneratePaginationHelper implements HelperInterface
|
|||||||
public function execute(Template $template, Context $context, $args, $source)
|
public function execute(Template $template, Context $context, $args, $source)
|
||||||
{
|
{
|
||||||
$parsed_args = $template->parseArguments($args);
|
$parsed_args = $template->parseArguments($args);
|
||||||
if (empty($parsed_args) || count($parsed_args) < 2) {
|
if (empty($parsed_args) || count($parsed_args) < 1) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$stylePath = $context->get($parsed_args[0]);
|
$pagination_info = $context->get($parsed_args[0]);
|
||||||
$pagination_info = $context->get($parsed_args[1]);
|
$bottom = empty($parsed_args[1]) ? true : $context->get($parsed_args[1]);
|
||||||
$bottom = empty($parsed_args[2]) ? true : $context->get($parsed_args[2]);
|
|
||||||
|
|
||||||
$pagination = generate_pagination(
|
$pagination = generate_pagination(
|
||||||
$stylePath,
|
|
||||||
$pagination_info,
|
$pagination_info,
|
||||||
($bottom === "false") ? false : true
|
($bottom === "false") ? false : true
|
||||||
);
|
);
|
||||||
|
@ -142,14 +142,13 @@ function setup_pagination($items, $default_items_per_page = 15)
|
|||||||
/**
|
/**
|
||||||
* Builds HTML markup for pagination pager.
|
* Builds HTML markup for pagination pager.
|
||||||
*
|
*
|
||||||
* @param string $style_path Root path of the style.
|
|
||||||
* @param array $pagination Pagination info. See description of the result of
|
* @param array $pagination Pagination info. See description of the result of
|
||||||
* pagination_info function for details.
|
* pagination_info function for details.
|
||||||
* @param bool $bottom Indicates if pager will be displayed at the bottom of a
|
* @param bool $bottom Indicates if pager will be displayed at the bottom of a
|
||||||
* page.
|
* page.
|
||||||
* @return string HTML markup
|
* @return string HTML markup
|
||||||
*/
|
*/
|
||||||
function generate_pagination($style_path, $pagination, $bottom = true)
|
function generate_pagination($pagination, $bottom = true)
|
||||||
{
|
{
|
||||||
$result = getlocal(
|
$result = getlocal(
|
||||||
'Page {0} of {1}, {2}-{3} from {4}',
|
'Page {0} of {1}, {2}-{3} from {4}',
|
||||||
|
@ -27,6 +27,6 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"> </div>
|
<div class="clear"> </div>
|
||||||
<div class="center">{{generatePagination stylePath pagination}}</div>
|
<div class="center">{{generatePagination pagination}}</div>
|
||||||
{{/override}}
|
{{/override}}
|
||||||
{{/extends}}
|
{{/extends}}
|
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
{{#if pagination}}
|
{{#if pagination}}
|
||||||
<br />
|
<br />
|
||||||
{{generatePagination stylePath pagination}}
|
{{generatePagination pagination}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/override}}
|
{{/override}}
|
||||||
{{/extends}}
|
{{/extends}}
|
@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
{{#if pagination}}
|
{{#if pagination}}
|
||||||
<br />
|
<br />
|
||||||
{{generatePagination stylePath pagination}}
|
{{generatePagination pagination}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/override}}
|
{{/override}}
|
||||||
{{/extends}}
|
{{/extends}}
|
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
{{#if pagination}}
|
{{#if pagination}}
|
||||||
<br/>
|
<br/>
|
||||||
{{generatePagination stylePath pagination}}
|
{{generatePagination pagination}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/override}}
|
{{/override}}
|
||||||
{{/extends}}
|
{{/extends}}
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
{{#if pagination}}
|
{{#if pagination}}
|
||||||
<br />
|
<br />
|
||||||
{{generatePagination stylePath pagination}}
|
{{generatePagination pagination}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/override}}
|
{{/override}}
|
||||||
{{/extends}}
|
{{/extends}}
|
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{{#if pagination}}
|
{{#if pagination}}
|
||||||
{{generatePagination stylePath pagination "false"}}
|
{{generatePagination pagination "false"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<table class="translate">
|
<table class="translate">
|
||||||
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
{{#if pagination}}
|
{{#if pagination}}
|
||||||
<br />
|
<br />
|
||||||
{{generatePagination stylePath pagination}}
|
{{generatePagination pagination}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/override}}
|
{{/override}}
|
||||||
{{/extends}}
|
{{/extends}}
|
Loading…
Reference in New Issue
Block a user