Changeset 13065 for trunk/admin/themes


Ignore:
Timestamp:
Feb 9, 2012, 11:34:45 AM (12 years ago)
Author:
plg
Message:

feature 2460 added: ability to Shift-click in the Batch Manager, to select
several photos easily. Patch from Dsls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/batch_manager_global.tpl

    r13064 r13065  
    66{footer_script}{literal}
    77  pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set");
     8{/literal}{/footer_script}
     9
     10{footer_script}{literal}
     11/* Shift-click: select all photos between the click and the shift+click */
     12jQuery(document).ready(function() {
     13  var last_clicked=0;
     14  var last_clickedstatus=true;
     15  jQuery.fn.enableShiftClick = function() {
     16    var inputs = [];
     17    var count=0;
     18    var This=$(this);
     19    this.find('input[type=checkbox]').each(function() {
     20      var pos=count;
     21      inputs[count++]=this;
     22      $(this).bind("shclick", function (dummy,event) {
     23        if (event.shiftKey) {
     24          var first = last_clicked;
     25          var last = pos;
     26          if (first > last) {
     27            first=pos;
     28            last=last_clicked;
     29          }
     30
     31          for (var i=first; i<=last;i++) {
     32            input = $(inputs[i]);
     33            $(input).attr('checked', last_clickedstatus);
     34            if (last_clickedstatus)
     35            {
     36              $(input).siblings("span.wrap2").addClass("thumbSelected");
     37            }
     38            else
     39            {
     40              $(input).siblings("span.wrap2").removeClass("thumbSelected");
     41            }
     42          }
     43        }
     44        else {
     45          last_clicked = pos;
     46          last_clickedstatus = this.checked;
     47        }
     48        return true;
     49      });
     50      $(this).click(function(event) {console.log(event.shiftKey);$(this).triggerHandler("shclick",event)});
     51    });
     52  }
     53});
    854{/literal}{/footer_script}
    955
     
    210256  });
    211257
    212   $(".wrap1 label").click(function () {
     258  $(".wrap1 label").click(function (event) {
    213259    $("input[name=setSelected]").attr('checked', false);
    214260
    215261    var wrap2 = $(this).children(".wrap2");
    216262    var checkbox = $(this).children("input[type=checkbox]");
     263
     264    checkbox.triggerHandler("shclick",event);
    217265
    218266    if ($(checkbox).is(':checked')) {
     
    454502
    455503jQuery(window).load(function() {
    456         var max_dim = 0;
    457         $(".thumbnails img").each(function () {
    458                 max_dim = Math.max(max_dim, $(this).height(), $(this).width() );
    459         });
    460         max_dim += 20;
    461         $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px');
     504  var max_dim = 0;
     505  $(".thumbnails img").each(function () {
     506    max_dim = Math.max(max_dim, $(this).height(), $(this).width() );
     507  });
     508  max_dim += 20;
     509  $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px');
     510  $('ul.thumbnails').enableShiftClick();
    462511});
    463512{/literal}{/footer_script}
Note: See TracChangeset for help on using the changeset viewer.