Started category modification
This commit is contained in:
@@ -37,6 +37,7 @@ use Thelia\Model\Lang;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Core\Event\CategoryUpdatePositionEvent;
|
||||
use Thelia\Model\CategoryQuery;
|
||||
use Thelia\Form\CategoryModificationForm;
|
||||
|
||||
class CategoryController extends BaseAdminController
|
||||
{
|
||||
@@ -46,13 +47,10 @@ class CategoryController extends BaseAdminController
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList() {
|
||||
|
||||
$args = $this->setupArgs();
|
||||
|
||||
return $this->render('categories', $args);
|
||||
return $this->render('categories', $this->getTemplateArgs());
|
||||
}
|
||||
|
||||
protected function setupArgs() {
|
||||
protected function getTemplateArgs() {
|
||||
|
||||
// Get the category ID
|
||||
$category_id = $this->getRequest()->get('category_id', 0);
|
||||
@@ -164,8 +162,14 @@ class CategoryController extends BaseAdminController
|
||||
// Prepare the data that will hydrate the form
|
||||
$data = array(
|
||||
'id' => $category->getId(),
|
||||
'name' => $category->getTitle(),
|
||||
'locale' => $category->getLocale(),
|
||||
'title' => $category->getTitle(),
|
||||
'chapo' => $category->getChapo(),
|
||||
'description' => $category->getDescription(),
|
||||
'postscriptum' => $category->getPostscriptum(),
|
||||
'parent' => $category->getParent(),
|
||||
'visible' => $category->getVisible() ? true : false,
|
||||
'url' => $category->getUrl($this->getCurrentEditionLocale())
|
||||
// tbc !!!
|
||||
);
|
||||
|
||||
@@ -177,7 +181,7 @@ class CategoryController extends BaseAdminController
|
||||
}
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('category-edit', array('category_id' => $this->getRequest()->get('category_id')));
|
||||
return $this->render('category-edit', $this->getTemplateArgs());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -23,51 +23,33 @@
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* A base form for all objects with standard contents.
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
abstract class BaseDescForm extends BaseForm
|
||||
class CategoryModificationForm extends CategoryCreationForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
parent::buildForm(true);
|
||||
|
||||
$this->formBuilder
|
||||
->add("locale", "hidden", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
)
|
||||
)
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Title",
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
)
|
||||
)
|
||||
->add("chapo", "text", array(
|
||||
"label" => "Summary",
|
||||
"label_attr" => array(
|
||||
"for" => "summary"
|
||||
)
|
||||
))
|
||||
->add("description", "text", array(
|
||||
"label" => "Detailed description",
|
||||
"label_attr" => array(
|
||||
"for" => "detailed_description"
|
||||
)
|
||||
))
|
||||
->add("postscriptum", "text", array(
|
||||
"label" => "Conclusion",
|
||||
"label_attr" => array(
|
||||
"for" => "conclusion"
|
||||
)
|
||||
->add("id", "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||
|
||||
->add("visible", "checkbox", array(
|
||||
"label" => Translator::getInstance()->trans("This category is online on the front office.")
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
// Add standard description fields
|
||||
$this->addStandardDescFields(array('title', 'locale'));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_category_modification";
|
||||
}
|
||||
}
|
||||
@@ -27,12 +27,12 @@ use Thelia\Model\LangQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
|
||||
class ConfigModificationForm extends BaseDescForm
|
||||
class ConfigModificationForm extends BaseForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
parent::buildForm(true);
|
||||
|
||||
$this->formBuilder
|
||||
->add("id", "hidden", array(
|
||||
"constraints" => array(
|
||||
@@ -61,6 +61,9 @@ class ConfigModificationForm extends BaseDescForm
|
||||
"label" => "Prevent variable modification or deletion, except for super-admin"
|
||||
))
|
||||
;
|
||||
|
||||
// Add standard description fields
|
||||
$this->addStandardDescFields();
|
||||
}
|
||||
|
||||
public function getName()
|
||||
|
||||
@@ -24,35 +24,69 @@ namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* This form defines all standard description fields:
|
||||
* - title
|
||||
* - chapo
|
||||
* - description
|
||||
* - postscriptum
|
||||
* A trait to add standard localized description fields to a form.
|
||||
*
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
Trait StandardDescriptionFieldsTrait
|
||||
trait StandardDescriptionFieldsTrait
|
||||
{
|
||||
protected function addStandardDescriptionFields()
|
||||
/**
|
||||
* Add standard description fields + locale tot the form
|
||||
*
|
||||
* @param array $exclude name of the fields that should not be added to the form
|
||||
*/
|
||||
protected function addStandardDescFields($exclude = array())
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("locale", "hidden", array(
|
||||
if (! in_array('locale', $exclude))
|
||||
$this->formBuilder
|
||||
->add("locale", "hidden", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (! in_array('title', $exclude))
|
||||
$this->formBuilder
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => Translator::getInstance()->trans("Title"),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
)
|
||||
)
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
);
|
||||
|
||||
if (! in_array('chapo', $exclude))
|
||||
$this->formBuilder
|
||||
->add("chapo", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Summary"),
|
||||
"label_attr" => array(
|
||||
"for" => "summary"
|
||||
)
|
||||
)
|
||||
)
|
||||
->add("chapo", "text", array())
|
||||
->add("description", "text", array())
|
||||
->add("postscriptum", "text", array())
|
||||
;
|
||||
));
|
||||
|
||||
if (! in_array('description', $exclude))
|
||||
$this->formBuilder
|
||||
->add("description", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Detailed description"),
|
||||
"label_attr" => array(
|
||||
"for" => "detailed_description"
|
||||
)
|
||||
));
|
||||
|
||||
if (! in_array('postscriptum', $exclude))
|
||||
$this->formBuilder
|
||||
->add("postscriptum", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Conclusion"),
|
||||
"label_attr" => array(
|
||||
"for" => "conclusion"
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
{* -- Bootstrap CSS section --------------------------------------------- *}
|
||||
|
||||
{block name="before-bootstrap-css"}{/block}
|
||||
|
||||
|
||||
{stylesheets file='assets/less/*' filters='less,cssembed'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
@@ -47,15 +47,15 @@
|
||||
|
||||
<div class="topbar">
|
||||
<div class="container">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="version-info">{intl l='Version %ver' ver="{$THELIA_VERSION}"}</div>
|
||||
</div>
|
||||
|
||||
{module_include location='inside_topbar'}
|
||||
|
||||
<div class="col-md-6 clearfix">
|
||||
{module_include location='inside_topbar'}
|
||||
|
||||
<div class="col-md-6 clearfix">
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<a href="{navigate to="index"}" title="{intl l='View site'}" target="_blank" class="btn btn-default"><span class="glyphicon glyphicon-eye-open"></span> {intl l="View shop"}</a>
|
||||
@@ -64,14 +64,14 @@
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="profile" href="{url path='admin/edit_profile'}"><span class="glyphicon glyphicon-edit"></span> {intl l="Profil"}</a></li>
|
||||
<li><a class="profile" href="{url path='admin/edit_profile'}"><span class="glyphicon glyphicon-edit"></span> {intl l="Profil"}</a></li>
|
||||
<li><a class="logout" href="{url path='admin/logout'}" title="{intl l='Close administation session'}"><span class="glyphicon glyphicon-off"></span> {intl l="Logout"}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
{module_include location='before_top_menu'}
|
||||
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="navbar-header">
|
||||
@@ -91,7 +91,7 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="collapse navbar-collapse navbar-collapse">
|
||||
@@ -163,13 +163,13 @@
|
||||
|
||||
{/loop}
|
||||
</ul>
|
||||
|
||||
|
||||
{loop name="top-bar-search" type="auth" roles="ADMIN" permissions="admin.search"}
|
||||
<form class="navbar-form pull-right" action="{url path='/admin/search'}">
|
||||
<form class="navbar-form pull-right" action="{url path='/admin/search'}">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="search_term" name="search_term" placeholder="{intl l='Search'}">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
|
||||
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
|
||||
</form>
|
||||
{/loop}
|
||||
|
||||
|
||||
@@ -331,7 +331,6 @@
|
||||
{form name="thelia.admin.category.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
{capture "category_creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
@@ -346,26 +345,26 @@
|
||||
{/form_field}
|
||||
|
||||
{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>
|
||||
<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="$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)' title="$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 form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
{/capture}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="catalog edit-category">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{include file="includes/categories-breadcrumb.html"}
|
||||
{include file="includes/catalog-breadcrumb.html"}
|
||||
|
||||
<div class="row">
|
||||
{loop name="category_edit" type="category" visible="*" id="{$current_category_id}" backend_context="1" lang="$edit_language_id"}
|
||||
@@ -26,6 +26,7 @@
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs admin-tabs" id="tabbed_menu">
|
||||
<li class="active">
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.currencies.create"}
|
||||
<span class="pull-right">
|
||||
<button class="btn btn-default btn-info" title="{intl l='Update rates'}">{intl l='Update rates'} <span class="glyphicon glyphicon-globe"></span></button>
|
||||
<a class="btn btn-default btn-primary" title="{intl l='Add a new currency'}" href="#add_currency_dialog" data-toggle="modal">
|
||||
<a class="btn btn-default btn-primary" title="{intl l='Add a new currency'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
</span>
|
||||
@@ -163,7 +163,7 @@
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.currencies.delete"}
|
||||
<a class="btn btn-default btn-xs currency-delete" title="{intl l='Delete this currency'}" href="#delete_currency_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<a class="btn btn-default btn-xs currency-delete" title="{intl l='Delete this currency'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -199,116 +199,96 @@
|
||||
|
||||
{* Adding a new currency *}
|
||||
|
||||
<div class="modal fade" id="add_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
{form name="thelia.admin.currency.creation"}
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Create a new currency"}</h3>
|
||||
</div>
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{form name="thelia.admin.currency.creation"}
|
||||
<form method="POST" action="{url path='/admin/configuration/currencies/create'}" {form_enctype form=$form}>
|
||||
{form_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
{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>
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created currency ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/currencies/update' currency_id='_ID_'}" />
|
||||
{/form_field}
|
||||
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
|
||||
|
||||
<div class="modal-body">
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
{if $form_error}<div class="alert alert-block alert-error" id="add_currency_dialog_error">{$form_error_message}</div>{/if}
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
{form_field form=$form field='code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
|
||||
<span class="help-block"><a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a></span>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{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>
|
||||
{form_field form=$form field='symbol'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<div class="help-block">{intl l="Enter here the currency name in the default language ($TITLE)"}</div>
|
||||
{form_field form=$form field='rate'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
|
||||
<span class="help-block">{intl l="The rate from Euro (Price in Euro * rate = Price in this currency)"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
{/capture}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
<input type="hidden" name="{$name}" value="{$LOCALE}" />
|
||||
{/form_field}
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
{form_field form=$form field='code'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='ISO 4217 code'}" placeholder="{intl l='Code'}">
|
||||
<span class="help-block"><a href="http://fr.wikipedia.org/wiki/ISO_4217" target="_blank">{intl l='More information about ISO 4217'}</a></span>
|
||||
</div>
|
||||
{/form_field}
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new currency"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
{form_field form=$form field='symbol'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency symbol'}" placeholder="{intl l='Symbol'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
dialog_ok_label = {intl l="Create this currency"}
|
||||
|
||||
{form_field form=$form field='rate'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" class="form-control" value="{$value}" title="{intl l='Currency rate'}" placeholder="{intl l='Rate'}">
|
||||
<span class="help-block">{intl l="The rate from Euro (Price in Euro * rate = Price in this currency)"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Create this currency"}</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>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
form_action = {url path='/admin/configuration/currencies/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
<div class="modal fade" id="delete_currency_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="currency_id" id="currency_delete_id" value="" />
|
||||
{/capture}
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete a currency"}</h3>
|
||||
</div>
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{intl l="Do you really want to delete this currency ?"}</p>
|
||||
</div>
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete currency"}
|
||||
dialog_message = {intl l="Do you really want to delete this currency ?"}
|
||||
|
||||
<form method="post" action="{url path='/admin/configuration/currencies/delete'}">
|
||||
<input type="hidden" name="currency_id" id="currency_delete_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>
|
||||
form_action = {url path='/admin/configuration/currencies/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
@@ -329,27 +309,12 @@
|
||||
$('#currency_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
{* display the form creation dialog if it contains errors *}
|
||||
|
||||
{form name="thelia.admin.currency.creation"}
|
||||
{if #form_error}
|
||||
$('#add_currency_dialog').modal();
|
||||
{/if}
|
||||
{/form}
|
||||
|
||||
{* Always reset create dialog on close *}
|
||||
|
||||
$('#add_currency_dialog').on('hidden',function() {
|
||||
|
||||
// Hide error currency
|
||||
$('#add_currency_dialog_error').remove();
|
||||
|
||||
// Clear error status
|
||||
$("#add_currency_dialog .error").removeClass('error');
|
||||
|
||||
// Empty field values
|
||||
$("#add_currency_dialog input[type=text]").val('');
|
||||
});
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.currency.creation"
|
||||
}
|
||||
|
||||
{* Inline editing of object position using bootstrap-editable *}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<caption>
|
||||
{intl l='Thelia mailing templates'}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.messages.create"}
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new mailing template'}" href="#add_message_dialog" data-toggle="modal">
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new mailing template'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
@@ -41,7 +41,7 @@
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
{loop name="mailing-templates" type="message" secured="*" backend_context="1" lang="$lang_id"}
|
||||
<tr>
|
||||
@@ -71,7 +71,7 @@
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.configuration.messages.delete"}
|
||||
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_message_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
|
||||
{/loop}
|
||||
</div>
|
||||
{else}
|
||||
@@ -79,7 +79,7 @@
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
{/loop}
|
||||
{elseloop rel="mailing-templates"}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
@@ -102,110 +102,89 @@
|
||||
</div>
|
||||
|
||||
|
||||
{* Adding a new message *}
|
||||
|
||||
<div class="modal fade" id="add_message_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 mailing template"}</h3>
|
||||
</div>
|
||||
|
||||
{form name="thelia.admin.message.creation"}
|
||||
<form method="POST" action="{url path='/admin/configuration/messages/create'}" {form_enctype 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 message ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages/update' message_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
{* We do not allow users to create secured messages from here *}
|
||||
|
||||
{form_field form=$form field='secured'}
|
||||
<input type="hidden" name="{$name}" value="0" />
|
||||
{/form_field}
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
{if #form_error}<div class="alert alert-danger" id="add_message_dialog_error">#form_error_message</div>{/if}
|
||||
|
||||
{form_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template name'}" placeholder="{intl l='Mailing template name'}" class="form-control">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{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"}
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template purpose'}" placeholder="{intl l='Mailing template purpose'}" 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 mailing template purpose 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 mailing template"}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* Adding a new message *}
|
||||
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
{form name="thelia.admin.message.creation"}
|
||||
|
||||
<div class="modal fade" id="delete_message_dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="Delete a mailing template"}</h3>
|
||||
</div>
|
||||
{form_field form=$form field='success_url'}
|
||||
{* on success, redirect to the edition page, _ID_ is replaced with the created message ID, see controller *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/messages/update' message_id='_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{intl l="Do you really want to delete this mailing template ?"}</p>
|
||||
</div>
|
||||
{* We do not allow users to create secured messages from here *}
|
||||
|
||||
<form method="post" action="{url path='/admin/configuration/messages/delete'}">
|
||||
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
||||
{form_field form=$form field='secured'}
|
||||
<input type="hidden" name="{$name}" value="0" />
|
||||
{/form_field}
|
||||
|
||||
<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_field form=$form field='name'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template name'}" placeholder="{intl l='Mailing template name'}" class="form-control">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{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"}
|
||||
|
||||
{* Switch edition to the current locale *}
|
||||
<input type="hidden" name="edit_language_id" value="{$ID}" />
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Mailing template purpose'}" placeholder="{intl l='Mailing template purpose'}" 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 mailing template purpose 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}
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new mailing template"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
dialog_ok_label = {intl l="Create this mailing template"}
|
||||
|
||||
form_action = {url path='/admin/configuration/messages/create'}
|
||||
form_enctype = {form_enctype form=$form}
|
||||
form_error_message = $form_error_message
|
||||
}
|
||||
{/form}
|
||||
|
||||
{* Delete confirmation dialog *}
|
||||
|
||||
{capture "delete_dialog"}
|
||||
<input type="hidden" name="message_id" id="message_delete_id" value="" />
|
||||
{/capture}
|
||||
|
||||
{include
|
||||
file = "includes/generic-confirm-dialog.html"
|
||||
|
||||
dialog_id = "delete_dialog"
|
||||
dialog_title = {intl l="Delete mailing template"}
|
||||
dialog_message = {intl l="Do you really want to delete this mailing template ?"}
|
||||
|
||||
form_action = {url path='/admin/configuration/messages/delete'}
|
||||
form_content = {$smarty.capture.delete_dialog nofilter}
|
||||
}
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
@@ -217,26 +196,12 @@
|
||||
$('#message_delete_id').val($(this).data('id'));
|
||||
});
|
||||
|
||||
{* display the form creation dialog if it contains errors *}
|
||||
|
||||
{form name="thelia.admin.message.creation"}
|
||||
{if #form_error}
|
||||
$('#add_message_dialog').modal();
|
||||
{/if}
|
||||
{/form}
|
||||
|
||||
{* Always reset create dialog on close *}
|
||||
|
||||
$('#add_message_dialog').on('hidden',function() {
|
||||
// Hide error message
|
||||
$('#add_message_dialog_error').remove();
|
||||
|
||||
// Clear error status
|
||||
$("#add_message_dialog .error").removeClass('error');
|
||||
|
||||
// Empty field values
|
||||
$("#add_message_dialog input[type=text]").val('');
|
||||
});
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.message.creation"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -26,7 +26,7 @@
|
||||
{intl l='Thelia system variables'}
|
||||
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.variables.create"}
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new variable'}" href="#add_variable_dialog" data-toggle="modal">
|
||||
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new variable'}" href="#creation_dialog" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-plus-sign"></span>
|
||||
</a>
|
||||
<button class="btn btn-default btn-primary" title="{intl l='Save chages'}"><span class="glyphicon glyphicon-ok"></span> {intl l='Save changes'}</button>
|
||||
@@ -135,10 +135,10 @@
|
||||
|
||||
{* Adding a new variable *}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
|
||||
{form name="thelia.admin.config.creation"}
|
||||
|
||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||
{capture "creation_dialog"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
@@ -199,7 +199,7 @@
|
||||
{include
|
||||
file = "includes/generic-create-dialog.html"
|
||||
|
||||
dialog_id = "add_variable_dialog"
|
||||
dialog_id = "creation_dialog"
|
||||
dialog_title = {intl l="Create a new variable"}
|
||||
dialog_body = {$smarty.capture.creation_dialog nofilter}
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
// JS stuff for creation form
|
||||
{include
|
||||
file = "includes/generic-js-dialog.html"
|
||||
dialog_id = "add_variable_dialog"
|
||||
dialog_id = "creation_dialog"
|
||||
form_name = "thelia.admin.config.creation"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user