1
1
"use strict" ;
2
2
3
- // make list view sortable
4
- jQuery ( function ( $ ) {
3
+ django . jQuery ( function ( $ ) {
4
+ // make list view sortable
5
5
var startindex , startorder , endindex , endorder ;
6
6
var csrfvalue = $ ( 'form' ) . find ( 'input[name="csrfmiddlewaretoken"]' ) . val ( ) ;
7
- var getQueryParams = function ( ) {
7
+ var getQueryParams = function ( ) {
8
8
var vars = [ ] , hash , i ;
9
9
var hashes = window . location . href . slice ( window . location . href . indexOf ( '?' ) + 1 ) . split ( '&' ) ;
10
10
for ( i = 0 ; i < hashes . length ; i ++ ) {
@@ -35,19 +35,19 @@ jQuery(function($) {
35
35
cursor : 'ns-resize' ,
36
36
containment : $ ( '#result_list tbody' ) ,
37
37
tolerance : 'pointer' ,
38
- start : function ( event , dragged_rows ) {
39
- $ ( this ) . find ( 'thead tr th' ) . each ( function ( index ) {
38
+ start : function ( event , dragged_rows ) {
39
+ $ ( this ) . find ( 'thead tr th' ) . each ( function ( index ) {
40
40
$ ( dragged_rows . item . context . childNodes [ index ] ) . width ( $ ( this ) . width ( ) - 10 ) ;
41
41
} ) ;
42
42
startindex = dragged_rows . item . index ( ) ;
43
43
} ,
44
- stop : function ( event , dragged_rows ) {
45
- $ ( this ) . find ( 'thead tr th' ) . each ( function ( index ) {
44
+ stop : function ( event , dragged_rows ) {
45
+ $ ( this ) . find ( 'thead tr th' ) . each ( function ( index ) {
46
46
$ ( dragged_rows . item . context . childNodes [ index ] ) . width ( 'auto' ) ;
47
47
} ) ;
48
-
48
+
49
49
var $result_list = $ ( this ) ;
50
- $result_list . find ( 'tbody tr' ) . each ( function ( index ) {
50
+ $result_list . find ( 'tbody tr' ) . each ( function ( index ) {
51
51
$ ( this ) . removeClass ( 'row1 row2' ) . addClass ( index % 2 ? 'row2' : 'row1' ) ;
52
52
} ) ;
53
53
endindex = dragged_rows . item . index ( ) ;
@@ -72,24 +72,24 @@ jQuery(function($) {
72
72
endorder : endorder ,
73
73
csrfmiddlewaretoken : csrfvalue
74
74
} ,
75
- success : function ( moved_items ) {
76
- $ . each ( moved_items , function ( index , item ) {
77
- $result_list . find ( 'tbody tr .js-reorder-' + item . pk ) . parents ( 'tr' ) . each ( function ( ) {
75
+ success : function ( moved_items ) {
76
+ $ . each ( moved_items , function ( index , item ) {
77
+ $result_list . find ( 'tbody tr .js-reorder-' + item . pk ) . parents ( 'tr' ) . each ( function ( ) {
78
78
$ ( this ) . find ( 'div.drag' ) . attr ( 'order' , item . order ) ;
79
79
} ) ;
80
80
} ) ;
81
81
} ,
82
- error : function ( response ) {
82
+ error : function ( response ) {
83
83
console . error ( 'The server responded: ' + response . responseText ) ;
84
84
}
85
85
} ) ;
86
86
}
87
87
} ) ;
88
88
$ ( '#result_list, tbody, tr, td, th' ) . disableSelection ( ) ;
89
- } ) ;
89
+ } ) ( django . jQuery )
90
90
91
91
// Show and hide the step input field
92
- jQuery ( function ( $ ) {
92
+ django . jQuery ( function ( $ ) {
93
93
var $step_field = $ ( '#changelist-form-step' ) ;
94
94
var $page_field = $ ( '#changelist-form-page' ) ;
95
95
@@ -139,4 +139,4 @@ jQuery(function($) {
139
139
}
140
140
var $form = $ ( '#changelist-form' ) || $grp_form ;
141
141
$form . find ( 'select[name="action"]' ) . change ( display_fields ) ;
142
- } ) ;
142
+ } ) ( django . jQuery ) ;
0 commit comments