update default param of content model

This commit is contained in:
Manuel Raynaud
2013-09-21 16:07:25 +02:00
parent f44b7daf8c
commit 1da66ece29
7 changed files with 43 additions and 18 deletions

View File

@@ -227,6 +227,11 @@
<requirement key="content_id">\d+</requirement>
</route>
<route id="admin.content.save" path="/admin/content/save">
<default key="_controller">Thelia\Controller\Admin\ContentController::processUpdateAction</default>
</route>
<!-- Route to the Coupon controller (process Coupon browsing) -->
<route id="admin.coupon.list" path="/admin/coupon/">

View File

@@ -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())
);
}
}
}

View File

@@ -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 ----------------------------------------

View File

@@ -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))
;

View File

@@ -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(

View File

@@ -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();
}

View File

@@ -88,9 +88,9 @@
</div>
{/form_field}
{* <div class="row">
<div class="row">
<div class="col-md-6">
{form_field form=$form field='parent'}
{form_field form=$form field='default_folder'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">
@@ -101,9 +101,9 @@
<option value="0">{intl l="Top level"}</option>
{$myparent=$PARENT}
*}{* loop name="fold-parent" type="folder-tree" visible="*" folder="0"}
{* loop name="fold-parent" type="folder-tree" visible="*" folder="0"}
<option value="{$ID}" style="padding-left: {3 + $LEVEL * 20}px" {if $myparent == $ID}selected="selected"{/if} {if $folder_id == $ID}disabled="disabled"{/if}>{$TITLE}</option>
{/loop *}{*
{/loop *}
</select>
</div>
@@ -123,7 +123,7 @@
</div>
{/form_field}
</div>
</div>*}
</div>
<div class="row">
<div class="col-md-12">