start creating folder management

This commit is contained in:
Manuel Raynaud
2013-09-19 11:31:13 +02:00
parent fd46ba3648
commit 466798e7af
4 changed files with 54 additions and 30 deletions

View File

@@ -159,16 +159,15 @@
<!-- Folder routes management -->
<route id="admin.folders.default" path="/admin/folders">
<default key="_controller">Thelia\Controller\Admin\FolderController::indexAction</default>
<default key="_controller">Thelia\Controller\Admin\FolderController::defaultAction</default>
</route>
<route id="admin.folders.create" path="/admin/folders/create">
<default key="_controller">Thelia\Controller\Admin\FolderController::createAction</default>
</route>
<route id="admin.folders.update" path="/admin/folders/update/{folder_id}" methods="get">
<route id="admin.folders.update" path="/admin/folders/update" methods="get">
<default key="_controller">Thelia\Controller\Admin\FolderController::updateAction</default>
<requirement key="folder_id">\d+</requirement>
</route>
<!-- Route to the Coupon controller (process Coupon browsing) -->

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\TheliaEvents;
/**
* Class FolderController
@@ -30,18 +31,25 @@ namespace Thelia\Controller\Admin;
*/
class FolderController extends AbstractCrudController
{
public function indexAction()
{
if (null !== $response = $this->checkAuth("admin.folder.view")) return $response;
return $this->render("folders", array("display_folder" => 20));
}
public function updateAction($folder_id)
{
return $this->render("folder-edit", array(
"folder_id" => $folder_id
));
public function __construct()
{
parent::__construct(
'folder',
'manual',
'folder_order',
'admin.folder.default',
'admin.folder.create',
'admin.folder.update',
'admin.folder.delete',
TheliaEvents::FOLDER_CREATE,
TheliaEvents::FOLDER_UPDATE,
TheliaEvents::FOLDER_DELETE,
TheliaEvents::FOLDER_TOGGLE_VISIBILITY,
TheliaEvents::FOLDER_UPDATE_POSITION
);
}
/**
@@ -151,17 +159,34 @@ class FolderController extends AbstractCrudController
*
* @param unknown $currentOrder, if any, null otherwise.
*/
protected function renderListTemplate($currentOrder)
{
// TODO: Implement renderListTemplate() method.
protected function renderListTemplate($currentOrder) {
// Get product order
$product_order = $this->getListOrderFromSession('content', 'content_order', 'manual');
return $this->render('folders',
array(
'folder_order' => $currentOrder,
'content_order' => $product_order,
'folder_id' => $this->getRequest()->get('folder_id', 0)
));
}
/**
* Render the edition template
*/
protected function renderEditionTemplate()
protected function renderEditionTemplate() {
return $this->render('folder-edit', $this->getEditionArguments());
}
protected function getEditionArguments()
{
// TODO: Implement renderEditionTemplate() method.
return array(
'folder_id' => $this->getRequest()->get('folder_id', 0),
'current_tab' => $this->getRequest()->get('current_tab', 'general')
);
}
/**