File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
bolt-staff/bolt/admin/assets/admin Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ jQuery(function ($) {
3
3
var $actionPks = $ ( '[name="action_pks"]' ) ;
4
4
var $actionSelect = $ ( '[name="action_name"]' ) ;
5
5
var $actionSubmit = $ ( '[data-actions-form] [type="submit"]' ) ;
6
+ var $lastActionCheckboxChecked = null ;
6
7
7
8
$actionCheckbox . on ( "change" , function ( ) {
8
9
var pks = [ ] ;
@@ -29,5 +30,18 @@ jQuery(function ($) {
29
30
}
30
31
}
31
32
32
- // TODO Enable shift-clicking to select a range of checkboxes
33
+ // Enable shift-clicking to select a range of checkboxes
34
+ $actionCheckbox . on ( "click" , function ( e ) {
35
+ if ( e . shiftKey ) {
36
+ var $this = $ ( this ) ;
37
+ var thisIndex = $actionCheckbox . index ( $this ) ;
38
+ var lastIndex = $actionCheckbox . index ( $lastActionCheckboxChecked ) ;
39
+ var minIndex = Math . min ( thisIndex , lastIndex ) ;
40
+ var maxIndex = Math . max ( thisIndex , lastIndex ) ;
41
+ var $checkboxes = $actionCheckbox . slice ( minIndex , maxIndex + 1 ) ;
42
+ $checkboxes . prop ( "checked" , $this . is ( ":checked" ) ) ;
43
+ } else {
44
+ $lastActionCheckboxChecked = $ ( this ) ;
45
+ }
46
+ } ) ;
33
47
} ) ;
You can’t perform that action at this time.
0 commit comments