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 = ->
9797 I18n .t (' labels.javascripts.max_limit_reached' , {limit : limit})
9898
9999 $ (' .labels-select2-tag' ).on ' select2:select' , clear_input
100+ $ (document ).one (' turbo:visit' , destroy_select2);
100101 return
101102
102103clear_input = ->
103104 $ (' .labels-select2-tag' ).siblings (" .select2" ).find (" textarea" ).val (" " );
104105 return
105106
107+ destroy_select2 = ->
108+ selectElement = $ (' .labels-select2-tag' );
109+ selectElement .select2 (' destroy' );
110+ selectElement .off (' select2:select' );
111+ return
112+
106113
107114root = exports ? this ;
108115root .verify_label_name = verify_label_name;
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ initializeLoadSelect2 = ->
1616 closeOnSelect : false
1717 placeholder : I18n .t (' tasks.javascripts.select_groups' )
1818
19+ $ (document ).one (' turbo:visit' , destroy_select2);
20+
1921initializeFileTypeSelection = ->
2022 $ (' body' ).on ' keyup' , ' .file-name' , (event ) ->
2123 editor = $ (this ).parents (' .file-container' ).find (' .editor' )[0 ]
@@ -30,6 +32,10 @@ initializeVisibilityWarning = ->
3032 $ (' #task_access_level_public' ).on ' change' , ->
3133 warning_message .addClass (' d-none' )
3234
35+ destroy_select2 = ->
36+ $ (' #task_programming_language_id' ).select2 (' destroy' );
37+ $ (' .my-group' ).select2 (' destroy' );
38+ return
3339
3440$ (document ).on (' turbo-migration:load' , ready)
3541$ (document ).on (' select2:locales:loaded' , initializeLoadSelect2)
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ initializeSelect2 = ->
2424 closeOnSelect : false
2525 placeholder : I18n .t (' tasks.javascripts.all_languages' )
2626
27+ $ (document ).one (' turbo:visit' , destroy_select2);
28+
2729toggleHideShowMore = (element ) ->
2830 $parent = $ (element).parent ()
2931 $toggle = $ (element).find ' .more-btn'
@@ -137,6 +139,11 @@ initializeInputFieldEnterCallback = ->
137139 $ (' .search-submit-button-tag' ).click ();
138140 event .preventDefault ();
139141
142+ destroy_select2 = ->
143+ $ (' .defaultSelect2' ).select2 (' destroy' );
144+ $ (' .language-box' ).select2 (' destroy' );
145+ return
146+
140147
141148$ (document ).on (' turbo-migration:load' , ready)
142149$ (window ).on (' resize' , -> initCollapsable ($ (' .description' ), ' 95px' ))
You can’t perform that action at this time.
0 commit comments