{combine_script id='jquery.underscore' load='footer' path='themes/default/js/plugins/underscore.js'} {footer_script require='jquery.ui.sortable'} (function($){ $("#menuOrdering").submit(function() { $('.menuUl li').each(function(i) { $('.menuPos[name="position[' + $(this).data('id') + ']"]').val(i); }); }); $('.menuUl').on('click', 'a.deletePage', function() { var id = $(this).parents("li.menuLi").data('id'); $(this).parents("li.menuLi").remove(); $("select[name='add_page'] option[value='"+ id +"']").removeAttr("disabled"); }); function init_sortable() { $(".menuUl").sortable({ axis: "y", opacity: 0.8 }); } var template = _.template($('#lp_template').html()); $("select[name='add_page']").change(function() { if ($(this).val() != -1) { var $option = $(this).children("option:selected"); $("ul.menuUl").append(template({ id: $(this).val(), name: $option.html(), href: $option.data('href'), standalone: $option.data('standalone'), language: $option.data('language') })); $option.attr("disabled", "disabled"); $(this).val(-1); init_sortable(); } }); init_sortable(); {foreach from=$cat_pages item=page} $("ul.menuUl").append(template({ id: {$page.page_id}, name: '{$page.title}', href: '{$page.U_PAGE}', standalone: {$page.standalone}, language: '{$page.language}' })); {/foreach} }(jQuery)); {/footer_script} {html_style} #menuOrdering a:hover { border:none; } .menuPos { display:none; } .menuLi { cursor:move; } {/html_style}

{$CATEGORIES_NAV} › {'Edit album'|translate} {$TABSHEET_TITLE}