diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index a94c0b4fe..8ced3500a 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -227,6 +227,11 @@ \d+ + + Thelia\Controller\Admin\ContentController::processUpdateAction + + + diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php index d3706e479..176115a1f 100644 --- a/core/lib/Thelia/Controller/Admin/ContentController.php +++ b/core/lib/Thelia/Controller/Admin/ContentController.php @@ -268,4 +268,20 @@ class ContentController extends AbstractCrudController array('parent' => $this->getFolderId()) ); } + + /** + * @param \Thelia\Core\Event\Content\ContentUpdateEvent $updateEvent + * @return Response|void + */ + protected function performAdditionalUpdateAction($updateEvent) + { + if ($this->getRequest()->get('save_mode') != 'stay') { + + // Redirect to parent category list + $this->redirectToRoute( + 'admin.folders.default', + array('parent' => $this->getFolderId()) + ); + } + } } \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 346b41c3b..ee49d239b 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -187,23 +187,23 @@ final class TheliaEvents // -- content management ----------------------------------------------- - const CONTENT_CREATE = "action.createFolder"; - const CONTENT_UPDATE = "action.updateFolder"; - const CONTENT_DELETE = "action.deleteFolder"; - const CONTENT_TOGGLE_VISIBILITY = "action.toggleFolderVisibility"; - const CONTENT_UPDATE_POSITION = "action.updateFolderPosition"; + const CONTENT_CREATE = "action.createContent"; + const CONTENT_UPDATE = "action.updateContent"; + const CONTENT_DELETE = "action.deleteContent"; + const CONTENT_TOGGLE_VISIBILITY = "action.toggleContentVisibility"; + const CONTENT_UPDATE_POSITION = "action.updateContentPosition"; // const FOLDER_ADD_CONTENT = "action.categoryAddContent"; // const FOLDER_REMOVE_CONTENT = "action.categoryRemoveContent"; - const BEFORE_CREATECONTENT = "action.before_createFolder"; - const AFTER_CREATECONTENT = "action.after_createFolder"; + const BEFORE_CREATECONTENT = "action.before_createContent"; + const AFTER_CREATECONTENT = "action.after_createContent"; - const BEFORE_DELETECONTENT = "action.before_deleteFolder"; - const AFTER_DELETECONTENT = "action.after_deleteFolder"; + const BEFORE_DELETECONTENT = "action.before_deleteContent"; + const AFTER_DELETECONTENT = "action.after_deleteContent"; - const BEFORE_UPDATECONTENT = "action.before_updateFolder"; - const AFTER_UPDATECONTENT = "action.after_updateFolder"; + const BEFORE_UPDATECONTENT = "action.before_updateContent"; + const AFTER_UPDATECONTENT = "action.after_updateContent"; // -- Categories Associated Content ---------------------------------------- diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index a29cb2e60..0136f4e9c 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -234,6 +234,7 @@ class Content extends BaseI18nLoop ->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION')) ->set("POSTSCRIPTUM", $content->getVirtualColumn('i18n_POSTSCRIPTUM')) ->set("POSITION", $content->getPosition()) + ->set("DEFAULT_FOLDER", $content->getDefaultFolderId()) ->set("URL", $content->getUrl($locale)) ; diff --git a/core/lib/Thelia/Form/ContentCreationForm.php b/core/lib/Thelia/Form/ContentCreationForm.php index 2a4743bf8..df8838f59 100644 --- a/core/lib/Thelia/Form/ContentCreationForm.php +++ b/core/lib/Thelia/Form/ContentCreationForm.php @@ -40,9 +40,11 @@ class ContentCreationForm extends BaseForm ) )) ->add("default_folder", "integer", array( + "label" => Translator::getInstance()->trans("Default folder *"), "constraints" => array( new NotBlank() - ) + ), + "label_attr" => array("for" => "default_folder") )) ->add("locale", "text", array( "constraints" => array( diff --git a/core/lib/Thelia/Model/Content.php b/core/lib/Thelia/Model/Content.php index 0f57742c2..79c66dc0f 100755 --- a/core/lib/Thelia/Model/Content.php +++ b/core/lib/Thelia/Model/Content.php @@ -34,7 +34,8 @@ class Content extends BaseContent public function getDefaultFolderId() { - //@TODO update contentFolder Table, adding by_default column + //@TODO update contentFolder Table, adding by_default column and change this code for returnin good value + return $this->getFolders()->getFirst()->getId(); } diff --git a/templates/admin/default/content-edit.html b/templates/admin/default/content-edit.html index 97fc02d70..e8ef4a5b1 100644 --- a/templates/admin/default/content-edit.html +++ b/templates/admin/default/content-edit.html @@ -88,9 +88,9 @@ {/form_field} - {*
+
- {form_field form=$form field='parent'} + {form_field form=$form field='default_folder'}
@@ -123,7 +123,7 @@
{/form_field}
-
*} +