Merge branch 'master' of github.com:thelia/thelia

This commit is contained in:
Manuel Raynaud
2013-09-07 16:40:14 +02:00
45 changed files with 1600 additions and 1019 deletions

View File

@@ -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}
@@ -49,15 +49,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>
@@ -66,14 +66,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>
@@ -84,7 +84,7 @@
{module_include location='before_top_menu'}
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
@@ -93,7 +93,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">
@@ -166,6 +166,15 @@
{/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'}">
<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>
</form>
{/loop}
</div>
</div>
</nav>

View File

@@ -8,9 +8,7 @@
<div class="catalog">
<div id="wrapper" class="container">
<ul class="breadcrumb">
{include file="includes/category_breadcrumb.html"}
</ul>
{include file="includes/catalog-breadcrumb.html"}
{module_include location='catalog_top'}
@@ -20,7 +18,7 @@
<table class="table table-striped table-condensed" id="category_list">
<caption>
{* display parent category name, and get current cat ID *}
{loop name="category_title" type="category" visible="*" id="{$current_category_id}"}
{loop name="category_title" type="category" visible="*" id=$current_category_id}
{intl l="Categories in %cat" cat=$TITLE}
{$cat_id = $ID}
{/loop}
@@ -30,7 +28,7 @@
{module_include location='category_list_caption'}
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.category.create"}
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.categories.create"}
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new category'}" href="#add_category_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
@@ -40,6 +38,16 @@
{ifloop rel="category_list"}
<thead>
<tr>
<th class="object-title">
{admin_sortable_header
current_order=$category_order
order='id'
reverse_order='id_reverse'
path={url path='/admin/catalog' id_category=$current_category_id}
label="{intl l='ID'}"
}
</th>
<th class="object-image">&nbsp;</th>
<th class="object-title">
@@ -47,8 +55,8 @@
current_order=$category_order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/catalog/category' id="{$current_category_id}"}
label={intl l='Category title'}
path={url path='/admin/catalog' id_category=$current_category_id}
label="{intl l='Category title'}"
}
</th>
@@ -59,8 +67,8 @@
current_order=$category_order
order='visible'
reverse_order='visible_reverse'
path={url path='/admin/catalog/category' id="{$current_category_id}"}
label={intl l='Online'}
path={url path='/admin/catalog' id_category=$current_category_id}
label="{intl l='Online'}"
}
</th>
@@ -69,8 +77,8 @@
current_order=$category_order
order='manual'
reverse_order='manual_reverse'
path={url path='/admin/catalog/category' id="{$current_category_id}"}
label={intl l='Position'}
path={url path='/admin/catalog' id_category=$current_category_id}
label="{intl l='Position'}"
}
</th>
@@ -81,22 +89,24 @@
<tbody>
{loop name="category_list" type="category" visible="*" parent=$current_category_id order=$category_order backend_context="1" lang=$lang_id}
<tr>
<td>{$ID}</td>
<td>
i={$ID} {loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/catalog/category' id="$ID" action='browse'}" title="{intl l='Browse this category'}"><img class="img-thumbnail" src="#IMAGE_URL" alt="#TITLE" /></a>
{loop type="image" name="cat_image" source="category" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/catalog' category_id=$ID}" title="{intl l='Browse this category'}"><img class="img-thumbnail" src="#IMAGE_URL" alt="#TITLE" /></a>
{/loop}
</td>
<td class="object-title">
<a href="{url path='admin/catalog/category' id="$ID" action='browse'}" title="{intl l='Browse this category'}">
{$ID} p={$POSITION} {$TITLE}
<a href="{url path='admin/catalog' category_id=$ID}" title="{intl l='Browse this category'}">
{$TITLE}
</a>
</td>
{module_include location='category_list_row'}
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" data-id="{$ID}" class="categoryVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
</div>
@@ -111,24 +121,24 @@
<td>
{admin_position_block
permission="admin.category.edit"
path={url path='admin/catalog/category' category_id="{$ID}"}
permission="admin.categories.edit"
path={url path='admin/category/update-position' category_id=$ID}
url_parameter="category_id"
in_place_edit_class="categoryPositionChange"
position="$POSITION"
id="$ID"
position=$POSITION
id=$ID
}
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-xs" title="{intl l='Browse this category'}" href="{url path='admin/catalog/category' id="$ID" action='browse'}"><i class="glyphicon glyphicon-folder-open"></i></a>
<a class="btn btn-default btn-xs" title="{intl l='Browse this category'}" href="{url path='admin/category' category_id=$ID}"><i class="glyphicon glyphicon-folder-open"></i></a>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.category.edit"}
<a class="btn btn-default btn-xs" title="{intl l='Edit this category'}" href="{url path='admin/catalog/category' id="$ID" action='edit'}"><i class="glyphicon glyphicon-edit"></i></a>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.categories.edit"}
<a class="btn btn-default btn-xs" title="{intl l='Edit this category'}" href="{url path='/admin/categories/update' category_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
{/loop}
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.category.delete"}
{loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.categories.delete"}
<a class="btn btn-default btn-xs category-delete" title="{intl l='Delete this category and all its contents'}" href="#delete_category_dialog" data-id="{$ID}" data-toggle="modal"><i class="glyphicon glyphicon-trash"></i></a>
{/loop}
</div>
@@ -143,7 +153,7 @@
<tr>
<td class="message">
<div class="alert alert-info">
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.category.create"}
{loop type="auth" name="can_create" roles="ADMIN" permissions="admin.categories.create"}
{intl l="This category has no sub-categories. To create a new one, click the + button above."}
{/loop}
@@ -166,9 +176,10 @@
<table class="table table-striped table-condensed">
<caption>
{* display parent category name *}
{loop name="category_title" type="category" visible="*" id="{$current_category_id}"}
{loop name="category_title" type="category" visible="*" id=$current_category_id}
{intl l="Products in %cat" cat=$TITLE}
{/loop}
{elseloop rel="category_title"}
{intl l="Top level Products"}
{/elseloop}
@@ -183,15 +194,34 @@
{ifloop rel="product_list"}
<thead>
<tr>
<th class="object-title">
{admin_sortable_header
current_order=$product_order
order='id'
reverse_order='id_reverse'
path={url path='/admin/product' category_id=$current_category_id}
label="{intl l='ID'}"
}
<th>&nbsp;</th>
<th class="object-title">
{admin_sortable_header
current_order=$product_order
order='ref'
reverse_order='ref_reverse'
path={url path='/admin/product' category_id=$current_category_id}
label="{intl l='Reference'}"
}
</th>
<th class="object-title">
{admin_sortable_header
current_order=$product_order
order='alpha'
reverse_order='alpha_reverse'
path={url path='/admin/catalog/product' id="{$current_category_id}"}
label={intl l='Product title'}
path={url path='/admin/product' category_id=$current_category_id}
label="{intl l='Product title'}"
}
{module_include location='product_list_header'}
@@ -201,8 +231,8 @@
current_order=$product_order
order='visible'
reverse_order='visible_reverse'
path={url path='/admin/catalog/product' id="{$current_category_id}"}
label={intl l='Online'}
path={url path='/admin/product' category_id=$current_category_id}
label="{intl l='Online'}"
}
</th>
@@ -211,8 +241,8 @@
current_order=$product_order
order='manual'
reverse_order='manual_reverse'
path={url path='/admin/catalog/product' id="{$current_category_id}"}
label={intl l='Position'}
path={url path='/admin/product' category_id=$current_category_id}
label="{intl l='Position'}"
}
</th>
@@ -221,39 +251,58 @@
</thead>
<tbody>
{loop name="product_list" type="product" category="{$current_category_id}" order="manual"}
{loop name="product_list" type="product" category=$current_category_id order="manual"}
<tr>
<td>{$ID}</td>
<td>
{loop type="image" name="cat_image" source="product" source_id="$ID" limit="1" width="50" height="50" resize_mode="crop" backend_context="1"}
<a href="{url path='admin/catalog/product' id="$ID" action='edit'}" title="{intl l='Edit this product'}">
<a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">
<img src="#IMAGE_URL" alt="#TITLE" />
</a>
{/loop}
<td class="object-title"><a href="{url path='admin/catalog/product' id="$ID" action='edit'}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
<td class="object-title"><a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">{$REF}</a></td>
<td class="object-title"><a href="{url path='admin/product/edit' id=$ID}" title="{intl l='Edit this product'}">{$TITLE}</a></td>
{module_include location='product_list_row'}
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.products.edit"}
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" data-id="{$ID}" class="productVisibleToggle" {if $VISIBLE == 1}checked="checked"{/if}>
</div>
{/loop}
{elseloop rel="can_change"}
<div class="make-switch switch-small" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>" data-off-label="<i class='glyphicon glyphicon-remove'></i>">
<input type="checkbox" data-id="{$ID}" class="displayToggle" {if $VISIBLE == 1}checked="checked"{/if}>
</div>
{/elseloop}
</td>
<td>
{admin_position_block
permission="admin.product.edit"
path={url path='admin/catalog/product' category_id="{$ID}"}
path={url path='admin/product' category_id=$ID}
url_parameter="product_id"
in_place_edit_class="productPositionChange"
position="$POSITION"
id="$ID"
position=$POSITION
id=$ID
}
</td>
<td>
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='admin/catalog/product' id="$ID" action='edit'}"><i class="glyphicon glyphicon-edit"></i></a>
<a class="btn btn-default btn-xs product-delete" title="{intl l='Delete this product'}" href="{url path='admin/catalog/product' id="$ID" action='delete'}"><i class="glyphicon glyphicon-trash"></i></a>
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.edit"}
<a class="btn btn-default btn-xs" title="{intl l='Edit this product'}" href="{url path='admin/product/edit' product_id=$ID}"><i class="glyphicon glyphicon-edit"></i></a>
{/loop}
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.product.delete"}
<a class="btn btn-default btn-xs product-delete" title="{intl l='Delete this product'}" href="{url path='admin/product/delete' id=$ID}"><i class="glyphicon glyphicon-trash"></i></a>
{/loop}
</div>
</td>
</tr>
{/loop}
@@ -276,8 +325,82 @@
</div>
</div>
{include file="includes/add-category-dialog.html"}
{include file="includes/delete-category-dialog.html"}
{* Adding a new Category *}
{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}
{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}
{form_field form=$form field='parent'}
<input type="hidden" name="{$name}" value="{$current_category_id}" />
{/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>
{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="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}" />
{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 = "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 = {form_enctype form=$form}
form_error_message = $form_error_message
}
{/form}
{* Delete category confirmation dialog *}
{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}
{include
file = "includes/generic-confirm-dialog.html"
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"}
@@ -290,68 +413,100 @@
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(function() {
<script>
$(function() {
{* display the form creation dialog if it contains errors *}
// JS stuff for category creation form
{include
file = "includes/generic-js-dialog.html"
{form name="thelia.admin.category.creation"}
{if #form_error}
$('#add_category_dialog').modal();
{/if}
{/form}
dialog_id = "add_category_dialog"
form_name = "thelia.admin.category.creation"
}
{* Always reset create dialog on close *}
// JS stuff for product creation form
{include
file = "includes/generic-js-dialog.html"
$('#add_category_dialog').on('hidden',function() {
// Hide error message
$('#add_category_dialog_error').remove();
dialog_id = "add_product_dialog"
form_name = "thelia.admin.product.creation"
}
// Clear error status
$("#add_category_dialog .error").removeClass('error');
// Empty field values
$("#add_category_dialog input[type=text]").val('');
});
{* Set the proper ID in the delete confirmation dialog *}
{* Set the proper category ID in the delete confirmation dialog *}
$('a.category-delete').click(function(ev) {
$('#delete_category_id').val($(this).data('id'));
});
$(document).on("click", ".category-delete", function () {
$('#'+'delete-category-id').val($(this).data('id'));
});
$('a.product-delete').click(function(ev) {
$('#delete_product_id').val($(this).data('id'));
});
// Toggle category visibility
$(".categoryVisibleToggle").change(function() {
$.ajax({
url : "{url path='admin/catalog/category'}",
data : {
category_id : $(this).data('id'),
action : 'visibilityToggle'
}
});
});
{* Inline editing of object position using bootstrap-editable *}
{* Toggle object visibility *}
$('.categoryPositionChange').editable({
type : 'text',
title : '{intl l="Enter new category position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url path='admin/catalog/category' action='changePosition' category_id='__ID__' position='__POS__'}";
$(".categoryVisibleToggle").click(function() {
$.ajax({
url : "{url path='admin/categories/toggle-online'}",
data : {
category_id : $(this).data('id'),
action : 'visibilityToggle'
}
});
});
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id'))
.replace('__POS__', newValue);
$(".productVisibleToggle").click(function() {
$.ajax({
url : "{url path='admin/products/toggle-online'}",
data : {
category_id : $(this).data('id'),
action : 'visibilityToggle'
}
});
});
// Reload the page
location.href = url;
}
});
});
</script>
{* Inline editing of object position using bootstrap-editable *}
$('.categoryPositionChange').editable({
type : 'text',
title : '{intl l="Enter new category position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url path='/admin/categories/update-position' category_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id'))
.replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
$('.productPositionChange').editable({
type : 'text',
title : '{intl l="Enter new product position"}',
mode : 'popup',
inputclass : 'input-mini',
placement : 'left',
success : function(response, newValue) {
// The URL template
var url = "{url path='/admin/products/update-position' product_id='__ID__' position='__POS__'}";
// Perform subtitutions
url = url.replace('__ID__', $(this).data('id'))
.replace('__POS__', newValue);
// Reload the page
location.href = url;
}
});
})
</script>
{/block}

View File

@@ -7,9 +7,8 @@
{block name="main-content"}
<div class="catalog edit-category">
<div id="wrapper" class="container">
<ul class="breadcrumb">
{include file="includes/category_breadcrumb.html"}
</ul>
{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"}
@@ -27,6 +26,7 @@
</div>
<form method="post">
<div class="tabbable">
<ul class="nav nav-tabs admin-tabs" id="tabbed_menu">
<li class="active">

View File

@@ -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>
@@ -122,7 +122,7 @@
<td>
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.currencies.change"}
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id="$ID"}">{$NAME}</a>
<a title="{intl l='Change this currency'}" href="{url path='/admin/configuration/currencies/update' currency_id=$ID}">{$NAME}</a>
{/loop}
{elseloop rel="can_change"}
{$NAME}
@@ -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">&times;</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">&times;</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 *}

View File

@@ -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">&times;</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>

View 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>

View File

@@ -1,13 +0,0 @@
{* Breadcrumb for categories browsing and editing *}
<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' id=" $ID" action='edit' }" 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}

View File

@@ -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">&times;</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>

View 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">&times;</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>

View 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">&times;</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>

View File

@@ -0,0 +1,35 @@
{*
Javascript code to manage create dialog. Insert it in your template, in the javascript
initialisation:
$(function() {
<insert me here>
}
Parameters:
$dialog_id = the dialog ID
$form_name = the form name
*}
{* re-display the form creation dialog if it contains errors *}
{form name="{$form_name}"}
{if #form_error}
$('#{$dialog_id}').modal();
{/if}
{/form}
{* Always reset create dialog on close *}
$('#{$dialog_id}').on('hidden', function() {
// Hide error message
$('#{$dialog_id}_error').remove();
// Clear error status
$("#{$dialog_id} .error").removeClass('error');
// Empty field values
$("#{$dialog_id} input[type=text]").val('');
});

View File

@@ -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>&nbsp;</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">&times;</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">&times;</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}

View File

@@ -0,0 +1 @@
test

View File

@@ -0,0 +1,142 @@
{extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Thelia Product Attributes'}{/block}
{block name="check-permissions"}admin.configuration.product_attributes.view{/block}
{block name="main-content"}
<div class="attributes">
<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/product_attributes'}">{intl l="Product attributes"}</a></li>
</ul>
<div class="row">
<div class="col-md-12">
<form action="#" method="post">
<div class="general-block-decorator">
<table class="table table-striped table-condensed table-left-aligned">
<caption>
{intl l='Thelia product attributes'}
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new product attribute'}" href="#add_product_attribute_dialog" data-toggle="modal">
<span class="glyphicon glyphicon-plus-sign"></span>
</a>
</caption>
<thead>
<tr>
<th>{intl l="Title"}</th>
<th>{intl l="Position"}</th>
<th>{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
<tr>
<td>Title here</td>
<td>1</td>
<td class="actions">
<div class="btn-group">
<a class="btn btn-default btn-xs message-change" title="{intl l='Change this product attribute'}" href="{url path='/admin/configuration/product_attributes/update' product_attribute_id="$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
<a class="btn btn-default btn-xs message-delete" title="{intl l='Delete this mailing template'}" href="#delete_product_attribute_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
</div>
</td>
</tr>
<!-- <tr>
<td colspan="3">
<div class="alert alert-info">
{intl l="No product attribute has been created yet. Click the + button to create one."}
</div>
</td>
</tr> -->
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</div>
{* Adding a new message *}
<div class="modal fade" id="add_product_attribute_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">&times;</button>
<h3>{intl l="Create a new product attribute"}</h3>
</div>
<form method="POST" action="">
<div class="modal-body">
<div class="alert alert-danger" id="add_procut_attribute_dialog_error">Error message</div>
<div class="form-group has-error">
<label for="{$label_attr.for}" class="control-label">{intl l="Title"} : </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>
<div class="checkbox">
<label>
<input type="checkbox">
Add this attribute to all sections
</label>
</div>
</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 product attribute"}</button>
</div>
</form>
</div>
</div>
</div>
{* Delete confirmation dialog *}
<div class="modal fade" id="delete_product_attribute_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">&times;</button>
<h3>{intl l="Delete a product attribute"}</h3>
</div>
<div class="modal-body">
<p>{intl l="Do you really want to delete this product attribute ?"}</p>
</div>
<form method="post" action="">
<!-- <input type="hidden" name="message_id" id="message_delete_id" value="" /> -->
<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>
</div>
</div>
</div>
{/block}

View File

@@ -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,148 +135,116 @@
{* Adding a new variable *}
<div class="modal fade" id="add_variable_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">&times;</button>
<h3>{intl l="Create a new variable"}</h3>
</div>
{form name="thelia.admin.config.creation"}
{form name="thelia.admin.config.creation"}
<form method="POST" action="{url path='/admin/configuration/variables/create'}" {form_enctype form=$form}>
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
{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 variable ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/update' variable_id='_ID_'}" />
{/form_field}
{form_field form=$form field='success_url'}
{* on success, redirect to the edition page, _ID_ is replaced with the created variable ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/variables/update' variable_id='_ID_'}" />
{/form_field}
{* We do not allow users to create hidden or secured variables from here *}
{* We do not allow users to create hidden or secured variables from here *}
{form_field form=$form field='hidden'}
<input type="hidden" name="{$name}" value="0" />
{/form_field}
{form_field form=$form field='hidden'}
<input type="hidden" name="{$name}" value="0" />
{/form_field}
{form_field form=$form field='secured'}
<input type="hidden" name="{$name}" value="0" />
{/form_field}
{form_field form=$form field='secured'}
<input type="hidden" name="{$name}" value="0" />
{/form_field}
<div class="modal-body">
{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='Variable name'}" placeholder="{intl l='Variable name'}" class="form-control">
</div>
{/form_field}
{if #form_error}<div class="alert alert-error" id="add_variable_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='Variable name'}" placeholder="{intl l='Variable name'}" class="form-control">
</div>
{/form_field}
{form_field form=$form field='value'}
<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}" value="{$value}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" 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>
{form_field form=$form field='value'}
<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}" value="{$value}" title="{intl l='Variable value'}" placeholder="{intl l='Variable value'}" class="form-control">
</div>
{/form_field}
{loop type="lang" name="default-lang" default_only="1"}
{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>
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
{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='Variable purpose'}" placeholder="{intl l='Variable purpose'}" class="form-control">
<span class="input-group-addon"><img src="{image file="assets/img/flags/{$CODE}.gif"}" alt="{intl l=$TITLE}" /></span>
</div>
{* Switch edition to the current locale *}
<input type="hidden" name="edit_language_id" value="{$ID}" />
<div class="help-block">{intl l="Enter here the variable purpose in the default language ($TITLE)"}</div>
<div class="input-group">
<input type="text" id="{$label_attr.for}" required="required" name="{$name}" value="{$value}" title="{intl l='Variable purpose'}" placeholder="{intl l='Variable purpose'}" class="form-control">
<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='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
{/loop}
</div>
{/form_field}
<div class="help-block">{intl l='Enter here the category name in the default language (%title)' title="$TITLE"}</div>
</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 variable"}</button>
</div>
{form_field form=$form field='locale'}
<input type="hidden" name="{$name}" value="{$LOCALE}" />
{/form_field}
{/loop}
</div>
{/form_field}
{/capture}
</form>
{/form}
</div>
</div>
</div>
{include
file = "includes/generic-create-dialog.html"
dialog_id = "creation_dialog"
dialog_title = {intl l="Create a new variable"}
dialog_body = {$smarty.capture.creation_dialog nofilter}
{* Delete confirmation dialog *}
dialog_ok_label = {intl l="Create this variable"}
<div class="modal fade" id="delete_variable_dialog" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
form_action = {url path='/admin/configuration/variables/create'}
form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message
}
{/form}
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Delete a variable"}</h3>
</div>
{* Delete category confirmation dialog *}
<div class="modal-body">
<p>{intl l="Do you really want to delete this variable ?"}</p>
</div>
{capture "delete_dialog"}
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
{/capture}
<form method="post" action="{url path='/admin/configuration/variables/delete'}">
<input type="hidden" name="variable_id" id="variable_delete_id" value="" />
{include
file = "includes/generic-confirm-dialog.html"
<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>
</div>
</div>
</div>
dialog_id = "delete_variable_dialog"
dialog_title = {intl l="Delete a variable"}
dialog_message = {intl l="Do you really want to delete this variable ?"}
form_action = {url path='/admin/configuration/variables/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
}
{/block}
{block name="javascript-initialization"}
<script>
$(function() {
// JS stuff for creation form
{include
file = "includes/generic-js-dialog.html"
dialog_id = "creation_dialog"
form_name = "thelia.admin.config.creation"
}
// Set proper variable ID in delete from
$('a.config-delete').click(function(ev) {
$('#variable_delete_id').val($(this).data('id'));
});
{* display the form creation dialog if it contains errors *}
{form name="thelia.admin.config.creation"}
{if #form_error}
$('#add_variable_dialog').modal();
{/if}
{/form}
{* Always reset create dialog on close *}
$('#add_variable_dialog').on('hidden',function() {
// Hide error message
$('#add_variable_dialog_error').remove();
// Clear error status
$("#add_variable_dialog .error").removeClass('error');
// Empty field values
$("#add_variable_dialog input[type=text]").val('');
});
// Edition canceling management
$('.cancel-edit').each(function() {
var zis = $(this);