{* /** * Copyright (c) 2015, Kairat Bakytow * All rights reserved. * ATTENTION: This commercial software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ * and is licensed under Oxwall Store Commercial License. * Full text of this license can be found at http://www.oxwall.org/store/oscl */ *} {style}{literal} .action_btn { width: 16px; height: 16px; display: inline-block; } {/literal}{/style} {$menu}
{decorator name='button_list_item' langLabel='smileys+add_smile_label' class='smile_add_btn'}
{if $isSingle} {foreach $smileys as $smile} {foreachelse} {/foreach}
Order Smile Code Action
{$smile->code}
No items
{else}
{foreach $smileys as $id => $category} {/foreach}
{/if}
{decorator name='button_list_item' langLabel='smileys+add_smile_label' class='smile_add_btn'}
{script}{literal} var categoryId = 0; $(".smile_add_btn").on("click", function( event ) { OW.ajaxFloatBox('SMILEYS_CMP_Add', [categoryId], { title: OW.getLanguageText('smileys', 'add_smile_label'), width: 550 }); event.stopImmediatePropagation(); }); $(".ow_ic_edit", ".smileys-cont,.smileys-single").on("click", function() { var id = $(this).closest("tr").attr("data-id"); OW.ajaxFloatBox('SMILEYS_CMP_Edit', [id], { title: OW.getLanguageText('smileys', 'edit_smile_label'), width: 550 }); }); $(".ow_ic_delete", ".smileys-cont,.smileys-single").on("click", function() { if ( !confirm(OW.getLanguageText('smileys', 'are_you_sure')) ) { return; } $.ajax({ url: "{/literal}{url_for_route for="smileys.admin_delete"}{literal}", data: {id: $(this).closest("tr").attr("data-id")}, cache: false, type: 'POST', dataType: 'json', success: function( data ) { if ( data && data.error ) { OW.error(data.message); } else { window.location.reload(true); } } }); }); function reord( send ) { send = (send === undefined ? true : false); var table = $(".smileys-cont,.smileys-single"); $(".ow_ic_up_arrow,.ow_ic_down_arrow", table).show(); table.each(function() { $(".ow_ic_up_arrow", $(this).find("tr:eq(1)")).hide(); $(".ow_ic_down_arrow", $(this).find("tr:eq(-2)")).hide(); }); $("tr:odd", table).removeClass().addClass("ow_alt1"); $("tr:even", table).removeClass().addClass("ow_alt2"); if ( send ) { var data = {}; $("tr", table).each(function( index ) { var id = $(this).attr("data-id"); if ( id === undefined ) { return; } data[$(this).attr("data-id")] = index; }); $.ajax({ url: "{/literal}{url_for_route for="smileys.admin_reorder"}{literal}", data: data, cache: false, type: 'POST' }); } } reord(false); $(".ow_ic_up_arrow", "#smileys").on("click", function() { var tr = $(this).closest("tr"); tr.prev().before(tr); reord(); }); $(".ow_ic_down_arrow", "#smileys").on("click", function() { var tr = $(this).closest("tr"); tr.next().after(tr); reord(); }); $(".tab-category").on("click", function() { $(".category_menu li").removeClass("active"); $(this).closest("li").addClass("active"); $(".smileys-cont").hide(); $("#smile-category-" + $(this).attr("data-category")).show(); categoryId = $(this).attr("data-category"); }).eq(0).trigger("click"); $("#add-category").on("click", function() { OW.ajaxFloatBox('SMILEYS_CMP_AddCategory', [], { title: OW.getLanguageText('smileys', 'add_smile_category'), width: 550 }); event.stopImmediatePropagation(); }); $(".delete_category").on("click", function() { if ( !confirm(OW.getLanguageText('smileys', 'are_you_sure')) ) { return; } $.ajax({ url: '{/literal}{url_for_route for="smileys.admin_delete_category"}{literal}', data: {id: $(this).closest("tr").attr("data-id")}, cache: false, type: 'POST', dataType: 'json', success: function( data ) { if ( data && data.error ) { OW.error(data.message); } window.location.reload(true); } }); }); $(".smileys-cont input[name^='category-']").on("click", function() { $.ajax({ url: '{/literal}{url_for_route for="smileys.admin_set_category"}{literal}', data: {id: $(this).closest("tr").attr("data-id"), categoryId:this.value}, cache: false, type: 'POST', success: function() { window.location.reload(true); } }); }); {/literal}{/script}