Merge branch 'master' into tax

This commit is contained in:
Etienne Roudeix
2013-10-23 16:32:10 +02:00
25 changed files with 1469 additions and 128 deletions

View File

@@ -250,6 +250,17 @@
{block name="javascript-initialization"}{/block}
<script>
(function($) {
$(document).ready(function(){
var testModal = $(".modal-force-show");
if(testModal.length > 0) {
testModal.modal("show");
}
});
})(jQuery);
</script>
{* Modules scripts are included now *}
{module_include location='footer_js'}

View File

@@ -0,0 +1,64 @@
{* Update an Address *}
{form name="thelia.lang.update"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "edit_lang_dialog"}
{form_hidden_fields form=$form}
{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}" class="form-control" value="{$value}" title="{intl l={$label} }" placeholder="{intl l='Label'}">
</div>
{/form_field}
{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}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Company'}">
</div>
{/form_field}
{form_field form=$form field='locale'}
<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='date_format'}
<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='time_format'}
<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}
{/capture}
{include
file = "includes/generic-create-dialog.html"
dialog_id = "edit_lang_dialog"
dialog_title = {intl l="Edit a language"}
dialog_body = {$smarty.capture.edit_lang_dialog nofilter}
dialog_ok_label = {intl l="Edit this language"}
dialog_cancel_label = {intl l="Cancel"}
form_action = {url path="/admin/configuration/languages/save/{$lang_id}"}
form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message
}
{/form}

View File

@@ -15,7 +15,7 @@ A generic modal creation dialog template. Parameters
ok_button_id (optionnal) = the id of the OK button
*}
<div class="modal fade" id="{$dialog_id}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade {if ! empty($form_error_message)}modal-force-show{/if}" id="{$dialog_id}" tabindex="-1" {if empty($form_error_message)}aria-hidden="true"{else}aria-hidden="false"{/if}>
<div class="modal-dialog">
<div class="modal-content">

View File

