File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ function conditionalLicenseField() {
66 var value = $ ( "select#thesis_copyright_id option:selected" ) . text ( ) ;
77 if ( 'I hold copyright' == value ) {
88 $ ( "div.thesis_license" ) . show ( ) ;
9+ $ ( "select#thesis_license_id" ) . prop ( 'required' , true ) ;
910 } else {
1011 $ ( "div.thesis_license" ) . hide ( ) ;
1112 $ ( "select#thesis_license_id" ) [ 0 ] . value = "" ;
13+ $ ( "select#thesis_license_id" ) . prop ( 'required' , false ) ;
1214 }
1315} ;
1416
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ class Thesis < ApplicationRecord
6262
6363 VALIDATION_MSGS = {
6464 copyright : 'Required - Please identify the copyright holder.' ,
65+ license : 'Required - Please identify the license type.' ,
6566 graduation_year : 'Required - Please input your year of graduation.' ,
6667 graduation_month : 'Required - Please select your month of graduation.' ,
6768 departments : 'Required - Please select your primary department.' ,
Original file line number Diff line number Diff line change 126126 </ div >
127127
128128 <%= f . association :copyright , as : :select ,
129+ selected : @thesis . copyright . present? ? @thesis . copyright . id : 2 ,
129130 required : true ,
130131 collection : Copyright . display_to_author ,
131132 validate : { present : true } ,
142143
143144 <%= f . association :license , as : :select ,
144145 include_hidden : false ,
145- label : 'License (if you retain copyright)' ,
146+ label : 'License (if you retain copyright) * ' ,
146147 label_method : :display_description ,
147148 label_html : { class : 'col1q' } ,
148149 wrapper_html : { class : 'field-row select layout-1q3q layout-band' } ,
149150 input_html : { class : 'field field-select col3q' , multiple : false ,
150- aria : { describedby : 'thesis_license-hint' } } ,
151+ aria : { describedby : 'thesis_license-hint' } ,
152+ data : { msg : Thesis ::VALIDATION_MSGS [ :license ] } } ,
151153 hint : 'Not sure what to select? Learn more about <a href="https://chooser-beta.creativecommons.org/" target="_blank">Creative Commons licenses</a>.' . html_safe ,
152154 hint_html : { class : 'col3q' , id : 'thesis_license-hint' } %>
153155
Original file line number Diff line number Diff line change 124124 </ div >
125125
126126 <%= f . association :copyright , as : :select ,
127+ selected : 2 ,
127128 required : true ,
128129 collection : Copyright . display_to_author ,
129130 validate : { presence : true } ,
140141
141142 <%= f . association :license , as : :select ,
142143 include_hidden : false ,
143- label : 'License (if you retain copyright)' ,
144+ label : 'License (if you retain copyright) * ' ,
144145 label_method : :display_description ,
145146 label_html : { class : 'col1q' } ,
146147 wrapper_html : { class : 'field-row select layout-1q3q layout-band' } ,
147148 input_html : { class : 'field field-select col3q' , multiple : false ,
148- aria : { describedby : 'thesis_license-hint' } } ,
149+ aria : { describedby : 'thesis_license-hint' } ,
150+ data : { msg : Thesis ::VALIDATION_MSGS [ :license ] } } ,
149151 hint : 'Not sure what to select? Learn more about <a href="https://chooser-beta.creativecommons.org/" target="_blank">Creative Commons licenses</a>.' . html_safe ,
150152 hint_html : { class : 'col3q' , id : 'thesis_license-hint' } %>
151153
You can’t perform that action at this time.
0 commit comments