File tree 1 file changed +20
-16
lines changed
1 file changed +20
-16
lines changed Original file line number Diff line number Diff line change 1
- /*
2
- * src: http://qaru.site/questions/3688420/trying-to-showhide-the-changelist-filter-in-django-admin
1
+ /**
2
+ * Add button for show and hide filters in actions menu
3
+ * src: http://qaru.site/questions/3688420/trying-to-showhide-the-changelist-filter-in-django-admin
3
4
*/
4
5
5
- ( function ( $ ) {
6
- $ ( document ) . ready ( $ => {
7
- $ ( "tr input.action-select" ) . actions ( )
8
- $ ( '<div id="show-filters" style="float: right;"><a href="#">Show filters</a></p>' ) . prependTo ( 'div.actions' )
9
- $ ( '#changelist-filter h2' ) . html ( '<a style="color: white;" id="hide-filters" href="#">Filter →</a>' )
6
+ window . onload = ( ) => {
7
+ ( function ( $ ) {
8
+ $ ( `
9
+ <div id="show-filters" style="float: right">
10
+ <a href="#">Show filters</a>
11
+ </div>
12
+ ` ) . prependTo ( 'div.actions' )
13
+ $ ( '#changelist-filter h2' ) . html ( '<a style="color: white;" id="hide-filters" href="#">Filters →</a>' )
10
14
11
15
$ ( '#show-filters' ) . click ( ( ) => {
12
16
$ ( '#changelist-filter' ) . show ( 'fast' )
13
17
$ ( '#changelist' ) . addClass ( 'filtered' )
14
18
$ ( '#show-filters' ) . hide ( )
15
19
} )
16
20
17
- $ ( '#hide-filters' ) . click ( ( ) => {
18
- $ ( '#changelist-filter' ) . hide ( 'fast' )
19
- $ ( '#show-filters ' ) . show ( )
20
- $ ( '#changelist ' ) . removeClass ( 'filtered' )
21
- } )
22
-
23
- $ ( '#hide-filters' ) . click ( ) ;
24
- } )
25
- } ) ( $ )
21
+ $ ( '#hide-filters' )
22
+ . click ( ( ) => {
23
+ $ ( '#changelist-filter ' ) . hide ( 'fast' )
24
+ $ ( '#show-filters ' ) . show ( )
25
+ $ ( '#changelist' ) . removeClass ( 'filtered' )
26
+ } )
27
+ . click ( )
28
+ } ) ( django . jQuery )
29
+ }
You can’t perform that action at this time.
0 commit comments