Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
make simplePaginate() ready. create PaginationHTML class.
Browse files Browse the repository at this point in the history
  • Loading branch information
liorocks committed Apr 1, 2015
1 parent 7c4da7e commit c75f309
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 99 deletions.
103 changes: 4 additions & 99 deletions src/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Pagination\UrlWindow;
use Illuminate\Pagination\UrlWindowPresenterTrait;

class Pagination implements PresenterContract {
class Pagination extends PaginationHTML implements PresenterContract {

use UrlWindowPresenterTrait;

Expand All @@ -23,48 +23,6 @@ class Pagination implements PresenterContract {
*/
protected $window;

/**
* Pagination wrapper HTML.
*
* @var string
*/
protected $paginationWrapper = '<ul class="pagination">%s %s %s</ul>';

/**
* Available page wrapper HTML.
*
* @var string
*/
protected $availablePageWrapper = '<li><a href="%s">%s</a></li>';

/**
* Get active page wrapper HTML.
*
* @var string
*/
protected $activePageWrapper = '<li class="active"><span>%s</span></li>';

/**
* Get disabled page wrapper HTML.
*
* @var string
*/
protected $disabledPageWrapper = '<li class="disabled"><span>%s</span></li>';

/**
* Previous button text.
*
* @var string
*/
protected $previousButtonText = '&laquo;';

/**
* Next button text.
*
* @var string
*/
protected $nextButtonText = '&raquo;';

/**
* Create a new Pagination presenter instance.
*
Expand All @@ -87,60 +45,6 @@ public function hasPages()
return $this->paginator->hasPages();
}

/**
* Get pagination wrapper HTML.
*
* @return string
*/
protected function getPaginationWrapperHTML() {
return $this->paginationWrapper;
}

/**
* Get available page wrapper HTML.
*
* @return string
*/
protected function getAvailablePageWrapperHTML() {
return $this->availablePageWrapper;
}

/**
* Get active page wrapper HTML.
*
* @return string
*/
protected function getActivePageWrapperHTML() {
return $this->activePageWrapper;
}

/**
* Get disabled page wrapper HTML.
*
* @return string
*/
protected function getDisabledPageWrapperHTML() {
return $this->disabledPageWrapper;
}

/**
* Get previous button text.
*
* @return string
*/
protected function getPreviousButtonText() {
return $this->previousButtonText;
}

/**
* Get next button text.
*
* @return string
*/
protected function getNextButtonText() {
return $this->nextButtonText;
}

/**
* Convert the URL window into Pagination HTML.
*
Expand Down Expand Up @@ -202,7 +106,7 @@ protected function getActivePageWrapper($text)
*/
protected function getDots()
{
return $this->getDisabledTextWrapper("...");
return $this->getDisabledTextWrapper($this->getDotsText());
}

/**
Expand Down Expand Up @@ -244,8 +148,8 @@ protected function getPageLinkWrapper($url, $page)

/**
* Get the previous page pagination element.
*
* @return string
* @internal param string $text
*/
protected function getPreviousButton()
{
Expand All @@ -265,6 +169,7 @@ protected function getPreviousButton()

/**
* Get the next page pagination element.
*
* @return string
*/
protected function getNextButton()
Expand Down
117 changes: 117 additions & 0 deletions src/PaginationHTML.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php namespace Landish\Pagination;

class PaginationHTML {

/**
* Pagination wrapper HTML.
*
* @var string
*/
protected $paginationWrapper = '<ul class="pagination">%s %s %s</ul>';

/**
* Available page wrapper HTML.
*
* @var string
*/
protected $availablePageWrapper = '<li><a href="%s">%s</a></li>';

/**
* Get active page wrapper HTML.
*
* @var string
*/
protected $activePageWrapper = '<li class="active"><span>%s</span></li>';

/**
* Get disabled page wrapper HTML.
*
* @var string
*/
protected $disabledPageWrapper = '<li class="disabled"><span>%s</span></li>';

/**
* Previous button text.
*
* @var string
*/
protected $previousButtonText = '&laquo;';

/**
* Next button text.
*
* @var string
*/
protected $nextButtonText = '&raquo;';

/***
* "Dots" text.
*
* @var string
*/
protected $dotsText = '...';

/**
* Get pagination wrapper HTML.
*
* @return string
*/
protected function getPaginationWrapperHTML() {
return $this->paginationWrapper;
}

/**
* Get available page wrapper HTML.
*
* @return string
*/
protected function getAvailablePageWrapperHTML() {
return $this->availablePageWrapper;
}

/**
* Get active page wrapper HTML.
*
* @return string
*/
protected function getActivePageWrapperHTML() {
return $this->activePageWrapper;
}

/**
* Get disabled page wrapper HTML.
*
* @return string
*/
protected function getDisabledPageWrapperHTML() {
return $this->disabledPageWrapper;
}

/**
* Get previous button text.
*
* @return string
*/
protected function getPreviousButtonText() {
return $this->previousButtonText;
}

/**
* Get next button text.
*
* @return string
*/
protected function getNextButtonText() {
return $this->nextButtonText;
}

/***
* Get "dots" text.
*
* @return string
*/
protected function getDotsText() {
return $this->dotsText;
}

}
25 changes: 25 additions & 0 deletions src/Simple/Pagination.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php namespace Landish\Pagination\Simple;

use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
use Landish\Pagination\Pagination as PaginationPresenter;

class Pagination extends PaginationPresenter {

/**
* Pagination wrapper HTML.
*
* @var string
*/
protected $paginationWrapper = '<ul class="pager">%s %s %s</ul>';

/**
* Create a simple Pagination presenter.
*
* @param \Illuminate\Contracts\Pagination\Paginator $paginator
*/
public function __construct(PaginatorContract $paginator)
{
$this->paginator = $paginator;
}

}
18 changes: 18 additions & 0 deletions src/Simple/SemanticUI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php namespace Landish\Pagination\Simple;

use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
use Landish\Pagination\SemanticUI as SemanticUIPresenter;

class SemanticUI extends SemanticUIPresenter {

/**
* Create a simple Pagination presenter.
*
* @param \Illuminate\Contracts\Pagination\Paginator $paginator
*/
public function __construct(PaginatorContract $paginator)
{
$this->paginator = $paginator;
}

}
18 changes: 18 additions & 0 deletions src/Simple/UIKit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php namespace Landish\Pagination\Simple;

use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
use Landish\Pagination\UIKit as UIKitPresenter;

class UIKit extends UIKitPresenter {

/**
* Create a simple Pagination presenter.
*
* @param \Illuminate\Contracts\Pagination\Paginator $paginator
*/
public function __construct(PaginatorContract $paginator)
{
$this->paginator = $paginator;
}

}
18 changes: 18 additions & 0 deletions src/Simple/ZurbFoundation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php namespace Landish\Pagination\Simple;

use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
use Landish\Pagination\ZurbFoundation as ZurbFoundationPresenter;

class ZurbFoundation extends ZurbFoundationPresenter {

/**
* Create a simple Pagination presenter.
*
* @param \Illuminate\Contracts\Pagination\Paginator $paginator
*/
public function __construct(PaginatorContract $paginator)
{
$this->paginator = $paginator;
}

}

0 comments on commit c75f309

Please sign in to comment.