Merge branch 'master' of https://github.com/thelia/thelia into coupon

# By franck (6) and others
# Via franck (3) and others
* 'master' of https://github.com/thelia/thelia:
  Implemented "Remember Me" feature on admin. Started template management
  Added Templates events
  First version of installation wizard
  tax engine retriever
  allow address removal from front
  Insert pagination inside tfoot
  allow update customer address in front tempalte
  allow to create a new address
  allow to make an address as default on update action
  Finished attributes management
  Fixed action column alignment
  Fixed duplication parameter check regexp
  absoluteUrl prevetn duplicate parameters in generated URL
This commit is contained in:
gmorel
2013-09-16 10:01:34 +02:00
140 changed files with 18725 additions and 3379 deletions

View File

@@ -0,0 +1,15 @@
<div class="form-group">
{ifloop rel="free_attributes"}
<select name="free_attributes" id="free_attributes" class="form-control">
<option value="">Select an attribute...</option>
{loop name="free_attributes" type="attribute" template="$template_id" backend_context="1" lang="$edit_language_id"}
<option value="{$ID}">{$TITLE}</option>
{/loop}
</select>
<span class="help-block">{intl l='Select an attribute and click (+) to add it to this template'}</span>
{/ifloop}
{elseloop rel="free_attributes"}
<div class="alert alert-info">There is currently no available attributes.</div>
{/elseloop}
</div>

View File

@@ -4,7 +4,8 @@
<div class="span4 feed-list-item">
<h3>{$DATE}</h3>
<h2><a href="{$URL}" target="_blank" title="{intl l='Lire la suite'}">{$TITLE|strip_tags nofilter}</a></h2>
<p>{$DESCRIPTION|strip_tags|truncate:250:"...":true nofilter}</p>
{* we use unescape:"htmlall" to unescape var before truncate, to prevent a cut in the middel of an HTML entity, eg &ea... *}
<p>{$DESCRIPTION|strip_tags|unescape:"htmlall"|truncate:250:"...":true nofilter}</p>
<p><a class="btn" href="{$URL}" target="_blank">{intl l='Lire la suite »'}</a></p>
</div>
{/loop}

View File

