Skip to content

Commit

Permalink
Merge pull request #1399 from MITLibraries/etd-627-update-copyright
Browse files Browse the repository at this point in the history
Make requested changes to the copyright and license fields
  • Loading branch information
jazairi authored Dec 9, 2024
2 parents 694d3e5 + 671efa1 commit 7d1339a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/assets/javascripts/student_thesis_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
1 change: 1 addition & 0 deletions app/models/thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
6 changes: 4 additions & 2 deletions app/views/thesis/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
</div>

<%= f.association :copyright, as: :select,
selected: @thesis.copyright.present? ? @thesis.copyright.id : 2,
required: true,
collection: Copyright.display_to_author,
validate: { present: true },
Expand All @@ -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 <a href="https://chooser-beta.creativecommons.org/" target="_blank">Creative Commons licenses</a>.'.html_safe,
hint_html: { class: 'col3q', id: 'thesis_license-hint' } %>

Expand Down
6 changes: 4 additions & 2 deletions app/views/thesis/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
</div>

<%= f.association :copyright, as: :select,
selected: 2,
required: true,
collection: Copyright.display_to_author,
validate: { presence: true },
Expand All @@ -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 <a href="https://chooser-beta.creativecommons.org/" target="_blank">Creative Commons licenses</a>.'.html_safe,
hint_html: { class: 'col3q', id: 'thesis_license-hint' } %>

Expand Down

0 comments on commit 7d1339a

Please sign in to comment.