Skip to content

Commit

Permalink
Merge pull request #6449 from cakephp/hotfix-pagination-links
Browse files Browse the repository at this point in the history
Prevent clickable refresh for disabled navi link elements.
  • Loading branch information
markstory committed May 1, 2015
2 parents 2f6ac30 + 2334e2c commit bec59e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/View/Helper/PaginatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class PaginatorHelper extends Helper
'options' => [],
'templates' => [
'nextActive' => '<li class="next"><a rel="next" href="{{url}}">{{text}}</a></li>',
'nextDisabled' => '<li class="next disabled"><a href="">{{text}}</a></li>',
'nextDisabled' => '<li class="next disabled"><a href="" onclick="return false;">{{text}}</a></li>',
'prevActive' => '<li class="prev"><a rel="prev" href="{{url}}">{{text}}</a></li>',
'prevDisabled' => '<li class="prev disabled"><a href="">{{text}}</a></li>',
'prevDisabled' => '<li class="prev disabled"><a href="" onclick="return false;">{{text}}</a></li>',
'counterRange' => '{{start}} - {{end}} of {{count}}',
'counterPages' => '{{page}} of {{pages}}',
'first' => '<li class="first"><a href="{{url}}">{{text}}</a></li>',
Expand Down
16 changes: 8 additions & 8 deletions tests/TestCase/View/Helper/PaginatorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public function testPagingLinksMissingModel()
$result = $this->Paginator->next('Next', ['model' => 'Missing']);
$expected = [
'li' => ['class' => 'next disabled'],
'a' => ['href' => ''],
'a' => ['href' => '', 'onclick' => 'return false;'],
'Next',
'/a',
'/li'
Expand All @@ -449,7 +449,7 @@ public function testPagingLinksMissingModel()
$result = $this->Paginator->prev('Prev', ['model' => 'Missing']);
$expected = [
'li' => ['class' => 'prev disabled'],
'a' => ['href' => ''],
'a' => ['href' => '', 'onclick' => 'return false;'],
'Prev',
'/a',
'/li'
Expand Down Expand Up @@ -884,7 +884,7 @@ public function testPrev()
$result = $this->Paginator->prev('<< Previous');
$expected = [
'li' => ['class' => 'prev disabled'],
'a' => ['href' => ''],
'a' => ['href' => '', 'onclick' => 'return false;'],
'&lt;&lt; Previous',
'/a',
'/li'
Expand All @@ -894,7 +894,7 @@ public function testPrev()
$result = $this->Paginator->prev('<< Previous', ['disabledTitle' => 'Prev']);
$expected = [
'li' => ['class' => 'prev disabled'],
'a' => ['href' => ''],
'a' => ['href' => '', 'onclick' => 'return false;'],
'Prev',
'/a',
'/li'
Expand Down Expand Up @@ -991,7 +991,7 @@ public function testNextDisabled()
$result = $this->Paginator->next('Next >>');
$expected = [
'li' => ['class' => 'next disabled'],
'a' => ['href' => ''],
'a' => ['href' => '', 'onclick' => 'return false;'],
'Next &gt;&gt;',
'/a',
'/li'
Expand All @@ -1001,7 +1001,7 @@ public function testNextDisabled()
$result = $this->Paginator->next('Next >>', ['disabledTitle' => 'Next']);
$expected = [
'li' => ['class' => 'next disabled'],
'a' => ['href' => ''],
'a' => ['href' => '', 'onclick' => 'return false;'],
'Next',
'/a',
'/li'
Expand Down Expand Up @@ -1052,13 +1052,13 @@ public function testNextAndPrevNonDefaultModel()
$result = $this->Paginator->prev('Prev', [
'model' => 'Client'
]);
$expected = '<li class="prev disabled"><a href="">Prev</a></li>';
$expected = '<li class="prev disabled"><a href="" onclick="return false;">Prev</a></li>';
$this->assertEquals($expected, $result);

$result = $this->Paginator->next('Next', [
'model' => 'Server'
]);
$expected = '<li class="next disabled"><a href="">Next</a></li>';
$expected = '<li class="next disabled"><a href="" onclick="return false;">Next</a></li>';
$this->assertEquals($expected, $result);

$result = $this->Paginator->prev('Prev', [
Expand Down

0 comments on commit bec59e5

Please sign in to comment.