mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding rel attributes for first and last links. These attribute values are part of the html5 spec, and fit with the intention of #370
This commit is contained in:
parent
fd88d57513
commit
e003bd6ea9
2 changed files with 18 additions and 10 deletions
|
@ -746,7 +746,7 @@ class PaginatorHelper extends AppHelper {
|
||||||
'after' => null,
|
'after' => null,
|
||||||
'model' => $this->defaultModel(),
|
'model' => $this->defaultModel(),
|
||||||
'separator' => ' | ',
|
'separator' => ' | ',
|
||||||
'ellipsis' => '...',
|
'ellipsis' => '...'
|
||||||
),
|
),
|
||||||
(array)$options);
|
(array)$options);
|
||||||
|
|
||||||
|
@ -773,6 +773,7 @@ class PaginatorHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
$out .= $after;
|
$out .= $after;
|
||||||
} elseif ($params['page'] > 1) {
|
} elseif ($params['page'] > 1) {
|
||||||
|
$options += array('rel' => 'first');
|
||||||
$out = $this->Html->tag($tag, $this->link($first, array('page' => 1), $options))
|
$out = $this->Html->tag($tag, $this->link($first, array('page' => 1), $options))
|
||||||
. $after;
|
. $after;
|
||||||
}
|
}
|
||||||
|
@ -830,6 +831,7 @@ class PaginatorHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
$out = $before . $out;
|
$out = $before . $out;
|
||||||
} elseif ($params['page'] < $params['pageCount']) {
|
} elseif ($params['page'] < $params['pageCount']) {
|
||||||
|
$options += array('rel' => 'last');
|
||||||
$out = $before . $this->Html->tag(
|
$out = $before . $this->Html->tag(
|
||||||
$tag, $this->link($last, array('page' => $params['pageCount']), $options
|
$tag, $this->link($last, array('page' => $params['pageCount']), $options
|
||||||
));
|
));
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Paginator->numbers(true);
|
$result = $this->Paginator->numbers(true);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('span' => array()), array('a' => array('href' => '/index/page:1')), 'first', '/a', '/span',
|
array('span' => array()), array('a' => array('href' => '/index/page:1', 'rel' => 'first')), 'first', '/a', '/span',
|
||||||
' | ',
|
' | ',
|
||||||
array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
|
array('span' => array()), array('a' => array('href' => '/index/page:4')), '4', '/a', '/span',
|
||||||
' | ',
|
' | ',
|
||||||
|
@ -1199,7 +1199,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
' | ',
|
' | ',
|
||||||
array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
|
array('span' => array()), array('a' => array('href' => '/index/page:12')), '12', '/a', '/span',
|
||||||
' | ',
|
' | ',
|
||||||
array('span' => array()), array('a' => array('href' => '/index/page:15')), 'last', '/a', '/span',
|
array('span' => array()), array('a' => array('href' => '/index/page:15', 'rel' => 'last')), 'last', '/a', '/span',
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
@ -1779,7 +1779,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->first('<<', array('tag' => 'li'));
|
$result = $this->Paginator->first('<<', array('tag' => 'li'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<li',
|
'<li',
|
||||||
'a' => array('href' => '/index/page:1'),
|
'a' => array('href' => '/index/page:1', 'rel' => 'first'),
|
||||||
'<<',
|
'<<',
|
||||||
'/a',
|
'/a',
|
||||||
'/li'
|
'/li'
|
||||||
|
@ -1841,7 +1841,9 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->first();
|
$result = $this->Paginator->first();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
array('a' => array('href' => FULL_BASE_URL . '/index/page:1/sort:Article.title/direction:DESC')),
|
array('a' => array(
|
||||||
|
'href' => FULL_BASE_URL . '/index/page:1/sort:Article.title/direction:DESC', 'rel' => 'first'
|
||||||
|
)),
|
||||||
'<< first',
|
'<< first',
|
||||||
'/a',
|
'/a',
|
||||||
'/span',
|
'/span',
|
||||||
|
@ -1858,7 +1860,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->first();
|
$result = $this->Paginator->first();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:1'),
|
'a' => array('href' => '/index/page:1', 'rel' => 'first'),
|
||||||
'<< first',
|
'<< first',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -1888,7 +1890,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->last();
|
$result = $this->Paginator->last();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:7'),
|
'a' => array('href' => '/index/page:7', 'rel' => 'last'),
|
||||||
'last >>',
|
'last >>',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -1947,7 +1949,11 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->last();
|
$result = $this->Paginator->last();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
array('a' => array('href' => '/index/page:15/sort:Client.name/direction:DESC')), 'last >>', '/a',
|
array('a' => array(
|
||||||
|
'href' => '/index/page:15/sort:Client.name/direction:DESC',
|
||||||
|
'rel' => 'last'
|
||||||
|
)),
|
||||||
|
'last >>', '/a',
|
||||||
'/span',
|
'/span',
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
Loading…
Add table
Reference in a new issue