File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,8 @@ class InterimMeetingModelForm(forms.ModelForm):
115115 required = False ,
116116 empty_label = "Click to select" ,
117117 )
118+ group .widget .attrs ['data-max-entries' ] = 1
119+ group .widget .attrs ['data-minimum-input-length' ] = 0
118120 in_person = forms .BooleanField (required = False )
119121 meeting_type = forms .ChoiceField (
120122 choices = (
@@ -137,7 +139,14 @@ class InterimMeetingModelForm(forms.ModelForm):
137139 city = forms .CharField (max_length = 255 , required = False )
138140 city .widget .attrs ['placeholder' ] = "City"
139141 country = forms .ChoiceField (choices = countries , required = False )
142+ country .widget .attrs ['class' ] = "select2-field"
143+ country .widget .attrs ['data-max-entries' ] = 1
144+ country .widget .attrs ['data-placeholder' ] = "Country"
145+ country .widget .attrs ['data-minimum-input-length' ] = 0
140146 time_zone = forms .ChoiceField (choices = timezones )
147+ time_zone .widget .attrs ['class' ] = "select2-field"
148+ time_zone .widget .attrs ['data-max-entries' ] = 1
149+ time_zone .widget .attrs ['data-minimum-input-length' ] = 0
141150
142151 class Meta :
143152 model = Meeting
Original file line number Diff line number Diff line change @@ -6,9 +6,6 @@ var interimRequest = {
66 interimRequest . addButton = $ ( '#add_session' ) ;
77 interimRequest . inPerson = $ ( '#id_in_person' ) ;
88 interimRequest . timezone = $ ( '#id_time_zone' ) ;
9- // bind functions
10- $ ( '.select2-field' )
11- . select2 ( ) ;
129 interimRequest . addButton . on ( "click" , interimRequest . addSession ) ;
1310 $ ( '.btn-delete' )
1411 . on ( "click" , interimRequest . deleteSession ) ;
@@ -33,8 +30,6 @@ var interimRequest = {
3330 . each ( interimRequest . calculateEndTime ) ;
3431 $ ( 'input[name$="-time"]' )
3532 . each ( interimRequest . updateInfo ) ;
36- $ ( '#id_country' )
37- . select2 ( { placeholder : "Country" } ) ;
3833 const remoteParticipations = $ ( 'select[id$="-remote_participation"]' ) ;
3934 remoteParticipations . change (
4035 evt => interimRequest . updateRemoteInstructionsVisibility ( evt . target )
@@ -86,11 +81,6 @@ var interimRequest = {
8681 template . before ( el ) ;
8782 el . removeClass ( "template visually-hidden" ) ;
8883
89- el . find ( ".select2-field" )
90- . each ( function ( ) {
91- setupSelect2Field ( $ ( this ) ) ;
92- } ) ;
93-
9484 // copy field contents
9585 var first_session = $ ( ".fieldset:first" ) ;
9686 el . find ( "input[name$='remote_instructions']" )
@@ -286,7 +276,7 @@ var interimRequest = {
286276 break ;
287277 }
288278 }
289- }
279+ } ;
290280
291281$ ( document )
292282 . ready ( function ( ) {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ $.fn.select2.defaults.set("allowClear", true);
77$ . fn . select2 . defaults . set ( "debug" , false ) ;
88$ . fn . select2 . defaults . set ( "dropdownCssClass" , ":all:" ) ;
99$ . fn . select2 . defaults . set ( "minimumInputLength" , 2 ) ;
10+ $ . fn . select2 . defaults . set ( "placeholder" , "" ) ;
1011$ . fn . select2 . defaults . set ( "selectionCssClass" , ":all:" ) ;
1112$ . fn . select2 . defaults . set ( "theme" , "bootstrap-5" ) ;
1213$ . fn . select2 . defaults . set ( "width" , "off" ) ;
You can’t perform that action at this time.
0 commit comments