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 --> <!-- Folder routes management -->
<route id="admin.folders.default" path="/admin/folders"> <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>
<route id="admin.folders.create" path="/admin/folders/create"> <route id="admin.folders.create" path="/admin/folders/create">
<default key="_controller">Thelia\Controller\Admin\FolderController::createAction</default> <default key="_controller">Thelia\Controller\Admin\FolderController::createAction</default>
</route> </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> <default key="_controller">Thelia\Controller\Admin\FolderController::updateAction</default>
<requirement key="folder_id">\d+</requirement>
</route> </route>
<!-- Route to the Coupon controller (process Coupon browsing) --> <!-- Route to the Coupon controller (process Coupon browsing) -->

View File

@@ -22,6 +22,7 @@
/*************************************************************************************/ /*************************************************************************************/
namespace Thelia\Controller\Admin; namespace Thelia\Controller\Admin;
use Thelia\Core\Event\TheliaEvents;
/** /**
* Class FolderController * Class FolderController
@@ -30,18 +31,25 @@ namespace Thelia\Controller\Admin;
*/ */
class FolderController extends AbstractCrudController 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( public function __construct()
"folder_id" => $folder_id {
)); 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. * @param unknown $currentOrder, if any, null otherwise.
*/ */
protected function renderListTemplate($currentOrder) protected function renderListTemplate($currentOrder) {
{
// TODO: Implement renderListTemplate() method. // 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 * 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')
);
} }
/** /**

View File

@@ -101,9 +101,9 @@
<option value="0">{intl l="Top level"}</option> <option value="0">{intl l="Top level"}</option>
{$myparent=$PARENT} {$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> <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> </select>
</div> </div>
@@ -209,7 +209,7 @@
</thead> </thead>
<tbody> <tbody>
{loop name="assigned_contents" type="associated_content" folder="$folder_id" backend_context="1" lang="$edit_language_id"} {*loop name="assigned_contents" type="associated_content" folder="$folder_id" backend_context="1" lang="$edit_language_id"}
<tr> <tr>
<td>{$ID}</td> <td>{$ID}</td>
@@ -239,7 +239,7 @@
</div> </div>
</td> </td>
</tr> </tr>
{/elseloop} {/elseloop*}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -45,7 +45,7 @@
current_order=$folder_order current_order=$folder_order
order='id' order='id'
reverse_order='id_reverse' reverse_order='id_reverse'
path={url path='/admin/folders' id_folder=$folder_id} path={url path='/admin/folders' folder_id=$folder_id}
request_parameter_name='folder_order' request_parameter_name='folder_order'
label="{intl l='ID'}" label="{intl l='ID'}"
} }
@@ -58,7 +58,7 @@
current_order=$folder_order current_order=$folder_order
order='alpha' order='alpha'
reverse_order='alpha_reverse' reverse_order='alpha_reverse'
path={url path='/admin/folders' id_folder=$folder_id} path={url path='/admin/folders' folder_id=$folder_id}
request_parameter_name='folder_order' request_parameter_name='folder_order'
label="{intl l='Folder title'}" label="{intl l='Folder title'}"
} }
@@ -71,7 +71,7 @@
current_order=$folder_order current_order=$folder_order
order='visible' order='visible'
reverse_order='visible_reverse' reverse_order='visible_reverse'
path={url path='/admin/folders' id_folder=$folder_id} path={url path='/admin/folders' folder_id=$folder_id}
request_parameter_name='folder_order' request_parameter_name='folder_order'
label="{intl l='Online'}" label="{intl l='Online'}"
} }
@@ -82,7 +82,7 @@
current_order=$folder_order current_order=$folder_order
order='manual' order='manual'
reverse_order='manual_reverse' reverse_order='manual_reverse'
path={url path='/admin/folders' id_folder=$folder_id} path={url path='/admin/folders' folder_id=$folder_id}
request_parameter_name='folder_order' request_parameter_name='folder_order'
label="{intl l='Position'}" label="{intl l='Position'}"
} }
@@ -99,12 +99,12 @@
<td> <td>
{loop type="image" name="folder_image" source="folder" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"} {loop type="image" name="folder_image" source="folder" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/folder' folder_id=$ID}" title="{intl l='Browse this folder'}"><img class="img-thumbnail" src="{$IMAGE_URL}" alt="{$TITLE}" /></a> <a href="{url path='admin/folders' folder_id=$ID}" title="{intl l='Browse this folder'}"><img class="img-thumbnail" src="{$IMAGE_URL}" alt="{$TITLE}" /></a>
{/loop} {/loop}
</td> </td>
<td class="object-title"> <td class="object-title">
<a href="{url path='admin/folder' folder_id=$ID}" title="{intl l='Browse this folder'}"> <a href="{url path='admin/folders' folder_id=$ID}" title="{intl l='Browse this folder'}">
{$TITLE} {$TITLE}
</a> </a>
</td> </td>
@@ -138,7 +138,7 @@
<td class="actions"> <td class="actions">
<div class="btn-group"> <div class="btn-group">
<a class="btn btn-default btn-xs" title="{intl l='Browse this folder'}" href="{url path='admin/folder' folder_id=$ID}"><i class="glyphicon glyphicon-folder-open"></i></a> <a class="btn btn-default btn-xs" title="{intl l='Browse this folder'}" href="{url path='admin/folders' folder_id=$ID}"><i class="glyphicon glyphicon-folder-open"></i></a>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"} {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.folders.edit"}
<a class="btn btn-default btn-xs" title="{intl l='Edit this folder'}" href="{url path='/admin/folders/update' folder_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a> <a class="btn btn-default btn-xs" title="{intl l='Edit this folder'}" href="{url path='/admin/folders/update' folder_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>