@@ -1,3 +1,22 @@
tfoot{
.pagination{
margin: 0;
}
}
.table-condensed {
tfoot {
> tr {
> th,
> td {
padding: 20px 5px 5px;
}
}
}
}
.table-striped {
caption {
@@ -55,6 +74,13 @@
.table-left-aligned {
th, td {
text-align: left;
&.text-center {
text-align: center;
}
&.text-right {
text-align: right;
}
}
select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {

View File

@@ -8,6 +8,7 @@
@import "modals.less";
@import "tables.less";
@import "tablesorter.less";
@import "wizard.less";
@import "bootstrap-editable.less";
@import "bootstrap-switch.less";

View File

@@ -0,0 +1,129 @@
.wizard {
background-color: #fff;
border: 1px solid #d4d4d4;
border-radius: 4px;
.box-shadow(0 1px 4px rgba(0, 0, 0, 0.065));
*zoom: 1;
margin-bottom: 20px;
&:before,
&:after {
display: table;
line-height: 0;
content: "";
clear: both;
}
ul {
padding: 0;
margin: 0;
list-style: none outside none;
}
li {
position: relative;
float: left;
height: 46px;
padding: 0 10px 0 30px;
margin: 0;
font-size: 15px;
line-height: 46px;
color: #999999;
cursor: default;
background: #ededed;
&.complete {
color: #468847;
background: #f3f4f5;
&:hover{
background: #e8e8e8;
.chevron:before {
border-left: 14px solid #e8e8e8;
}
}
a{
color: inherit;
text-decoration: none;
font-weight: normal;
}
.chevron:before {
border-left: 14px solid #f3f4f5;
}
}
&.active {
color: @link-color;
background: #fff;
.chevron:before {
border-left: 14px solid #fff;
}
}
.chevron {
position: absolute;
top: 0;
right: -14px;
display: block;
border: 24px solid transparent;
border-right: 0;
border-left: 14px solid #d4d4d4;
&:before {
position: absolute;
top: -24px;
right: 1px;
display: block;
border: 24px solid transparent;
border-right: 0;
border-left: 14px solid #ededed;
content: "";
}
}
.badge {
margin-right: 8px;
}
&:nth-child(1) {
z-index: 10;
padding-left: 20px;
border-radius: 4px 0 0 4px;
}
&:nth-child(2) {
z-index: 9;
}
&:nth-child(3) {
z-index: 8;
}
&:nth-child(4) {
z-index: 7;
}
&:nth-child(5) {
z-index: 6;
}
&:nth-child(6) {
z-index: 5;
}
&:nth-child(7) {
z-index: 4;
}
&:nth-child(8) {
z-index: 3;
}
&:nth-child(9) {
z-index: 2;
}
&:nth-child(10) {
z-index: 1;
}
}
}

View File

@@ -37,6 +37,10 @@
<p class="title title-without-tabs">{intl l='Attribute information'}</p>
{form_field form=$form field='id'}
<input type="hidden" name="{$name}" value="{$attribute_id}" />
{/form_field}
{* Be sure to get the attribute ID, even if the form could not be validated *}
<input type="hidden" name="attribute_id" value="{$attribute_id}" />
@@ -52,7 +56,7 @@
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
{include file="includes/standard-description-form-fields.html"}
{include file="includes/standard-description-form-fields.html" form=$form}
</div>
<div class="col-md-6">
@@ -79,9 +83,10 @@
<tr>
<th>
{admin_sortable_header
current_order=$order
current_order=$attributeav_order
order='id'
reverse_order='id_reverse'
request_parameter_name='attributeav_order'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='ID'}"
}
@@ -89,9 +94,10 @@
<th>
{admin_sortable_header
current_order=$order
current_order=$attributeav_order
order='alpha'
reverse_order='alpha_reverse'
request_parameter_name='attributeav_order'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l='Value'}"
}
@@ -99,9 +105,10 @@
<th class="text-center">
{admin_sortable_header
current_order=$order
current_order=$attributeav_order
order='manual'
reverse_order='manual_reverse'
request_parameter_name='attributeav_order'
path={url path='/admin/configuration/attributes/update' attribute_id=$attribute_id}
label="{intl l="Position"}"
}
@@ -114,12 +121,13 @@
</thead>
<tbody>
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$order}
{loop name="list" type="attribute_availability" attribute=$attribute_id backend_context="1" lang=$edit_language_id order=$attributeav_order}
<tr>
<td>{$ID}</td>
<td>
<input class="js-edit form-control" type="text" name="" value="{$TITLE}" />
{* FIXME : integrate this in the encolsing form to provide standard form processing *}
<input class="js-edit form-control" type="text" name="attribute_values[{$ID}]" value="{$TITLE}" />
</td>
<td class="text-center">
@@ -151,7 +159,7 @@
<tr>
<td colspan="4">
<div class="alert alert-info">
{intl l="No product attribute has been created yet. Click the + button to create one."}
{intl l="No value has been created yet. Click the + button to create one."}
</div>
</td>
</tr>

View File

@@ -97,6 +97,17 @@
{module_include location='attributes_table_row'}
<td class="actions">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
<div class="btn-group">
<a class="btn btn-default btn-xs attribute-remove-from-all" title="{intl l='Remove this attribute from all product templates'}" href="#remove_from_all_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-minus"></span>
</a>
<a class="btn btn-default btn-xs attribute-add-to-all" title="{intl l='Add this attribute to all product templates'}" href="#add_to_all_dialog" data-id="{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-plus"></span>
</a>
</div>
{/loop}
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.attributes.change"}
<a class="btn btn-default btn-xs attribute-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/attributes/update' attribute_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
@@ -217,6 +228,47 @@
form_content = {$smarty.capture.delete_dialog nofilter}
}
{* Add to all dialog *}
{capture "add_to_all_dialog"}
<input type="hidden" name="attribute_id" id="attribute_add_to_all_id" value="" />
{module_include location='attribute_add_to_all_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "add_to_all_dialog"
dialog_title = {intl l="Add to all product templates"}
dialog_message = {intl l="Do you really want to add this attribute to all product templates ?"}
form_action = {url path='/admin/configuration/attributes/add-to-all-templates'}
form_content = {$smarty.capture.add_to_all_dialog nofilter}
}
{* Remove from all dialog *}
{capture "remove_from_all_dialog"}
<input type="hidden" name="attribute_id" id="attribute_remove_from_all_id" value="" />
{module_include location='attribute_add_to_all_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "remove_from_all_dialog"
dialog_title = {intl l="Remove from all product templates"}
dialog_message = {intl l="Do you really want to remove this attribute from all product templates ? You'll loose all product related data for this attribute."}
form_action = {url path='/admin/configuration/attributes/remove-from-all-templates'}
form_content = {$smarty.capture.remove_from_all_dialog nofilter}
}
{/block}
{block name="javascript-initialization"}
@@ -233,6 +285,14 @@
$('#attribute_delete_id').val($(this).data('id'));
});
$('a.attribute-add-to-all').click(function(ev) {
$('#attribute_add_to_all_id').val($(this).data('id'));
});
$('a.attribute-remove-from-all').click(function(ev) {
$('#attribute_remove_from_all_id').val($(this).data('id'));
});
// JS stuff for creation form
{include
file = "includes/generic-js-dialog.html"

View File

@@ -82,7 +82,7 @@
}
</th>
<th>{intl l='Actions'}</th>
<th class="actions">{intl l='Actions'}</th>
</tr>
</thead>

