diff --git a/libs/NiftyGrid/GridPaginator.php b/libs/NiftyGrid/GridPaginator.php index 64579a6..9c45b14 100644 --- a/libs/NiftyGrid/GridPaginator.php +++ b/libs/NiftyGrid/GridPaginator.php @@ -16,21 +16,24 @@ class GridPaginator extends \Nette\Application\UI\Control /** @persistent int */ public $page = 1; - /** - * @var Paginator - */ + /** @var Paginator */ public $paginator; - public function __construct() + /** @var string */ + protected $templatePath = null; + + + public function __construct($templatePath = null) { parent::__construct(); $this->paginator = new Paginator; + $this->setTemplate($templatePath); } public function render() { $this->template->paginator = $this->paginator; - $this->template->setFile(__DIR__ . '/../../templates/paginator.latte'); + $this->template->setFile(!empty($this->templatePath) ? $this->templatePath : __DIR__ . '/../../templates/paginator.latte'); $this->template->render(); } @@ -42,4 +45,13 @@ public function loadState(array $params) parent::loadState($params); $this->paginator->page = $this->page; } -} \ No newline at end of file + + /** + * @param string $templatePath + */ + public function setTemplate($templatePath) + { + $this->templatePath = $templatePath; + } + +}