@@ -36,9 +36,9 @@ export default class extends Controller {
36
36
const shouldSetSortable = this . sortableValue && this . modeValue !== "batch" && this . modeValue !== "search"
37
37
38
38
if ( shouldSetSortable ) {
39
- this . tableBodyTarget . setAttribute ( ' data-controller' , ' sortable' )
39
+ this . tableBodyTarget . setAttribute ( " data-controller" , " sortable" )
40
40
} else {
41
- this . tableBodyTarget . removeAttribute ( ' data-controller' )
41
+ this . tableBodyTarget . removeAttribute ( " data-controller" )
42
42
}
43
43
}
44
44
@@ -54,13 +54,13 @@ export default class extends Controller {
54
54
}
55
55
56
56
clearSearch ( ) {
57
- this . searchFieldTarget . value = ''
57
+ this . searchFieldTarget . value = ""
58
58
this . search ( )
59
59
}
60
60
61
61
resetSearchAndFilters ( ) {
62
62
if ( this . hasFilterToolbarTarget ) {
63
- this . filterToolbarTarget . querySelectorAll ( ' fieldset' ) . forEach ( fieldset => fieldset . disabled = true )
63
+ this . filterToolbarTarget . querySelectorAll ( " fieldset" ) . forEach ( ( fieldset ) => ( fieldset . disabled = true ) )
64
64
}
65
65
66
66
this . searchFieldTarget . disabled = true
@@ -70,7 +70,7 @@ export default class extends Controller {
70
70
selectRow ( event ) {
71
71
if ( this . checkboxTargets . some ( ( checkbox ) => checkbox . checked ) ) {
72
72
this . modeValue = "batch"
73
- } else if ( this . hasSearchFieldTarget && ( this . searchFieldTarget . value !== '' ) ) {
73
+ } else if ( this . hasSearchFieldTarget && this . searchFieldTarget . value !== "" ) {
74
74
this . modeValue = "search"
75
75
} else if ( this . hasScopesToolbarTarget ) {
76
76
this . modeValue = "scopes"
@@ -84,7 +84,7 @@ export default class extends Controller {
84
84
selectAllRows ( event ) {
85
85
if ( event . target . checked ) {
86
86
this . modeValue = "batch"
87
- } else if ( this . hasSearchFieldTarget && ( this . searchFieldTarget . value !== '' ) ) {
87
+ } else if ( this . hasSearchFieldTarget && this . searchFieldTarget . value !== "" ) {
88
88
this . modeValue = "search"
89
89
} else if ( this . hasScopesToolbarTarget ) {
90
90
this . modeValue = "scopes"
@@ -106,18 +106,18 @@ export default class extends Controller {
106
106
} else {
107
107
const url = new URL ( event . params . url , "http://dummy.com" )
108
108
const params = new URLSearchParams ( url . search )
109
- const frameId = params . get ( ' _turbo_frame' )
109
+ const frameId = params . get ( " _turbo_frame" )
110
110
const frame = frameId ? { frame : frameId } : { }
111
111
// remove the custom _turbo_frame param from url search:
112
- params . delete ( ' _turbo_frame' )
112
+ params . delete ( " _turbo_frame" )
113
113
url . search = params . toString ( )
114
114
115
115
window . Turbo . visit ( url . pathname + url . search , frame )
116
116
}
117
117
}
118
118
119
119
toggleCheckbox ( row ) {
120
- const checkbox = this . checkboxTargets . find ( selection => row . contains ( selection ) )
120
+ const checkbox = this . checkboxTargets . find ( ( selection ) => row . contains ( selection ) )
121
121
122
122
if ( checkbox ) {
123
123
checkbox . checked = ! checkbox . checked
@@ -131,14 +131,10 @@ export default class extends Controller {
131
131
132
132
confirmAction ( event ) {
133
133
const message = event . params . message
134
+ . replace ( "${count}" , this . selectedRows ( ) . length )
134
135
. replace (
135
- "${count}" ,
136
- this . selectedRows ( ) . length
137
- ) . replace (
138
136
"${resource}" ,
139
- this . selectedRows ( ) . length > 1 ?
140
- event . params . resourcePlural :
141
- event . params . resourceSingular
137
+ this . selectedRows ( ) . length > 1 ? event . params . resourcePlural : event . params . resourceSingular
142
138
)
143
139
144
140
if ( ! confirm ( message ) ) {
@@ -167,7 +163,7 @@ export default class extends Controller {
167
163
168
164
// Update the rows background color
169
165
this . checkboxTargets . filter ( ( checkbox ) =>
170
- checkbox . closest ( "tr" ) . classList . toggle ( this . selectedRowClass , checkbox . checked ) ,
166
+ checkbox . closest ( "tr" ) . classList . toggle ( this . selectedRowClass , checkbox . checked )
171
167
)
172
168
173
169
// Update the selected rows count
0 commit comments