View File

@@ -111,7 +111,7 @@
{module_include location='currencies_table_header'}
<th class="text-right">{intl l='Actions'}</th>
<th class="actions">{intl l='Actions'}</th>
</tr>
</thead>

View File

@@ -11,9 +11,9 @@
<div class="customer">
<div id="wrapper" class="container">
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/customers'}">{intl l="Customers"}</a></li>
</ul>
@@ -58,7 +58,7 @@
<th>{intl l='order amount'}</th>
<th>{intl l='Actions'}</th>
<th class="actions">{intl l='Actions'}</th>
</tr>
</thead>
@@ -102,6 +102,39 @@
</tr>
{/loop}
</tbody>
<tfoot>
<tr>
<td colspan="6">
<div class="text-center">
<ul class="pagination pagination-centered">
{if $customer_page != 1}
<li><a href="{url path="/admin/customers" page="1"}">&laquo;</a></li>
{else}
<li class="disabled"><a href="#">&laquo;</a></li>
{/if}
{pageloop rel="customer_list"}
{if $PAGE != $CURRENT}
<li><a href="{url path="/admin/customers" page="{$PAGE}"}">{$PAGE}</a></li>
{else}
<li class="active"><a href="#">{$PAGE}</a></li>
{/if}
{/pageloop}
{if $PAGE == $LAST && $LAST != $CURRENT}
<li><a href="{url path="/admin/customers" page="$PAGE"}">&raquo;</a></li>
{else}
<li class="disabled"><a href="#">&raquo;</a></li>
{/if}
</ul>
</div>
</td>
</tr>
</tfoot>
{/ifloop}
</table>
</div>
@@ -110,35 +143,6 @@
{module_include location='customer_bottom'}
<div class="row">
<div class="col-md-12 text-center">
<ul class="pagination pagination-centered">
{if $customer_page != 1}
<li><a href="{url path="/admin/customers" page="1"}">&laquo;</a></li>
{else}
<li class="disabled"><a href="#">&laquo;</a></li>
{/if}
{pageloop rel="customer_list"}
{if $PAGE != $CURRENT}
<li><a href="{url path="/admin/customers" page="{$PAGE}"}">{$PAGE}</a></li>
{else}
<li class="active"><a href="#">{$PAGE}</a></li>
{/if}
{/pageloop}
{if $PAGE == $LAST && $LAST != $CURRENT}
<li><a href="{url path="/admin/customers" page="$PAGE"}">&raquo;</a></li>
{else}
<li class="disabled"><a href="#">&raquo;</a></li>
{/if}
</ul>
</div>
</div>
{* Adding a new Category *}
@@ -154,23 +158,23 @@
{* 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/customer/update/_ID_'}" />
{/form_field}
{form_field form=$form field='company'}
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
</div>
{/form_field}
{form_field form=$form field='title'}
{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>
<select name="{$name}" id="{$label_attr.for}" class="form-control">
{loop type="title" name="title1"}
<option value="{$ID}">{$LONG}</option>
{/loop}
</select>
</select>
</div>
{/form_field}
@@ -191,13 +195,13 @@
{form_field form=$form field='address1'}
<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}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
</div>
<div class="form-group">
{form_field form=$form field='address2'}
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
{/form_field}
{/form_field}
</div>
<div class="form-group">
@@ -237,8 +241,8 @@
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Email address'}">
</div>
{/form_field}
{/form_field}
{/capture}
{include

View File

@@ -12,7 +12,7 @@
<ul class="nav nav-pills">
{loop name="lang_list" type="lang" default_only={$default_only}}
<li {if $ID == $edit_language_id}class="active"{/if}>
<a href="{$current_url nofilter}&amp;edit_language_id={$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
<a href="{url path=$current_url edit_language_id=$ID}" title="{intl l="Edit information in %lng" lng=$TITLE}">
<img src="{image file="../assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" />
</a>
</li>

View File

@@ -3,7 +3,7 @@
{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>
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value|htmlspecialchars}">
<input type="text" id="{$label_attr.for}" name="{$name}" required="required" title="{intl l='Title'}" placeholder="{intl l='Title'}" class="form-control" value="{$value}">
</div>
{/form_field}
@@ -14,7 +14,7 @@
<span class="label-help-block">{intl l="A short description, used when a summary or an introduction is required"}</span>
</label>
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control">{$value|htmlspecialchars}</textarea>
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short description'}" placeholder="{intl l='Short description'}" class="form-control">{$value}</textarea>
</div>
{/form_field}
@@ -25,7 +25,7 @@
<span class="label-help-block">{intl l="The détailed description."}</span>
</label>
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value|htmlspecialchars}</textarea>
<textarea name="{$name}" id="{$label_attr.for}" rows="10" class="form-control">{$value}</textarea>
</div>
{/form_field}
@@ -36,6 +36,6 @@
<span class="label-help-block">{intl l="A short post-description information"}</span>
</label>
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="form-control">{$value|htmlspecialchars}</textarea>
<textarea name="{$name}" id="{$label_attr.for}" rows="3" title="{intl l='Short conclusion'}" placeholder="{intl l='Short conclusion'}" class="form-control">{$value}</textarea>
</div>
{/form_field}

View File

@@ -64,7 +64,7 @@
{block name="javascript-initialization"}
<script>
$(function () {
$(".feed-list").load("{admin_viewurl view='includes/thelia_news_feed'}");
$(".feed-list").load("{admin_viewurl view='ajax/thelia_news_feed'}");
})
</script>
{/block}

View File

@@ -17,7 +17,7 @@
{module_include location='orders_top'}
<div class="row">
<div class="col-md-12">
<div class="col-md-12">
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">
@@ -36,14 +36,14 @@
<th>{intl l="Name"}</th>
<th>{intl l="Amount"}</th>
<th>{intl l="Status"}</th>
{module_include location='orders_table_header'}
<th>{intl l="Actions"}</th>
<th class="actions">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
<tbody>
<tr>
<td><a href="">01230450123045</a></td>
@@ -116,7 +116,7 @@
</div>
</td>
</tr>
<!-- <tr>
<td colspan="3">
<div class="alert alert-info">
@@ -124,10 +124,10 @@
</div>
</td>
</tr> -->
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,115 @@
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Edit a template'}{/block}
{block name="check-permissions"}admin.configuration.templates.edit{/block}
{block name="main-content"}
<div class="templates edit-template">
<div id="wrapper" class="container">
{loop name="template_edit" type="template" id="$template_id" backend_context="1" lang="$edit_language_id"}
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
<li><a href="{url path='/admin/configuration/templates'}">{intl l="Templates"}</a></li>
<li>{intl l='Editing template "%name"' name="{$NAME}"}</li>
</ul>
<div class="row">
<div class="col-md-12 general-block-decorator">
<div class="row">
<div class="col-md-12 title title-without-tabs">
{intl l="Edit template $NAME"}
</div>
<div class="form-container">
<div class="col-md-12">
{form name="thelia.admin.template.modification"}
<form method="POST" action="{url path='/admin/configuration/templates/save'}" {form_enctype form=$form} class="clearfix">
{* Be sure to get the template ID, even if the form could not be validated *}
<input type="hidden" name="template_id" value="{$template_id}" />
{include file="includes/inner-form-toolbar.html" close_url="{url path='/admin/configuration/templates'}"}
{form_hidden_fields form=$form}
{form_field form=$form field='success_url'}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/templates'}" />
{/form_field}
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
{/form_field}
{if $form_error}<div class="alert alert-danger">{$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='Template name'}" placeholder="{intl l='Template name'}" class="form-control">
</div>
{/form_field}
</form>
{/form}
</div>
</div>
<div class="col-md-12">
<div class="form-container">
<div class="col-md-6">
<p class="title title-without-tabs">{intl l='Attributes'}</p>
<p>Manage attributes included in this product templates</p>
<div id="attribute_list_management">
<div class="loading"></div>
</div>
</div>
<div class="col-md-6">
<p class="title title-without-tabs">{intl l='Features'}</p>
<p>Manage features included in this product templates</p>
<div id="feature_list_management">
<div class="loading"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/loop}
{elseloop rel="template_edit"}
<div class="row">
<div class="col-md-12">
<div class="alert alert-error">
{intl l="Sorry, template ID=$template_id was not found."}
</div>
</div>
</div>
{/elseloop}
</div>
</div>
{/block}
{block name="javascript-initialization"}
<script>
$(function() {
$('#attribute_list_management').load("{admin_viewurl view='ajax/template-attribute-list' template_id=$template_id}");
$('#feature_list_management').load("{admin_viewurl view='ajax/template-feature-list' template_id=$template_id}");
});
</script>
{/block}

