Merge branch 'master' into tax

This commit is contained in:
Etienne Roudeix
2013-10-11 11:13:41 +02:00
32 changed files with 932 additions and 131 deletions

View File

@@ -35,12 +35,12 @@
</caption>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Default</th>
<th>Shop</th>
<th>N° ISO</th>
<th>ISO Code</th>
<th>{intl l="ID"}</th>
<th>{intl l="Name"}</th>
<th>{intl l="Default"}</th>
<th>{intl l="Shop"}</th>
<th>{intl l="N° ISO"}</th>
<th>{intl l="ISO Code"}</th>
{module_include location='countries_table_header'}
@@ -54,8 +54,8 @@
<td>{$ID}</td>
<td>{$TITLE}</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 class="change-default" type="radio" name="" value="{$ID}" {if $IS_DEFAULT}selected="selected"{/if}/>
<div class="make-switch switch-small switch-radio change-default-toggle" 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 class="change-default-toggle" type="radio" name="by_default" value="{$ID}" {if $IS_DEFAULT}checked="checked"{/if}/>
</div>
</td>
<td>
@@ -71,7 +71,7 @@
<td class="actions">
<div class="btn-group">
{loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.countries.change"}
<a class="btn btn-default btn-xs country-change" title="{intl l='Change this country'}" href="{url path="/admin/configuration/countries/update/{$ID}"}">
<a class="btn btn-default btn-xs country-change" title="{intl l='Change this country'}" href="{url path="/admin/configuration/country/update/{$ID}"}">
<span class="glyphicon glyphicon-edit"></span>
</a>
{/loop}
@@ -121,7 +121,7 @@
{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/country/update' country_id='_ID_'}" />
<input type="hidden" name="{$name}" value="{url path='/admin/configuration/country/update/_ID_'}" />
{/form_field}
{form_field form=$form field='title'}
@@ -160,6 +160,12 @@
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Alpha code 3'}">
</div>
{/form_field}
{loop type="lang" name="default-lang" default_only="1"}
<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}
{module_include location='country_create_form'}
@@ -202,6 +208,23 @@
form_content = {$smarty.capture.delete_dialog nofilter}
}
<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 country. Please contact your administrator or try later"}</strong>
</div>
</div>
</div>
</div>
{/block}
{block name="javascript-initialization"}
@@ -210,10 +233,30 @@
<script src="{$asset_url}"></script>
<script>
// Toogle switch on input radio
$('.switch-radio').on('switch-change', function () {
$('.switch-radio').bootstrapSwitch('toggleRadioState');
$(document).ready(function(){
// Toogle switch on input radio
$('.switch-radio').on('switch-change', function () {
$('.switch-radio').bootstrapSwitch('toggleRadioState');
});
$('.country-delete').click(function(ev){
$('#country_delete_id').val($(this).data('id'));
});
$('.change-default-toggle').on('switch-change', function(e, data){
if(data.value) {
$.ajax({
url : "{url path='/admin/configuration/country/toggleDefault'}",
data : {
country_id: $(this).data('id')
}
}).fail(function(){
$('#toggle-default-failed').modal('show');
});
}
});
});
</script>
{/javascripts}

View File

@@ -92,13 +92,13 @@
{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='Country title'}">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$TITLE}" title="{intl l="{$label}"}" placeholder="{intl l='Country title'}">
</div>
{/form_field}
{form_field form=$form field='short-description'}
{form_field form=$form field='chapo'}
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
<textarea id="{$label_attr.for}" name="{$name}" class="form-control" title="{intl l="{$label}"}" placeholder="{intl l='Country short description'}"></textarea>
<textarea id="{$label_attr.for}" name="{$name}" class="form-control" title="{intl l=""}" placeholder="{intl l='Country short description'}"></textarea>
</div>
{/form_field}
{form_field form=$form field='description'}

View File

@@ -28,7 +28,7 @@ URL: http://www.thelia.net
{block name="meta"}{/block}
<!-- StyleSheet -->
{stylesheets file='assets/less/styles.less' filters='less,cssembed'}
{stylesheets file='assets/less/styles.less' filters='less,cssembed,cssrewrite'}
<link rel="stylesheet" href="{$asset_url}">
{/stylesheets}
{debugbar_rendercss}

View File

@@ -204,7 +204,14 @@
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
<option value="">-- {intl l="Select Country"} --</option>
{loop type="country" name="country.list"}
<option value="{$ID}" {if $value == $ID}selected{/if} >{$TITLE}</option>
<option value="{$ID}"
{if $value != ""}
{if $value == $ID}selected{/if}
{else}
{if $IS_DEFAULT}selected{/if}
{/if}
>{$TITLE}</option>
{/loop}
</select>
{if $error }