From 8c864021f52ab13f0f84de4633a0fae7f613139a Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Fri, 6 Dec 2013 18:59:46 +0100 Subject: [PATCH] =?UTF-8?q?Added=20sorting=20and=20position=20=C3=B9manage?= =?UTF-8?q?ment=20to=20modules.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Action/Module.php | 12 +++ .../Thelia/Config/Resources/routing/admin.xml | 4 + .../Controller/Admin/ModuleController.php | 36 +++++++-- core/lib/Thelia/Core/Event/TheliaEvents.php | 6 ++ core/lib/Thelia/Core/Template/Loop/Module.php | 45 ++++++++++- core/lib/Thelia/Model/Module.php | 20 +++++ .../AdminIncludes/module_configuration.html | 2 +- .../default/includes/module-block.html | 77 +++++++++++++++++-- templates/backOffice/default/modules.html | 26 +++++++ 9 files changed, 215 insertions(+), 13 deletions(-) diff --git a/core/lib/Thelia/Action/Module.php b/core/lib/Thelia/Action/Module.php index d27bedd1f..286779667 100644 --- a/core/lib/Thelia/Action/Module.php +++ b/core/lib/Thelia/Action/Module.php @@ -33,6 +33,7 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Map\ModuleTableMap; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; +use Thelia\Core\Event\UpdatePositionEvent; /** * Class Module @@ -122,6 +123,16 @@ class Module extends BaseAction implements EventSubscriberInterface } } + /** + * Changes position, selecting absolute ou relative change. + * + * @param CategoryChangePositionEvent $event + */ + public function updatePosition(UpdatePositionEvent $event) + { + return $this->genericUpdatePosition(ModuleQuery::create(), $event); + } + protected function cacheClear() { $cacheEvent = new CacheEvent($this->container->getParameter('kernel.cache_dir')); @@ -153,6 +164,7 @@ class Module extends BaseAction implements EventSubscriberInterface { return array( TheliaEvents::MODULE_TOGGLE_ACTIVATION => array('toggleActivation', 128), + TheliaEvents::MODULE_UPDATE_POSITION => array('updatePosition', 128), TheliaEvents::MODULE_DELETE => array('delete', 128), TheliaEvents::MODULE_UPDATE => array('update', 128), ); diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 591e5c0e7..1aa99c0aa 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -954,6 +954,10 @@ Thelia\Controller\Admin\ModuleController::deleteAction + + Thelia\Controller\Admin\ModuleController::updatePositionAction + +