View File

@@ -0,0 +1,215 @@
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Thelia Product Templates'}{/block}
{block name="check-permissions"}admin.configuration.templates.view{/block}
{block name="main-content"}
<div class="templates">
<div id="wrapper" class="container">
<ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/configuration'}">{intl l="Configuration"}</a></li>
<li><a href="{url path='/admin/configuration/templates'}">{intl l="Product templates"}</a></li>
</ul>
{module_include location='templates_top'}
<div class="row">
<div class="col-md-12">
<form action="#" method="post">
<div class="general-block-decorator">
{if ! empty($general_error) }
<div class="alert alert-danger">{$general_error}</div>
{/if}
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l='Thelia product templates'}
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.configuration.templates.create"}
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product template'}" href="#creation_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
{/loop}
</caption>
<thead>
<tr>
<th>
{admin_sortable_header
current_order=$order
order='id'
reverse_order='id_reverse'
path='/admin/configuration/templates'
label="{intl l='ID'}"
}
</th>
<th>
{admin_sortable_header
current_order=$order
order='alpha'
reverse_order='alpha_reverse'
path='/admin/configuration/templates'
label="{intl l='Title'}"
}
</th>
{module_include location='templates_table_header'}
<th class="actions">{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop name="list" type="template" backend_context="1" lang=$lang_id order=$order}
<tr>
<td>{$ID}</td>
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.change"}
<a title="{intl l='Change this template'}" href="{url path='/admin/configuration/templates/update' template_id=$ID}">{$NAME}</a>
{/loop}
{elseloop rel="can_change"}
{$NAME}
{/elseloop}
</td>
{module_include location='templates_table_row'}
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.change"}
<a class="btn btn-default btn-xs template-change" title="{intl l='Change this product template'}" href="{url path='/admin/configuration/templates/update' template_id=$ID}"><span class="glyphicon glyphicon-edit"></span></a>
{/loop}
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.templates.delete"}
<a class="btn btn-default btn-xs template-delete" title="{intl l='Delete this product template'}" href="#delete_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
{/loop}
</div>
</td>
</tr>
{/loop}
{elseloop rel="list"}
<tr>
<td colspan="4">
<div class="alert alert-info">
{intl l="No product template has been created yet. Click the + button to create one."}
</div>
</td>
</tr>
{/elseloop}
</tbody>
</table>
</div>
</form>
</div>
</div>
{module_include location='templates_bottom'}
</div>
</div>
{* Adding a new template *}
{form name="thelia.admin.template.creation"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
{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 template ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/templates/update' template_id='_ID_'}" />
{/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>
{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='Template title'}" placeholder="{intl l='Title'}">
<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 template name in the default language ($TITLE)"}</div>
{* 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}
{module_include location='template_create_form'}
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "creation_dialog"
dialog_title = {intl l="Create a new product template"}
dialog_body = {$smarty.capture.creation_dialog nofilter}
dialog_ok_label = {intl l="Create this product template"}
form_action = {url path='/admin/configuration/templates/create'}
form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message
}
{/form}
{* Delete confirmation dialog *}
{capture "delete_dialog"}
<input type="hidden" name="template_id" id="template_delete_id" value="" />
{module_include location='template_delete_form'}
{/capture}
{include
file = "includes/generic-confirm-dialog.html"
dialog_id = "delete_dialog"
dialog_title = {intl l="Delete template"}
dialog_message = {intl l="Do you really want to delete this template ? It will be removed from all products."}
form_action = {url path='/admin/configuration/templates/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-editable/bootstrap-editable.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
// Set proper template ID in delete from
$('a.template-delete').click(function(ev) {
$('#template_delete_id').val($(this).data('id'));
});
// JS stuff for creation form
{include
file = "includes/generic-js-dialog.html"
dialog_id = "creation_dialog"
form_name = "thelia.admin.template.creation"
}
});
</script>
{/block}