Merge pull request #1160 from kapv89/patch-2
Updated Paginator to fit better with bootstrap 2.1
This commit is contained in:
@@ -80,29 +80,31 @@ Sometimes you may need to create a Paginator instance manually, without using th
|
|||||||
All pagination link elements can be style using CSS classes. Here is an example of the HTML elements generated by the links method:
|
All pagination link elements can be style using CSS classes. Here is an example of the HTML elements generated by the links method:
|
||||||
|
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<a href="foo" class="previous_page">Previous</a>
|
<ul>
|
||||||
|
<li class="previous_page"><a href="foo">Previous</a></li>
|
||||||
|
|
||||||
<a href="foo">1</a>
|
<li><a href="foo">1</a></li>
|
||||||
<a href="foo">2</a>
|
<li><a href="foo">2</a></li>
|
||||||
|
|
||||||
<span class="dots">...</span>
|
<li class="dots disabled"><a href="#">...</a></li>
|
||||||
|
|
||||||
<a href="foo">11</a>
|
<li><a href="foo">11</a></li>
|
||||||
<a href="foo">12</a>
|
<li><a href="foo">12</a></li>
|
||||||
|
|
||||||
<span class="current">13</span>
|
<li class="active"><a href="#">13</li>
|
||||||
|
|
||||||
<a href="foo">14</a>
|
<li><a href="foo">14</a></li>
|
||||||
<a href="foo">15</a>
|
<li><a href="foo">15</a></li>
|
||||||
|
|
||||||
<span class="dots">...</span>
|
<li class="dots disabled"><a href="#">...</a></li>
|
||||||
|
|
||||||
<a href="foo">25</a>
|
<li><a href="foo">25</a></li>
|
||||||
<a href="foo">26</a>
|
<li><a href="foo">26</a></li>
|
||||||
|
|
||||||
<a href="foo" class="next_page">Next</a>
|
<li class="next_page"><a href="foo">Next</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
When you are on the first page of results, the "Previous" link will be disabled. Likewise, the "Next" link will be disabled when you are on the last page of results. The generated HTML will look like this:
|
When you are on the first page of results, the "Previous" link will be disabled. Likewise, the "Next" link will be disabled when you are on the last page of results. The generated HTML will look like this:
|
||||||
|
|
||||||
<span class="disabled prev_page">Previous</span>
|
<li class="disabled previous_page"><a href="#">Previous</a></li>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Paginator {
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $dots = '<span class="dots">...</span>';
|
protected $dots = '<li class="dots disabled"><a href="#">...</a></li>';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Paginator instance.
|
* Create a new Paginator instance.
|
||||||
@@ -183,7 +183,7 @@ class Paginator {
|
|||||||
$links = $this->slider($adjacent);
|
$links = $this->slider($adjacent);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $this->previous().' '.$links.' '.$this->next();
|
$content = '<ul>' . $this->previous() . $links . $this->next() . '</ul>';
|
||||||
|
|
||||||
return '<div class="pagination">'.$content.'</div>';
|
return '<div class="pagination">'.$content.'</div>';
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ class Paginator {
|
|||||||
// the "first" element should be a span instead of a link.
|
// the "first" element should be a span instead of a link.
|
||||||
if ($disabled($this->page, $this->last))
|
if ($disabled($this->page, $this->last))
|
||||||
{
|
{
|
||||||
return HTML::span($text, array('class' => "{$class} disabled"));
|
return '<li'.HTML::attributes(array('class'=>"{$class} disabled")).'><a href="#">'.$text.'</a></li>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -349,7 +349,7 @@ class Paginator {
|
|||||||
{
|
{
|
||||||
if ($this->page == $page)
|
if ($this->page == $page)
|
||||||
{
|
{
|
||||||
$pages[] = HTML::span($page, array('class' => 'current'));
|
$pages[] = '<li class="active"><a href="#">'.$page.'</a></li>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -372,7 +372,7 @@ class Paginator {
|
|||||||
{
|
{
|
||||||
$query = '?page='.$page.$this->appendage($this->appends);
|
$query = '?page='.$page.$this->appendage($this->appends);
|
||||||
|
|
||||||
return HTML::link(URI::current().$query, $text, compact('class'), Request::secure());
|
return '<li'.HTML::attributes(array('class' => $class)).'>'. HTML::link(URI::current().$query, $text, array(), Request::secure()).'</li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user