@@ -19,7 +19,7 @@
{module_include location='languages_top'}
<div class="row">
<div class="col-md-6">
<div class="col-md-12">
<div class="general-block-decorator">
<form action="" method="">
@@ -38,61 +38,43 @@
<tr>
<th>{intl l="Language name"}</th>
<th>{intl l="ISO 639 Code"}</th>
<th>{intl l="Locale"}</th>
<th>{intl l="date form"}</th>
<th>{intl l="time form"}</th>
<th>{intl l="Default"}</th>
<th>{intl l="Actions"}</th>
</tr>
</thead>
<tbody>
{loop type="lang" name="lang.list" backend_context="1"}
<tr>
<td><input type="text" class="form-control" name="" value="France"></td>
<td><input type="text" class="form-control" name="" value="fr"></td>
<td>{$TITLE}</td>
<td>{$CODE}</td>
<td>{$LOCALE}</td>
<td>{$DATE_FORMAT}</td>
<td>{$TIME_FORMAT}</td>
<td>
<div class="make-switch switch-small switch-radio" 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="radio" name="" checked>
<div class="make-switch switch-small switch-radio lang-default-change" data-id="{$ID}" 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="radio" name="is_default" {if $IS_DEFAULT}checked{/if}>
</div>
</td>
<td>
<td class="actions">
<div class="btn-group">
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
</div>
</td>
</tr>
<tr>
<td><input type="text" class="form-control" name="" value="English"></td>
<td><input type="text" class="form-control" name="" value="en"></td>
<td>
<div class="make-switch switch-small switch-radio" 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="radio" name="">
</div>
</td>
<td>
<div class="btn-group">
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
</div>
</td>
</tr>
<tr>
<td><input type="text" class="form-control" name="" value="Spanish"></td>
<td><input type="text" class="form-control" name="" value="es"></td>
<td>
<div class="make-switch switch-small switch-radio" 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="radio" name="">
</div>
</td>
<td>
<div class="btn-group">
<a href="#delete_dialog" data-toggle="modal" class="btn btn-default btn-xs" title="{intl l="Delete this language"}"><span class="glyphicon glyphicon-trash"></span></a>
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.language" access="UPDATE"}
<a class="btn btn-default btn-xs lang-change" data-id="{$ID}" title="{intl l='Change this language'}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{/loop}
{loop type="auth" name="can_change" role="ADMIN" resource="admin.configuration.language" access="DELETE"}
<a href="#delete_dialog" data-toggle="modal" data-id="{$ID}" class="btn btn-default btn-xs lang-delete" title="{intl l="Delete this language"}">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}
</div>
</td>
</tr>
{/loop}
</tbody>
<tfoot>
<tr>
<td colspan="4">
<button type="submit" class="btn btn-default btn-primary pull-right"><span class="glyphicon glyphicon-check"></span> {intl l="Save"}</button>
</td>
</tr>
</tfoot>
</table>
</form>
@@ -100,48 +82,50 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="general-block-decorator">
<div class="title title-without-tabs">{intl l="Parameters"}</div>
<form action="" method="post">
<div class="form-group">
<label for="" class="label-control">{intl l="If a translation is missing or incomplete :"}</label>
<div class="title title-without-tabs">{intl l="Parameters"}</div>
{form name="thelia.lang.defaultBehavior"}
<form action="{url path="/admin/configuration/languages/defaultBehavior"}" method="post">
{form_hidden_fields form=$form}
{form_field form=$form field="behavior"}
<div class="form-group {if $error}has-error{/if}" >
<label for="{$label_attr.for}" class="label-control">{intl l="If a translation is missing or incomplete :"}</label>
<div class="input-group">
<select name="" id="" data-toggle="selectpicker">
<option value="">Replace by the default language</option>
<option value="">Strictly use the requested language</option>
<select name="{$name}" id="{$label_attr.for}" data-toggle="selectpicker">
{foreach $choices as $choice}
<option value="{$choice->value}" {if $lang_without_translation == $choice->value}selected="selected"{/if}>{$choice->label}</option>
{/foreach}
</select>
<div class="input-group-btn">
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span></button>
</div>
</div>
</div>
{/form_field}
</form>
{/form}
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<div class="general-block-decorator clearfix">
<div class="title title-without-tabs">{intl l="Association language/URL"}</div>
<form action="" method="post">
<div class="col-md-6">
<div class="form-group">
<label for="" class="label-control"><input type="radio" name="" checked> {intl l="Using a same domain for all languages"}</label>
<input type="url" class="form-control" name="" placeholder="http://www.domain.com">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="" class="label-control"><input type="radio" name=""> {intl l="Using a domain or subdomain for each language"}</label>
</div>
@@ -169,7 +153,6 @@
</tr>
</tfoot>
</table>
</div>
</form>
</div>
@@ -181,34 +164,43 @@
</div>
</div>
{form name="thelia.admin.language.creation"}
{form name="thelia.lang.create"}
{* Capture the dialog body, to pass it to the generic dialog *}
{capture "creation_dialog"}
{form_hidden_fields form=$form}
{* Be sure to get the language_id, even if the form could not be validated *}
<input type="hidden" name="language_id" value="{$language_id}" />
{form_field form=$form field='success_url'}
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/languages/update' language_id='_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">{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='Language title'}">
</div>
{/form_field}
{form_field form=$form field='isocode'}
{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}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='ISO Code'}">
</div>
{/form_field}
{form_field form=$form field='locale'}
<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='en_US'}">
</div>
{/form_field}
{form_field form=$form field='date_format'}
<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='d-m-Y'}">
</div>
{/form_field}
{form_field form=$form field='time_format'}
<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='H:i:s'}">
</div>
{/form_field}
{module_include location='language_create_form'}
@@ -223,7 +215,7 @@
dialog_ok_label = {intl l="Create this language"}
form_action = {url path='/admin/configuration/languages/create'}
form_action = {url path='/admin/configuration/languages/add'}
form_enctype = {form_enctype form=$form}
form_error_message = $form_error_message
}
@@ -232,7 +224,7 @@
{* Delete confirmation dialog *}
{capture "delete_dialog"}
<input type="hidden" name="message_id" id="language_delete_id" value="" />
<input type="hidden" name="language_id" id="language_delete_id" value="" />
{module_include location='languages_delete_form'}
@@ -247,20 +239,32 @@
form_action = {url path='/admin/configuration/languages/delete'}
form_content = {$smarty.capture.delete_dialog nofilter}
form_error_message = $error_delete_message
}
<div id="lang-update-modal"></div>
<div class="modal fade" id="toggle-default-failed" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content alert alert-block alert-danger ">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h2>{intl l="Error"}</h2>
</div>
<div class="modal-body">
<strong>{intl l="Impossible to change default languages. Please contact your administrator or try later"}</strong>
</div>
</div>
</div>
</div>
{/block}
{block name="javascript-initialization"}
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
<script src="{$asset_url}"></script>
<script>
// Toogle switch on input radio
$('.switch-radio').on('switch-change', function () {
$('.switch-radio').bootstrapSwitch('toggleRadioState');
});
</script>
{/javascripts}
{javascripts file='assets/js/main.js'}
@@ -270,4 +274,39 @@
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
<script src="{$asset_url}"></script>
{/javascripts}
<script>
$(document).ready(function(){
$("a.lang-change").click(function(e){
var baseUrl = "{url path="/admin/configuration/languages/update/"}";
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
$.ajax({
method: 'get',
url: baseUrl+$(this).data('id')
}).done(function(data){
$("#loading-event").remove();
$("#lang-update-modal").html(data);
$("#edit_lang_dialog").modal("show");
}).fail(function(){
$("#loading-event").remove();
});
});
$(".lang-default-change").on("switch-change", function(e, data){
$('.lang-default-change').bootstrapSwitch('toggleRadioState');
var baseUrl = "{url path='/admin/configuration/languages/toggleDefault/'}";
if(data.value) {
$.ajax({
url : baseUrl+$(this).data('id')
}).fail(function(){
$('#toggle-default-failed').modal('show');
});
}
});
$(".lang-delete").click(function(){
$("#language_delete_id").val($(this).data("id"));
});
});
</script>
{/block}