Factorized creation and confirmation modal dialogs
This commit is contained in:
@@ -36,6 +36,7 @@ use Thelia\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
class BaseAdminController extends BaseController
|
||||
{
|
||||
@@ -94,7 +95,7 @@ class BaseAdminController extends BaseController
|
||||
protected function errorPage($message)
|
||||
{
|
||||
if ($message instanceof \Exception) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $message->getMessage());
|
||||
$message = sprintf($this->getTranslator()->trans("Sorry, an error occured: %msg"), array('msg' => $message->getMessage()));
|
||||
}
|
||||
|
||||
return $this->render('general_error', array(
|
||||
@@ -125,7 +126,7 @@ class BaseAdminController extends BaseController
|
||||
// Generate the proper response
|
||||
$response = new Response();
|
||||
|
||||
return $response->setContent($this->errorPage("Sorry, you're not allowed to perform this action"));
|
||||
return $this->errorPage($this->getTranslator()->trans("Sorry, you're not allowed to perform this action"));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -164,7 +165,7 @@ class BaseAdminController extends BaseController
|
||||
)
|
||||
);
|
||||
|
||||
if ($fom != null) {
|
||||
if ($form != null) {
|
||||
// Mark the form as errored
|
||||
$form->setErrorMessage($error_message);
|
||||
|
||||
@@ -312,7 +313,7 @@ class BaseAdminController extends BaseController
|
||||
}
|
||||
catch (AuthorizationException $ex) {
|
||||
// User is not allowed to perform the required action. Return the error page instead of the requested page.
|
||||
return $this->errorPage("Sorry, you are not allowed to perform this action.");
|
||||
return $this->errorPage($this->getTranslator()->trans("Sorry, you are not allowed to perform this action."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ use Thelia\Form\CategoryDeletionForm;
|
||||
use Thelia\Model\Lang;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Core\Event\CategoryUpdatePositionEvent;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
|
||||
class CategoryController extends BaseAdminController
|
||||
{
|
||||
@@ -107,8 +108,6 @@ class CategoryController extends BaseAdminController
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
$createEvent = new CategoryCreateEvent();
|
||||
|
||||
$createEvent = new CategoryCreateEvent(
|
||||
$data["title"],
|
||||
$data["parent"],
|
||||
@@ -122,7 +121,7 @@ class CategoryController extends BaseAdminController
|
||||
$createdObject = $createEvent->getCategory();
|
||||
|
||||
// Log category creation
|
||||
$this->adminLogAppend(sprintf("Category %s (ID %s) created", $createdObject->getName(), $createdObject->getId()));
|
||||
$this->adminLogAppend(sprintf("Category %s (ID %s) created", $createdObject->getTitle(), $createdObject->getId()));
|
||||
|
||||
// Substitute _ID_ in the URL with the ID of the created object
|
||||
$successUrl = str_replace('_ID_', $createdObject->getId(), $creationForm->getSuccessUrl());
|
||||
@@ -157,19 +156,17 @@ class CategoryController extends BaseAdminController
|
||||
|
||||
// Load the category object
|
||||
$category = CategoryQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('category_id'));
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->findOneById($this->getRequest()->get('category_id'));
|
||||
|
||||
if ($category != null) {
|
||||
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $category->getId(),
|
||||
'name' => $category->getName(),
|
||||
'name' => $category->getTitle(),
|
||||
'locale' => $category->getLocale(),
|
||||
'code' => $category->getCode(),
|
||||
'symbol' => $category->getSymbol(),
|
||||
'rate' => $category->getRate()
|
||||
// tbc !!!
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
@@ -227,7 +224,7 @@ class CategoryController extends BaseAdminController
|
||||
// Log category modification
|
||||
$changedObject = $changeEvent->getCategory();
|
||||
|
||||
$this->adminLogAppend(sprintf("Category %s (ID %s) modified", $changedObject->getName(), $changedObject->getId()));
|
||||
$this->adminLogAppend(sprintf("Category %s (ID %s) modified", $changedObject->getTitle(), $changedObject->getId()));
|
||||
|
||||
// If we have to stay on the same page, do not redirect to the succesUrl,
|
||||
// just redirect to the edit page again.
|
||||
|
||||
48
core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php
Normal file
48
core/lib/Thelia/Core/Event/BaseToggleVisibilityEvent.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
|
||||
class BaseToggleVisibilityEvent extends ActionEvent
|
||||
{
|
||||
protected $object_id;
|
||||
|
||||
protected $object;
|
||||
|
||||
public function __construct($object_id)
|
||||
{
|
||||
$this->object_id = $object_id;
|
||||
}
|
||||
|
||||
public function getObjectId()
|
||||
{
|
||||
return $this->object_id;
|
||||
}
|
||||
|
||||
public function setObjectId($object_id)
|
||||
{
|
||||
$this->object_id = $object_id;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ class AsseticHelper
|
||||
//
|
||||
// before generating 3bc974a-ad3ef47.css, delete 3bc974a-* files.
|
||||
//
|
||||
if (/*$dev_mode == true || */! file_exists($target_file)) {
|
||||
if ($dev_mode == true || ! file_exists($target_file)) {
|
||||
|
||||
// Delete previous version of the file
|
||||
list($commonPart, $dummy) = explode('-', $asset_target_path);
|
||||
|
||||
67
core/lib/Thelia/Form/ProductCreationForm.php
Normal file
67
core/lib/Thelia/Form/ProductCreationForm.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
class ProductCreationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("ref", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Product reference *",
|
||||
"label_attr" => array(
|
||||
"for" => "ref"
|
||||
)
|
||||
))
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Product title *",
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
))
|
||||
->add("parent", "integer", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
))
|
||||
->add("locale", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_product_creation";
|
||||
}
|
||||
}
|
||||
58
core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
Normal file
58
core/lib/Thelia/Form/StandardDescriptionFieldsTrait.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
/**
|
||||
* This form defines all standard description fields:
|
||||
* - title
|
||||
* - chapo
|
||||
* - description
|
||||
* - postscriptum
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
Trait StandardDescriptionFieldsTrait
|
||||
{
|
||||
protected function addStandardDescriptionFields()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("locale", "hidden", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
)
|
||||
)
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
)
|
||||
)
|
||||
->add("chapo", "text", array())
|
||||
->add("description", "text", array())
|
||||
->add("postscriptum", "text", array())
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ trait PositionManagementTrait {
|
||||
->orderByPosition(Criteria::DESC)
|
||||
->limit(1);
|
||||
|
||||
if ($parent !== null) $last->filterByParent($parent);
|
||||
if ($parent !== null) $query->filterByParent($parent);
|
||||
|
||||
$last = $query->findOne()
|
||||
;
|
||||
|
||||
@@ -327,94 +327,87 @@
|
||||
|
||||
{* Adding a new Category *}
|
||||
|
||||
<div class="modal fade" id="add_category_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
{capture "category_creation_dialog"}
|
||||
{form name="thelia.admin.category.creation"}
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Create a new categiry"}</h3>
|
||||
</div>
|
||||
{* Assign form enctype *}
|
||||
{$creation_form_enctype={form_enctype form=$form}}
|
||||
|
||||
{form name="thelia.admin.category.creation"}
|
||||
<form method="POST" action="{url path='/admin/configuration/categories/create'}" {form_enctype form=$form}>
|
||||
{* Assign form error message, if any *}
|
||||
{if $form_error}
|
||||
{$creation_form_error=$form_error_message}
|
||||
{/if}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/categories/update' category_id='_ID_'}" />
|
||||
{/form_field}
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/categories/update' category_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
<div class="modal-body">
|
||||
{form_field form=$form field='parent'}
|
||||
<input type="hidden" name="{$name}" value="{$current_category_id}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-block alert-error" id="add_category_dialog_error">{$form_error_message}</div>{/if}
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency name'}" placeholder="{intl l='Name'}">
|
||||
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="$TITLE" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the category name in the default language ($TITLE)"}</div>
|
||||
<div class="help-block">{intl l='Enter here the category name in the default language (%title)' title="$TITLE"}</div>
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
{/form}
|
||||
{/capture}
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this category"}</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="Cancel"}</button>
|
||||
</div>
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
dialog_id = "add_category_dialog"
|
||||
dialog_title = {intl l="Create a new category"}
|
||||
dialog_body = {$smarty.capture.category_creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this category"}
|
||||
dialog_cancel_label = {intl l="Cancel"}
|
||||
|
||||
form_action = {url path='/admin/categories/create'}
|
||||
form_enctype = $creation_form_enctype
|
||||
form_error_message = {$creation_form_error|default:''}
|
||||
}
|
||||
|
||||
{* Delete category confirmation dialog *}
|
||||
|
||||
<div class="modal fade" id="delete_category_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
{capture "category_delete_dialog"}
|
||||
<input type="hidden" name="current_category_id" value="{$current_category_id}" />
|
||||
<input type="hidden" name="category_id" id="delete_category_id" value"" />
|
||||
{/capture}
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete a category"}</h3>
|
||||
</div>
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{intl l="Do you really want to delete this category ?"}</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="{url path='/admin/categories/delete'}">
|
||||
<input type="hidden" name="current_category_id" value="{$current_category_id}" />
|
||||
|
||||
<input type="hidden" name="category_id" id="delete_category_id" value="" />
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
dialog_id = "delete_category_dialog"
|
||||
dialog_title = {intl l="Delete a category"}
|
||||
dialog_message = {intl l="Do you really want to delete this category, and <strong>all</strong> its contents ?"}
|
||||
|
||||
form_action = {url path='/admin/categories/delete'}
|
||||
form_content = {$smarty.capture.category_delete_dialog nofilter}
|
||||
}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
|
||||
{* Adding a new Category *}
|
||||
|
||||
<div class="modal fade" id="add_category_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Create a new category"}</h3>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.category.creation"}
|
||||
<form method="POST" action="{url path='/admin/catalog/category'}" {form_enctype form=$form}>
|
||||
|
||||
{* the action processed by the controller *}
|
||||
<input type="hidden" name="action" value="create" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='parent'}
|
||||
<input type="hidden" name="{$name}" value="{$current_category_id}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to category change page. _ID_ is replaced with the ID of the created category (see Thelia\Action\Category.php) *}
|
||||
<input type="hidden" name="{$name}" value="{url path='admin/catalog/category' id="_ID_" action='edit'}" />
|
||||
{/form_field}
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
{if #form_error}<div class="alert alert-error" id="add_category_dialog_error">#form_error_message</div>{/if}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{loop type="lang" name="default-lang" default_only="1"}
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Category title'}" placeholder="{intl l='Category title'}" class="form-control">
|
||||
<span class="input-group-addon"><img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
|
||||
</div>
|
||||
|
||||
<div class="help-block">{intl l="Enter here the category title in the default language ($TITLE)"}</div>
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
|
||||
{/loop}
|
||||
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="Cancel"}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this category"}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
26
templates/admin/default/includes/catalog-breadcrumb.html
Normal file
26
templates/admin/default/includes/catalog-breadcrumb.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{* Breadcrumb for categories browsing and editing *}
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="{url path='admin/home'}">Home</a></li>
|
||||
<li><a href="{url path='admin/catalog'}">Catalog</a>
|
||||
|
||||
{ifloop rel="category_path"}</li>
|
||||
{loop name="category_path" type="category-path" visible="*" category=$current_category_id}
|
||||
{if $ID == $current_category_id}
|
||||
<li class="active">
|
||||
{if $action == 'edit'}
|
||||
{intl l='Editing %cat' cat="{$TITLE}"}
|
||||
{else}
|
||||
{$TITLE} <a href="{url path='admin/catalog/category/edit' category_id=$ID}" title="{intl l='Edit this category'}">{intl l="(edit)"}</a>
|
||||
{/if}
|
||||
</li>
|
||||
{else}
|
||||
<li><a href="{url path='admin/catalog/category' id=" $ID" action='browse'}">{$TITLE}</a></li>
|
||||
{/if}
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="category_path"}
|
||||
</li>
|
||||
{/elseloop}
|
||||
</ul>
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
{* Adding a new Category *}
|
||||
|
||||
<div class="modal fade" id="delete_category_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete a category"}</h3>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.category.deletion"}
|
||||
<form method="POST" action="{url path='/admin/catalog/category'}" {form_enctype form=$form}>
|
||||
|
||||
{* the action processed by the controller *}
|
||||
<input type="hidden" name="action" value="delete" />
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='category_id'}
|
||||
<input type="hidden" name="{$name}" id="delete-category-id" value="" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to catalog. _ID_ is replaced with the ID of the deleted category parent id (see Thelia\Action\Category.php) *}
|
||||
<input type="hidden" name="{$name}" value="{url path='admin/catalog/category' id="_ID_" action='browse'}" />
|
||||
{/form_field}
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
{if #form_error}<div class="alert alert-block alert-error" id="add_category_dialog_error">#form_error_message</div>{/if}
|
||||
|
||||
<p>{intl l="Delete this category and all its contents ?"}</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
43
templates/admin/default/includes/generic-confirm-dialog.html
Normal file
43
templates/admin/default/includes/generic-confirm-dialog.html
Normal file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
|
||||
A generic modal confirmation dialog template.
|
||||
|
||||
Parameters:
|
||||
|
||||
dialog_id = the dialog id attribute
|
||||
dialog_title = the dialog title
|
||||
dialog_message = the dialog confirmation message
|
||||
|
||||
dialog_ok_label = The OK button label (default: yes)
|
||||
dialog_cancel_label = The Cancel button label (default: no)
|
||||
|
||||
form_action = the form action URL, subtitted by a click on OK button
|
||||
form_method = the form method, default "POST"
|
||||
form_content = the form content
|
||||
|
||||
*}
|
||||
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{$dialog_title}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{$dialog_message nofilter}
|
||||
</div>
|
||||
|
||||
<form method="{$form_method|default:POST}" action="{$form_action}">
|
||||
|
||||
{$form_content nofilter}
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {$dialog_cancel_label|default:{intl l="No"}}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l="Yes"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
43
templates/admin/default/includes/generic-create-dialog.html
Executable file
43
templates/admin/default/includes/generic-create-dialog.html
Executable file
@@ -0,0 +1,43 @@
|
||||
{*
|
||||
|
||||
A generic modal creation dialog template. Parameters
|
||||
|
||||
dialog_id = the dialog id attribute
|
||||
dialog_title = the dialog title
|
||||
dialog_body = the dialog body. In most cases, this is a creation form
|
||||
|
||||
dialog_ok_label = The OK button label. Default create
|
||||
dialog_cancel_label = The cancel button label. Default create
|
||||
|
||||
form_action = The form action URL. Form is submitted when OK button is clicked
|
||||
form_enctype = The form encoding
|
||||
form_error_message = The form error message (optional)
|
||||
*}
|
||||
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{$dialog_title nofilter}</h3>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="{$form_action nofilter}" {$form_enctype nofilter}>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
{if ! empty($form_error_message)}<div class="alert alert-block alert-error" id="{$dialog_id}_error">{$form_error_message nofilter}</div>{/if}
|
||||
|
||||
{$dialog_body nofilter}
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {$dialog_cancel_label|default:{intl l='Cancel'}}</button>
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {$dialog_ok_label|default:{intl l='OK'}}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user