Conflicts:
	lib/Cake/View/Helper/HtmlHelper.php
	lib/Cake/View/Helper/PaginatorHelper.php
This commit is contained in:
planardothum 2012-11-13 19:53:57 -05:00
commit f078715d8e
2 changed files with 30 additions and 3 deletions

View file

@ -682,6 +682,11 @@ class HtmlHelper extends AppHelper {
* similar to HtmlHelper::getCrumbs(), so it uses options which every * similar to HtmlHelper::getCrumbs(), so it uses options which every
* crumb was added with. * crumb was added with.
* *
* ### Options
* - 'separator' Separator content to insert in between breadcrumbs, defaults to '»'
* - 'firstClass' Class for wrapper tag on the first breadcrumb, defaults to 'first'
* - 'lastClass' Class for wrapper tag on current active page, defaults to 'last'
*
* @param array $options Array of html attributes to apply to the generated list elements. * @param array $options Array of html attributes to apply to the generated list elements.
* @param string|array|boolean $startText This will be the first crumb, if false it defaults to first crumb in array. Can * @param string|array|boolean $startText This will be the first crumb, if false it defaults to first crumb in array. Can
* also be an array, see `HtmlHelper::getCrumbs` for details. * also be an array, see `HtmlHelper::getCrumbs` for details.
@ -689,6 +694,12 @@ class HtmlHelper extends AppHelper {
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
*/ */
public function getCrumbList($options = array(), $startText = false) { public function getCrumbList($options = array(), $startText = false) {
$defaults = array('firstClass'=>'first', 'lastClass'=>'last', 'separator' => '');
$options += $defaults;
$firstClass = $options['firstClass'];
$lastClass = $options['lastClass'];
$separator = $options['separator'];
unset($options['firstClass'], $options['lastClass'], $options['separator']);
$crumbs = $this->_prepareCrumbs($startText); $crumbs = $this->_prepareCrumbs($startText);
if (!empty($crumbs)) { if (!empty($crumbs)) {
$result = ''; $result = '';
@ -701,10 +712,18 @@ class HtmlHelper extends AppHelper {
} else { } else {
$elementContent = $this->link($crumb[0], $crumb[1], $crumb[2]); $elementContent = $this->link($crumb[0], $crumb[1], $crumb[2]);
} }
<<<<<<< HEAD
if (!$which) { if (!$which) {
$options['class'] = 'first'; $options['class'] = 'first';
=======
if ($which == 0) {
$options['class'] = $firstClass;
>>>>>>> 77886a9c5b62529e9af5368d40978bc1bf852e4f
} elseif ($which == $crumbCount - 1) { } elseif ($which == $crumbCount - 1) {
$options['class'] = 'last'; $options['class'] = $lastClass;
}
if (!empty($separator) && ($crumbCount - $which >= 2)) {
$elementContent .= $separator;
} }
$result .= $this->tag('li', $elementContent, $options); $result .= $this->tag('li', $elementContent, $options);
} }

View file

@ -471,10 +471,10 @@ class PaginatorHelper extends AppHelper {
$url = array_merge(array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step)), $url); $url = array_merge(array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step)), $url);
if ($this->{$check}($model)) { if ($this->{$check}($model)) {
return $this->Html->tag($tag, $this->link($title, $url, array_merge($options, compact('escape', 'model'))), compact('class')); return $this->Html->tag($tag, $this->link($title, $url, array_merge($options, compact('escape'))), compact('class'));
} else { } else {
unset($options['rel']); unset($options['rel']);
return $this->Html->tag($tag, $title, array_merge($options, compact('escape', 'class'))); return $this->Html->tag($tag, '<a>'.h($title).'</a>', array_merge($options, compact('class')));
} }
} }
@ -711,11 +711,15 @@ class PaginatorHelper extends AppHelper {
if ($class) { if ($class) {
$currentClass .= ' ' . $class; $currentClass .= ' ' . $class;
} }
<<<<<<< HEAD
if ($currentTag) { if ($currentTag) {
$out .= $this->Html->tag($tag, $this->Html->tag($currentTag, $params['page']), array('class' => $currentClass)); $out .= $this->Html->tag($tag, $this->Html->tag($currentTag, $params['page']), array('class' => $currentClass));
} else { } else {
$out .= $this->Html->tag($tag, $params['page'], array('class' => $currentClass)); $out .= $this->Html->tag($tag, $params['page'], array('class' => $currentClass));
} }
=======
$out .= $this->Html->tag($tag, '<a>'.$params['page'].'</a>', array('class' => $currentClass));
>>>>>>> 77886a9c5b62529e9af5368d40978bc1bf852e4f
if ($i != $params['pageCount']) { if ($i != $params['pageCount']) {
$out .= $separator; $out .= $separator;
} }
@ -748,11 +752,15 @@ class PaginatorHelper extends AppHelper {
if ($class) { if ($class) {
$currentClass .= ' ' . $class; $currentClass .= ' ' . $class;
} }
<<<<<<< HEAD
if ($currentTag) { if ($currentTag) {
$out .= $this->Html->tag($tag, $this->Html->tag($currentTag, $i), array('class' => $currentClass)); $out .= $this->Html->tag($tag, $this->Html->tag($currentTag, $i), array('class' => $currentClass));
} else { } else {
$out .= $this->Html->tag($tag, $i, array('class' => $currentClass)); $out .= $this->Html->tag($tag, $i, array('class' => $currentClass));
} }
=======
$out .= $this->Html->tag($tag, "<a>$i</a>", array('class' => $currentClass));
>>>>>>> 77886a9c5b62529e9af5368d40978bc1bf852e4f
} else { } else {
$out .= $this->Html->tag($tag, $this->link($i, array('page' => $i), $options), compact('class')); $out .= $this->Html->tag($tag, $this->link($i, array('page' => $i), $options), compact('class'));
} }