Merge pull request #322 from roadster31/pagination

Pagination
This commit is contained in:
Manuel Raynaud
2014-04-19 13:52:40 +02:00
9 changed files with 384 additions and 224 deletions

View File

@@ -1,5 +1,6 @@
#order
max_displayed_orders = 20
max_displayed_customers = 20
#order status
order_not_paid = 'warning'

View File

@@ -120,7 +120,7 @@
</thead>
<tbody>
{loop name="customer_list" type="customer" current="false" visible="*" order=$customer_order backend_context="1" page=$page limit=$display_customer}
{loop name="customer_list" type="customer" current="false" visible="*" order=$customer_order backend_context="1" page=$page limit=#max_displayed_customers#}
{assign "lastOrderDate" ''}
{assign "lastOrderAmount" ''}
{assign "lastOrderCurrency" ''}
@@ -179,34 +179,13 @@
<tfoot>
<tr>
<td colspan="6">
{include
file = "includes/pagination.html"
<div class="text-center">
<ul class="pagination pagination-centered">
{if $page != 1}
<li><a href="{url path="/admin/customers" page="1"}">&laquo;</a></li>
{/if}
{pageloop rel="customer_list" numPage="20"}
{if $PAGE == $CURRENT && $PAGE > 2}
<li><a href="{url path="/admin/customers" page=$PREV}">&lsaquo;</a></li>
{/if}
{if $PAGE != $CURRENT}
<li><a href="{url path="/admin/customers" page="{$PAGE}"}">{$PAGE}</a></li>
{else}
<li class="active"><a href="#">{$PAGE}</a></li>
{/if}
{if $PAGE == $END && $PAGE < $LAST}
<li><a href="{url path="/admin/customers" page=$NEXT}">&rsaquo;</a></li>
{/if}
{/pageloop}
{if $LAST > $CURRENT}
<li><a href="{url path="/admin/customers" page="$LAST"}">&raquo;</a></li>
{/if}
</ul>
</div>
loop_ref = "customer_list"
max_page_count = 10
page_url = "{url path="/admin/customers" customer_order=$customer_order}"
}
</td>
</tr>

View File

@@ -0,0 +1,69 @@
{*
A generic pager for thelia back-office
Parameters :
$loop_ref: the name of the related loop
$max_page_count : maximum number of pages to display
$page_url : the URL of the page. The parameter page=x is appended to this URL.
*}
{* Prepare the URL so that the page=x parameter coumd be safely appended *}
{if strpos($page_url, '?')}
{$page_url="$page_url&"}
{else}
{$page_url="$page_url?"}
{/if}
<div class="text-center">
<ul class="pagination pagination-centered">
{pageloop rel=$loop_ref limit=$max_page_count}
{$prev_page = $PREV}
{$next_page = $NEXT}
{$last_page = $LAST}
{$has_prev = $CURRENT > 1}
{$has_next = $CURRENT < $LAST}
{$has_pages_after = $END < $LAST && $LAST > $max_page_count}
{$has_pages_before = $START > 1}
{if $PAGE == $START}
{if $has_prev}
<li><a title="{intl l="Go to first page"}" href="{$page_url}page=1">&laquo;</a></li>
<li><a title="{intl l="Go to previous page"}" href="{$page_url}page=$prev_page">&lsaquo;</a></li>
{if $has_pages_before}
<li title="{intl l="More pages before"}" class="disabled"><a href="#">&hellip;</a></li>
{/if}
{else}
<li class="disabled"><a href="#">&laquo;</a></li>
<li class="disabled"><a href="#">&lsaquo;</a></li>
{/if}
{/if}
{if $PAGE != $CURRENT}
<li><a href="{$page_url}page={$PAGE}">{$PAGE}</a></li>
{else}
<li class="active"><a href="#">{$PAGE}</a></li>
{/if}
{if $PAGE == $END}
{if $has_next}
{if $has_pages_after}
<li title="{intl l="More pages after"}" class="disabled"><a href="#">&hellip;</a></li>
{/if}
<li><a title="{intl l="Go to next page"}" href="{$page_url}page={$next_page}">&rsaquo;</a></li>
<li><a title="{intl l="Go to last page"}" href="{$page_url}page={$last_page}">&raquo;</a></li>
{else}
<li class="disabled"><a href="#">&rsaquo;</a></li>
<li class="disabled"><a href="#">&raquo;</a></li>
{/if}
{/if}
{/pageloop}
</ul>
</div>

View File

@@ -150,32 +150,13 @@
<tfoot>
<tr>
<td colspan="7">
{include
file = "includes/pagination.html"
<div class="text-center">
<ul class="pagination pagination-centered">
{if $order_page != 1}
<li><a href="{url path="/admin/orders" page=1 orders_order=$orders_order}">&laquo;</a></li>
{else}
<li class="disabled"><a href="#">&laquo;</a></li>
{/if}
{pageloop rel="order-list"}
{if $PAGE != $CURRENT}
<li><a href="{url path="/admin/orders" page=$PAGE orders_order=$orders_order}">{$PAGE}</a></li>
{else}
<li class="active"><a href="#">{$PAGE}</a></li>
{/if}
{/pageloop}
{if $PAGE == $LAST && $LAST != $CURRENT}
<li><a href="{url path="/admin/orders" page=$PAGE orders_order=$orders_order}">&raquo;</a></li>
{else}
<li class="disabled"><a href="#">&raquo;</a></li>
{/if}
</ul>
</div>
loop_ref = "order-list"
max_page_count = 10
page_url = "{url path="/admin/orders" orders_order=$orders_order}"
}
</td>
</tr>