diff --git a/app/assets/javascripts/student_thesis_form.js b/app/assets/javascripts/student_thesis_form.js
index a8c7ee64..14b60de1 100644
--- a/app/assets/javascripts/student_thesis_form.js
+++ b/app/assets/javascripts/student_thesis_form.js
@@ -6,9 +6,11 @@ function conditionalLicenseField() {
var value = $("select#thesis_copyright_id option:selected").text();
if ('I hold copyright' == value) {
$("div.thesis_license").show();
+ $("select#thesis_license_id").prop('required', true);
} else {
$("div.thesis_license").hide();
$("select#thesis_license_id")[0].value = "";
+ $("select#thesis_license_id").prop('required', false);
}
};
diff --git a/app/models/thesis.rb b/app/models/thesis.rb
index a8cac6fc..1c2ee202 100644
--- a/app/models/thesis.rb
+++ b/app/models/thesis.rb
@@ -62,6 +62,7 @@ class Thesis < ApplicationRecord
VALIDATION_MSGS = {
copyright: 'Required - Please identify the copyright holder.',
+ license: 'Required - Please identify the license type.',
graduation_year: 'Required - Please input your year of graduation.',
graduation_month: 'Required - Please select your month of graduation.',
departments: 'Required - Please select your primary department.',
diff --git a/app/views/thesis/edit.html.erb b/app/views/thesis/edit.html.erb
index e69ee040..3ff4b419 100644
--- a/app/views/thesis/edit.html.erb
+++ b/app/views/thesis/edit.html.erb
@@ -126,6 +126,7 @@
<%= f.association :copyright, as: :select,
+ selected: @thesis.copyright.present? ? @thesis.copyright.id : 2,
required: true,
collection: Copyright.display_to_author,
validate: { present: true },
@@ -142,12 +143,13 @@
<%= f.association :license, as: :select,
include_hidden: false,
- label: 'License (if you retain copyright)',
+ label: 'License (if you retain copyright) *',
label_method: :display_description,
label_html: { class: 'col1q' },
wrapper_html: { class: 'field-row select layout-1q3q layout-band' },
input_html: { class: 'field field-select col3q', multiple: false,
- aria: { describedby: 'thesis_license-hint' } },
+ aria: { describedby: 'thesis_license-hint' },
+ data: { msg: Thesis::VALIDATION_MSGS[:license] } },
hint: 'Not sure what to select? Learn more about Creative Commons licenses.'.html_safe,
hint_html: { class: 'col3q', id: 'thesis_license-hint' } %>
diff --git a/app/views/thesis/new.html.erb b/app/views/thesis/new.html.erb
index e91eba50..32f23d3b 100644
--- a/app/views/thesis/new.html.erb
+++ b/app/views/thesis/new.html.erb
@@ -124,6 +124,7 @@
<%= f.association :copyright, as: :select,
+ selected: 2,
required: true,
collection: Copyright.display_to_author,
validate: { presence: true },
@@ -140,12 +141,13 @@
<%= f.association :license, as: :select,
include_hidden: false,
- label: 'License (if you retain copyright)',
+ label: 'License (if you retain copyright) *',
label_method: :display_description,
label_html: { class: 'col1q' },
wrapper_html: { class: 'field-row select layout-1q3q layout-band' },
input_html: { class: 'field field-select col3q', multiple: false,
- aria: { describedby: 'thesis_license-hint' } },
+ aria: { describedby: 'thesis_license-hint' },
+ data: { msg: Thesis::VALIDATION_MSGS[:license] } },
hint: 'Not sure what to select? Learn more about Creative Commons licenses.'.html_safe,
hint_html: { class: 'col3q', id: 'thesis_license-hint' } %>