Changeset 29255


Ignore:
Timestamp:
Aug 23, 2014, 1:47:32 PM (10 years ago)
Author:
mistic100
Message:

Ctrl+E opens the quick edit popup

Location:
trunk/plugins/AdminTools/template
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/AdminTools/template/admin_style.css

    r29168 r29255  
    88.multiview {
    99  display:none;
     10  z-index:1000;
    1011}
    1112
  • trunk/plugins/AdminTools/template/public_controller.js

    r26603 r29255  
    242242    // try to find background color matching text color
    243243    // there is a 1s delay to wait for jQuery Mobile initialization
    244     setTimeout(function() {
     244    function bgColor() {
    245245      var bg_color = 'white';
    246246      var selectors = ['#the_page #content', '[data-role="page"]', 'body'];
     
    255255
    256256      $ato_edit.css('background-color', bg_color);
    257     }, 1000);
     257    }
    258258
    259259    $ato_edit.find('.close-edit').on('click', function(e) {
     
    261261      e.preventDefault();
    262262    });
    263 
    264     if (is_picture) {
    265       $ato_edit.find('.datepicker').datepicker({
    266         dateFormat: 'yy-mm-dd'
    267       });
    268     }
    269263
    270264    $(".edit-quick").colorbox({
     
    276270      title: $ato_edit.attr('title'),
    277271
     272      onComplete: function() {
     273        setTimeout(function() {
     274          $('#quick_edit_name').focus();
     275        }, 0);
     276      },
     277
    278278      onOpen: function() {
    279         if (!is_picture) return;
    280 
    281         // fetch tags list on first open
    282         if ($(this).data('tags-init')) return;
    283 
    284         $.ajax({
    285           method: 'POST',
    286           url: __this.urlWS + 'pwg.tags.getList',
    287           dataType: 'json',
    288           success: function(data) {
    289             var tags = [];
    290             // convert to custom format
    291             for (var i=0, l=data.result.tags.length; i<l; i++) {
    292               tags.push({
    293                 id: '~~'+ data.result.tags[i].id +'~~',
    294                 name: data.result.tags[i].name
    295               });
     279        bgColor();
     280
     281        if (is_picture) {
     282          $ato_edit.find('.datepicker').datepicker({
     283            dateFormat: 'yy-mm-dd'
     284          });
     285
     286          // fetch tags list on first open
     287          if ($(this).data('tags-init')) return;
     288
     289          $.ajax({
     290            method: 'POST',
     291            url: __this.urlWS + 'pwg.tags.getList',
     292            dataType: 'json',
     293            success: function(data) {
     294              var tags = [];
     295              // convert to custom format
     296              for (var i=0, l=data.result.tags.length; i<l; i++) {
     297                tags.push({
     298                  id: '~~'+ data.result.tags[i].id +'~~',
     299                  name: data.result.tags[i].name
     300                });
     301              }
     302
     303              $ato_edit.find('.tags').tokenInput(
     304                tags,
     305                $.extend({
     306                  animateDropdown: false,
     307                  preventDuplicates: true,
     308                  allowFreeTagging: true
     309                }, tokeninput_lang)
     310              );
     311
     312              $.colorbox.resize();
     313              $(this).data('tags-init', true);
     314            },
     315            error: function(xhr, text, error) {
     316              alert(text + ' ' + error);
    296317            }
    297 
    298             $ato_edit.find('.tags').tokenInput(
    299               tags,
    300               $.extend({
    301                 animateDropdown: false,
    302                 preventDuplicates: true,
    303                 allowFreeTagging: true
    304               }, tokeninput_lang)
    305             );
    306 
    307             $.colorbox.resize();
    308             $(this).data('tags-init', true);
    309           },
    310           error: function(xhr, text, error) {
    311             alert(text + ' ' + error);
    312           }
    313         });
    314       }
     318          });
     319        }
     320      }
     321    });
     322
     323    // Ctrl+E opens the quick edit
     324    Mousetrap.bind('mod+e', function(e) {
     325      e.preventDefault();
     326      $(".edit-quick").click();
    315327    });
    316328  };
  • trunk/plugins/AdminTools/template/public_controller.tpl

    r29168 r29255  
    55
    66{if isset($ato.QUICK_EDIT)}
     7  {*<!-- mousetrap -->*}
     8  {combine_script id='mousetrap' load='footer' path=$ADMINTOOLS_PATH|cat:'template/mousetrap.min.js'}
     9 
    710  {*<!-- colorbox -->*}
    811  {combine_script id='jquery.colorbox' load='footer' require='jquery' path='themes/default/js/plugins/jquery.colorbox.min.js'}
Note: See TracChangeset for help on using the changeset viewer.