From 8370158f9d1cb6a342f92f3373164277cb151583 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Fri, 30 May 2014 11:49:03 +0200 Subject: [PATCH] fix saves & close action on document and images. Fix #402 --- core/lib/Thelia/Controller/Admin/FileController.php | 5 +++-- templates/backOffice/default/document-edit.html | 2 +- templates/backOffice/default/image-edit.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php index 8494d833a..9938050ac 100644 --- a/core/lib/Thelia/Controller/Admin/FileController.php +++ b/core/lib/Thelia/Controller/Admin/FileController.php @@ -35,6 +35,7 @@ use Thelia\Model\ProductDocument; use Thelia\Model\ProductImage; use Thelia\Tools\FileManager; use Thelia\Tools\Rest\ResponseRest; +use Thelia\Tools\URL; /** * Created by JetBrains PhpStorm. @@ -389,7 +390,7 @@ class FileController extends BaseAdminController $this->adminLogAppend(AdminResources::retrieve($parentType), AccessManager::UPDATE, sprintf('Image with Ref %s (ID %d) modified', $imageUpdated->getTitle(), $imageUpdated->getId())); if ($this->getRequest()->get('save_mode') == 'close') { - $this->redirectToRoute('admin.images'); + $this->redirect(URL::getInstance()->absoluteUrl($fileManager->getRedirectionUrl($parentType, $image->getParentId(), FileManager::FILE_TYPE_IMAGES))); } else { $this->redirectSuccess($imageModification); } @@ -466,7 +467,7 @@ class FileController extends BaseAdminController $this->adminLogAppend(AdminResources::retrieve($parentType), AccessManager::UPDATE, sprintf('Document with Ref %s (ID %d) modified', $documentUpdated->getTitle(), $documentUpdated->getId())); if ($this->getRequest()->get('save_mode') == 'close') { - $this->redirectToRoute('admin.documents'); + $this->redirect(URL::getInstance()->absoluteUrl($fileManager->getRedirectionUrl($parentType, $document->getParentId(), FileManager::FILE_TYPE_DOCUMENTS))); } else { $this->redirectSuccess($documentModification); } diff --git a/templates/backOffice/default/document-edit.html b/templates/backOffice/default/document-edit.html index b39cf1aee..f8caa97aa 100644 --- a/templates/backOffice/default/document-edit.html +++ b/templates/backOffice/default/document-edit.html @@ -34,7 +34,7 @@ hide_submit_buttons = false page_url = "{url path="/admin/document/type/{$documentType}/{$ID}/update"}" - close_url = "{url path="{$redirectUrl}"}" + close_url = "{url path="{$redirectUrl}" noamp=1}" } {form_hidden_fields form=$form} diff --git a/templates/backOffice/default/image-edit.html b/templates/backOffice/default/image-edit.html index 88c7cc5a1..0461ce1a8 100644 --- a/templates/backOffice/default/image-edit.html +++ b/templates/backOffice/default/image-edit.html @@ -34,7 +34,7 @@ hide_submit_buttons = false page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}" - close_url = "{url path="{$redirectUrl}"}" + close_url = "{url path="{$redirectUrl}" noamp=1}" } {form_hidden_fields form=$form}