From 7c30bc7893286d239bd8949e557bcf1c92f7217b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Bugy=C3=ADk?= Date: Mon, 28 Apr 2014 17:42:07 +0200 Subject: [PATCH] Reverted template filter for "use in template" workaround. --- Grido/Grid.latte | 30 +++++++++++++++--------------- Grido/Grid.php | 18 ------------------ 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/Grido/Grid.latte b/Grido/Grid.latte index 8d79e687..fd3ab5a1 100755 --- a/Grido/Grid.latte +++ b/Grido/Grid.latte @@ -12,14 +12,14 @@ $form->getElementPrototype()->class[] = 'ajax grido'; $operation = $control->hasOperation(); - $actions = $control->hasActions() ? $control->getComponent(Action::ID)->getComponents() : array(); + $actions = $control->hasActions() ? $control->getComponent(\Grido\Components\Actions\Action::ID)->getComponents() : array(); - $filters = $control->hasFilters() ? $form->getComponent(Filter::ID)->getComponents() : array(); + $filters = $control->hasFilters() ? $form->getComponent(\Grido\Components\Filters\Filter::ID)->getComponents() : array(); $filterRenderType = $control->getFilterRenderType(); - $columns = $control->getComponent(Column::ID)->getComponents(); + $columns = $control->getComponent(\Grido\Components\Columns\Column::ID)->getComponents(); $columnCount = count($columns) + ($operation ? 1 : 0); - $showActionsColumn = $actions || ($filters && $filterRenderType == Filter::RENDER_INNER); + $showActionsColumn = $actions || ($filters && $filterRenderType == \Grido\Components\Filters\Filter::RENDER_INNER); /* TWITTER BOOTSTRAP 2/3 */ $buttons = $form->getComponent('buttons'); @@ -51,7 +51,7 @@ {/if} {form form} -{if $filterRenderType == Filter::RENDER_OUTER} +{if $filterRenderType == \Grido\Components\Filters\Filter::RENDER_OUTER}
@@ -74,15 +74,15 @@ {$control->getTablePrototype()->startTag()|noescape} - + {foreach $columns as $column} {$column->getHeaderPrototype()->startTag()|noescape} {if $column->isSortable()} - {$column->getLabel()|noescape} - {$column->getLabel()|noescape} - {$column->getLabel()|noescape} + {$column->getLabel()|noescape} + {$column->getLabel()|noescape} + {$column->getLabel()|noescape} {else} {$column->getLabel()|noescape} @@ -93,7 +93,7 @@ {_'Actions'} - + {foreach $columns as $column} {if $column->hasFilter()} {$control->getFilter($column->getName())->getWrapperPrototype()->startTag()|noescape} @@ -118,9 +118,9 @@ - {$form[Operation::ID][Operation::ID]->control} - {?$form[Grid::BUTTONS][Operation::ID]->controlPrototype->class[] = 'hide'} - {$form[Grid::BUTTONS][Operation::ID]->control} + {$form[\Grido\Components\Operation::ID][\Grido\Components\Operation::ID]->control} + {?$form[\Grido\Grid::BUTTONS][\Grido\Components\Operation::ID]->controlPrototype->class[] = 'hide'} + {$form[\Grido\Grid::BUTTONS][\Grido\Components\Operation::ID]->control} {if $control->page == 1} @@ -150,7 +150,7 @@ {formContainer buttons} {input perPage, class => 'hide'} {/formContainer} - + @@ -159,7 +159,7 @@ {var $propertyAccessor = $control->getPropertyAccessor()} {foreach $data as $row} {? $checkbox = $operation - ? $form[Operation::ID][$propertyAccessor->getProperty($row, $control->getComponent(Operation::ID)->getPrimaryKey())] + ? $form[\Grido\Components\Operation::ID][$propertyAccessor->getProperty($row, $control->getComponent(\Grido\Components\Operation::ID)->getPrimaryKey())] : NULL; $tr = $control->getRowPrototype($row); $tr->class[] = $checkbox && $checkbox->getValue() diff --git a/Grido/Grid.php b/Grido/Grid.php index c8a74490..fd4a3f68 100755 --- a/Grido/Grid.php +++ b/Grido/Grid.php @@ -731,24 +731,6 @@ public function createTemplate($class = NULL) $template->setFile(__DIR__ . '/Grid.latte'); $template->registerHelper('translate', callback($this->getTranslator(), 'translate')); - $namespaceFilter = function($source) - { - $namespaces = array( - '\Grido\Grid', '\Grido\Components\Columns\Column', '\Grido\Components\Filters\Filter', - '\Grido\Components\Actions\Action', '\Grido\Components\Operation', '\Grido\Components\Export' - ); - - return '' . $source; - }; - - //TODO - if (\Nette\Framework::VERSION_ID >= 20200) { - $template->addFilter(NULL, $namespaceFilter); - } else { - $template->registerFilter(new \Nette\Latte\Engine); - $template->registerFilter($namespaceFilter); - } - return $template; }