Ignore:
Timestamp:
Jun 16, 2013, 1:09:12 AM (11 years ago)
Author:
mistic100
Message:

two columns display for shortcuts form, keep save of original smilies.txt file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmiliesSupport/template/smiliessupport_admin.tpl

    r23234 r23236  
    4444});
    4545
     46// reset defaults
     47jQuery(".reset").click(function() {
     48    var ok = confirm("{/literal}{'Are you sure?'|@translate}{literal}");
     49    if (!ok) return false;
     50   
     51    jQuery.ajax({
     52        url: 'admin.php',
     53        type: 'GET',
     54        dataType: 'json',
     55        data: {
     56            action: 'ss_reset',
     57            folder: jQuery("select[name='folder']").val(),
     58        },
     59        success: function(result) {
     60            data = result;
     61            edited = false;
     62            update();
     63        }
     64    });
     65   
     66    return false;
     67});
     68
    4669// display edit form before submit
    4770jQuery("#smiliesupport").submit(function() {
     
    5780        dataType: 'json',
    5881        data: {
    59             action: 'ss_preview',
     82            action: 'ss_list',
    6083            folder: jQuery("select[name='folder']").val(),
    6184        },
     
    7497    if (!edit) {
    7598        html+= '<tr>';
     99       
    76100        var cols = parseInt(jQuery("input[name='cols']").val());
    77101        var i=0;
     
    80104            var smiley = data.smilies[file];
    81105            html+= '<td><a href="#" title="'+ smiley.title +'"><img src="'+ data.path + smiley.file +'"/></a></td>';
    82             if ((parseInt(i)+1)%cols == 0) html+= '</tr><tr>';
     106            html+= (i+1)%cols==0 ? '</tr><tr>' : '';
    83107            i++;
    84108        }
    85109       
    86110        html+= '</tr>';
     111       
     112        jQuery(".reset").hide();
    87113    }
    88114    else {
    89115    {/literal}
    90116        html+= '<tr>'
    91             +'<th>{'Smiley'|@translate}</th>'
     117            +'<th></th>'
    92118            +'<th>{'Name'|@translate}</th>'
    93119            +'<th>{'Shortcuts'|@translate}</th>'
    94           +'</tr>';
     120            +'<th class="spacer"></th>'
     121            +'<th></th>'
     122            +'<th>{'Name'|@translate}</th>'
     123            +'<th>{'Shortcuts'|@translate}</th>'
     124          +'</tr>'
     125         
     126          +'<tr>';
    95127     {literal}
     128     
     129        var i=0;
    96130     
    97131        for (var file in data.smilies) {
    98132            var smiley = data.smilies[file];
    99             html+= '<tr data-file="'+ smiley.file +'">'
    100                 +'<td><img src="'+ data.path + smiley.file +'"/></td>'
    101                 +'<td>'+ smiley.title +'</td>'
    102                 +'<td>'
    103                   +'<select name="shortcuts['+ smiley.file +']" class="shortcuts">';
     133           
     134            html+=
     135              '<td><img src="'+ data.path + smiley.file +'"/></td>'
     136              +'<td>'+ smiley.title +'</td>'
     137              +'<td data-file="'+ smiley.file +'">'
     138                +'<select name="shortcuts['+ smiley.file +']" class="shortcuts">';
     139             
     140              for (var j in smiley.short) {
     141                  html+= '<option value="'+ smiley.short[j] +'" selected>'+ smiley.short[j] +'</option>';
     142              }
    104143               
    105                 for (var j in smiley.short) {
    106                     html+= '<option value="'+ smiley.short[j] +'" selected>'+ smiley.short[j] +'</option>';
    107                 }
    108                  
    109                 html+= '</select>'
    110                 +'</td>'
    111               +'</tr>';
    112         }
     144            html+=
     145                '</select>'
     146              +'</td>';
     147           
     148            html+= (i+1)%2==0 ? '</tr><tr>' : '<td></td>';
     149            i++;
     150        }
     151       
     152        html+= '</tr>';
     153       
     154        jQuery(".reset").show();
    113155    }
    114156   
     
    128170        onAdd: function(item) {
    129171            edited = true;
    130             var file = $(this).parents("tr").data("file");
     172            var file = $(this).parent("td").data("file");
    131173           
    132174            if (data.smilies[file].short == null) {
     
    139181        onDelete: function(item) {
    140182          edited = true;
    141           var file = $(this).parents("tr").data("file");
     183          var file = $(this).parent("td").data("file");
    142184         
    143185          for (var i in data.smilies[file].short) {
     
    191233  <a href="#" class="edit buttonLike">{'Edit shorcuts'|@translate}</a>
    192234  <table id="preview"></table>
     235  <a href="#" class="reset buttonLike" style="display:none;">{'Reset defaults'|@translate}</a>
    193236</fieldset>
    194237 
Note: See TracChangeset for help on using the changeset viewer.