Merge branch 'master' of github.com:thelia/thelia
This commit is contained in:
@@ -295,10 +295,6 @@
|
|||||||
|
|
||||||
{block name="javascript-initialization"}
|
{block name="javascript-initialization"}
|
||||||
|
|
||||||
{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'}
|
|
||||||
<script src='{$asset_url}'></script>
|
|
||||||
{/javascripts}
|
|
||||||
|
|
||||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||||
<script src="{$asset_url}"></script>
|
<script src="{$asset_url}"></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
@@ -307,146 +303,4 @@
|
|||||||
<script src='{$asset_url}'></script>
|
<script src='{$asset_url}'></script>
|
||||||
{/javascripts}
|
{/javascripts}
|
||||||
|
|
||||||
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(function() {
|
|
||||||
|
|
||||||
{if $taxUpdateError == true}
|
|
||||||
$('#tax_list_update_dialog').modal();
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
$('.js-collapse').each(function(k, v) {
|
|
||||||
var h = $(v).data('collapse-height');
|
|
||||||
if( $(v).height() > h ) {
|
|
||||||
$(v).css('overflow', 'hidden').css('height', h + 'px');
|
|
||||||
} else {
|
|
||||||
$('[data-collapse-block=' + $(v).attr('id') + ']').hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.js-collapse-btn').click(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var block = $(this).data('collapseBlock');
|
|
||||||
$('#' + block).css('overflow', 'initial').css('height', 'initial');
|
|
||||||
$(this).unbind().remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.js-uncheck-all').click(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var selectId = $(this).data('uncheckSelect');
|
|
||||||
$('#' + selectId).selectpicker('deselectAll');
|
|
||||||
});
|
|
||||||
|
|
||||||
{literal}
|
|
||||||
$('#country-selector').change(function(e) {
|
|
||||||
$('#country-selector-form').submit();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Cache jQuery Objects
|
|
||||||
var $group = $('#panel');
|
|
||||||
var $list = $('#panel-list');
|
|
||||||
|
|
||||||
// Build array of taxes rules
|
|
||||||
$('#apply-taxes-rules').click(function(){
|
|
||||||
var taxesRules = [],
|
|
||||||
index;
|
|
||||||
|
|
||||||
$('.drop-group', $group).each(function(i){
|
|
||||||
var $this = $(this);
|
|
||||||
index = i;
|
|
||||||
taxesRules[index] = [];
|
|
||||||
|
|
||||||
$('.drag', $this).each(function(j){
|
|
||||||
taxesRules[index][j] = [];
|
|
||||||
taxesRules[index][j] = $(this).data('id'); // retrieve with data
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tax_list').val(JSON.stringify(taxesRules));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Default options for draggable
|
|
||||||
var dragOptions = {
|
|
||||||
cursor: 'move',
|
|
||||||
containment: "document",
|
|
||||||
opacity: 0.5,
|
|
||||||
revert: "invalid", // when not dropped, the item will revert back to its initial position
|
|
||||||
zIndex: 10
|
|
||||||
};
|
|
||||||
|
|
||||||
// Default options for sortabble
|
|
||||||
var sortOptions = {
|
|
||||||
cursor: 'move',
|
|
||||||
cancel: '.drop-message',
|
|
||||||
update: function( event, ui ){
|
|
||||||
// Check if we have an empty group
|
|
||||||
var $zone = $('.add-to-group', $group);
|
|
||||||
if($zone.size() > 1 && $(this).find('> div').size() == 0){ // Remove empty group only if we have more than 1 group
|
|
||||||
$(this).slideUp(function(){ $(this).remove(); });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Default options for droppable
|
|
||||||
var dropOptions = {
|
|
||||||
accept: "#panel-list .draggable", // Controls which draggable elements are accepted
|
|
||||||
hoverClass: "over",
|
|
||||||
drop: function( event, ui ) {
|
|
||||||
var $drop = $(this);
|
|
||||||
|
|
||||||
if($(this).hasClass('create-group')){
|
|
||||||
// Check if we have already an empty group
|
|
||||||
var $empty_group = $group.find('.drop-group:not(:has(> div))');
|
|
||||||
if($empty_group.size() > 0){ // if yes (Use the first empty group)
|
|
||||||
$drop = $empty_group.filter(':first');
|
|
||||||
}else{ //if no (Create a new group)
|
|
||||||
$drop = $group.find('.drop-group:last-child').clone().appendTo($group.find('.panel-body'));
|
|
||||||
|
|
||||||
// Remove taxes
|
|
||||||
$drop.find('> div').remove();
|
|
||||||
|
|
||||||
// Make the new group droppable
|
|
||||||
$drop
|
|
||||||
.droppable(dropOptions)
|
|
||||||
.sortable(sortOptions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$("<div></div>").addClass('drag').attr('data-id', ui.draggable.data('id')).text( ui.draggable.text()).appendTo( $drop );
|
|
||||||
ui.draggable.remove();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Make the list of taxes draggable
|
|
||||||
$('.draggable', $list).draggable(dragOptions);
|
|
||||||
|
|
||||||
|
|
||||||
// let the drop-group be droppable & sortable, accepting the tax items
|
|
||||||
$('.droppable', $group)
|
|
||||||
.droppable(dropOptions)
|
|
||||||
.sortable(sortOptions);
|
|
||||||
|
|
||||||
$('.place .panel-body').sortable(sortOptions);
|
|
||||||
|
|
||||||
// let the gallery be droppable as well, accepting items from the trash
|
|
||||||
$('.remove-from-group', $list)
|
|
||||||
.droppable({
|
|
||||||
accept: "#panel .drag",
|
|
||||||
hoverClass: 'over',
|
|
||||||
drop: function( event, ui ) {
|
|
||||||
$("<div></div>").addClass('draggable').text( ui.draggable.text() ).attr('data-id', ui.draggable.data('id')).draggable(dragOptions).appendTo( $list.find('.panel-body') );
|
|
||||||
ui.draggable.remove();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
{/literal}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{/block}
|
{/block}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{extends file="admin-layout.tpl"}
|
{extends file="admin-layout.tpl"}
|
||||||
|
|
||||||
{block name="page-title"}{intl l='Taxes rules'}{/block}
|
{block name="page-title"}{intl l='Administration profiles'}{/block}
|
||||||
|
|
||||||
{block name="check-resource"}admin.configuration.profile{/block}
|
{block name="check-resource"}admin.configuration.profile{/block}
|
||||||
{block name="check-access"}view{/block}
|
{block name="check-access"}view{/block}
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-condensed table-left-aligned">
|
<table class="table table-striped table-condensed table-left-aligned">
|
||||||
<caption class="clearfix">
|
<caption class="clearfix">
|
||||||
{intl l="Taxes"}
|
{intl l="Administration profiles"}
|
||||||
{loop type="auth" name="can_create" role="ADMIN" resource="admin.profile" access="CREATE"}
|
{loop type="auth" name="can_create" role="ADMIN" resource="admin.profile" access="CREATE"}
|
||||||
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new profile'}" href="#profile_create_dialog" data-toggle="modal">
|
<a class="btn btn-default btn-primary pull-right" title="{intl l='Create a new profile'}" href="#profile_create_dialog" data-toggle="modal">
|
||||||
<span class="glyphicon glyphicon-plus"></span>
|
<span class="glyphicon glyphicon-plus"></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user