Permalink
Browse files

MINOR: Change -10/+10 buttons to First and Last

  • Loading branch information...
1 parent 88a61f9 commit c81bb3b4d3c9fea93cd239a7afcbff5837566154 Andrew O'Neil committed Mar 7, 2012
Showing with 10 additions and 12 deletions.
  1. +9 −11 forms/gridfield/GridFieldPaginator.php
  2. +1 −1 templates/Includes/GridFieldPaginator_Row.ss
View
20 forms/gridfield/GridFieldPaginator.php
@@ -93,12 +93,11 @@ public function getHTMLFragments($gridField) {
$lastShownRecord = $totalRows;
- // Ten pages back button
- $prev10PageNum = $this->currentPage - 10 <= 1 ? 1 : $this->currentPage - 10;
- $prev10Page = new GridField_Action($gridField, 'pagination_prev10', '-10', 'paginate', 1);
- $prev10Page->addExtraClass('ss-gridfield-prev10page');
+ // First page button
+ $firstPage = new GridField_Action($gridField, 'pagination_first', 'First', 'paginate', 1);
+ $firstPage->addExtraClass('ss-gridfield-firstpage');
if($this->currentPage == 1)
- $prev10Page = $prev10Page->performDisabledTransformation();
+ $firstPage = $firstPage->performDisabledTransformation();
// Previous page button
$previousPageNum = $this->currentPage <= 1 ? 1 : $this->currentPage - 1;
@@ -115,21 +114,20 @@ public function getHTMLFragments($gridField) {
$nextPage = $nextPage->performDisabledTransformation();
// Ten pages forward button
- $next10PageNum = $this->currentPage + 10 >= $totalPages ? $totalPages : $this->currentPage + 10;
- $next10Page = new GridField_Action($gridField, 'pagination_next10', '+10', 'paginate', $next10PageNum);
- $next10Page->addExtraClass('ss-gridfield-next10page');
+ $lastPage = new GridField_Action($gridField, 'pagination_last', 'Last', 'paginate', $totalPages);
+ $lastPage->addExtraClass('ss-gridfield-lastpage');
if($this->currentPage == $totalPages)
- $next10Page = $next10Page->performDisabledTransformation();
+ $lastPage = $lastPage->performDisabledTransformation();
// Render in template
$forTemplate = new ArrayData(array(
- 'Previous10Page' => $prev10Page,
+ 'FirstPage' => $firstPage,
'PreviousPage' => $previousPage,
'CurrentPageNum' => $this->currentPage,
'NumPages' => $totalPages,
'NextPage' => $nextPage,
- 'Next10Page' => $next10Page,
+ 'LastPage' => $lastPage,
'FirstShownRecord' => $firstShownRecord,
'LastShownRecord' => $lastShownRecord,
'NumRecords' => $totalRows
View
2 templates/Includes/GridFieldPaginator_Row.ss
@@ -1,7 +1,7 @@
<tr>
<td class="bottom-all" colspan="$Colspan">
<div class="datagrid-pagination">
- $Previous10Page $PreviousPage <span class="pagination-page-number">Page $CurrentPageNum of $NumPages</span> $NextPage $Next10Page
+ $FirstPage $PreviousPage <span class="pagination-page-number">Page $CurrentPageNum of $NumPages</span> $NextPage $LastPage
</div>
<span class="pagination-records-number">View $FirstShownRecord - $LastShownRecord of $NumRecords</span>

0 comments on commit c81bb3b

Please sign in to comment.