File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,19 @@ ready = ->
97
97
I18n .t (' labels.javascripts.max_limit_reached' , {limit : limit})
98
98
99
99
$ (' .labels-select2-tag' ).on ' select2:select' , clear_input
100
+ $ (document ).one (' turbo:visit' , destroy_select2);
100
101
return
101
102
102
103
clear_input = ->
103
104
$ (' .labels-select2-tag' ).siblings (" .select2" ).find (" textarea" ).val (" " );
104
105
return
105
106
107
+ destroy_select2 = ->
108
+ selectElement = $ (' .labels-select2-tag' );
109
+ selectElement .select2 (' destroy' );
110
+ selectElement .off (' select2:select' );
111
+ return
112
+
106
113
107
114
root = exports ? this ;
108
115
root .verify_label_name = verify_label_name;
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ initializeLoadSelect2 = ->
16
16
closeOnSelect : false
17
17
placeholder : I18n .t (' tasks.javascripts.select_groups' )
18
18
19
+ $ (document ).one (' turbo:visit' , destroy_select2);
20
+
19
21
initializeFileTypeSelection = ->
20
22
$ (' body' ).on ' keyup' , ' .file-name' , (event ) ->
21
23
editor = $ (this ).parents (' .file-container' ).find (' .editor' )[0 ]
@@ -30,6 +32,10 @@ initializeVisibilityWarning = ->
30
32
$ (' #task_access_level_public' ).on ' change' , ->
31
33
warning_message .addClass (' d-none' )
32
34
35
+ destroy_select2 = ->
36
+ $ (' #task_programming_language_id' ).select2 (' destroy' );
37
+ $ (' .my-group' ).select2 (' destroy' );
38
+ return
33
39
34
40
$ (document ).on (' turbo-migration:load' , ready)
35
41
$ (document ).on (' select2:locales:loaded' , initializeLoadSelect2)
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ initializeSelect2 = ->
24
24
closeOnSelect : false
25
25
placeholder : I18n .t (' tasks.javascripts.all_languages' )
26
26
27
+ $ (document ).one (' turbo:visit' , destroy_select2);
28
+
27
29
toggleHideShowMore = (element ) ->
28
30
$parent = $ (element).parent ()
29
31
$toggle = $ (element).find ' .more-btn'
@@ -137,6 +139,11 @@ initializeInputFieldEnterCallback = ->
137
139
$ (' .search-submit-button-tag' ).click ();
138
140
event .preventDefault ();
139
141
142
+ destroy_select2 = ->
143
+ $ (' .defaultSelect2' ).select2 (' destroy' );
144
+ $ (' .language-box' ).select2 (' destroy' );
145
+ return
146
+
140
147
141
148
$ (document ).on (' turbo-migration:load' , ready)
142
149
$ (window ).on (' resize' , -> initCollapsable ($ (' .description' ), ' 95px' ))
You can’t perform that action at this time.
0 commit comments