-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make requested changes to the copyright and license fields #1399
Conversation
app/views/thesis/new.html.erb
Outdated
@@ -124,6 +124,7 @@ | |||
</div> | |||
|
|||
<%= f.association :copyright, as: :select, | |||
selected: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jazairi It looks like we set the ID is consistent in the PR builds as well so while not ideal, it's probably a risk we can accept as there is little reason we'd be changing the Author copyright to be something inherently different under the good.
That said, I believe this ID is wrong as Author is ID 2 (in the PR build and prod at least).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JPrevost Thanks for pointing that out! While fixing that, I noticed that I'd forgotten to include license validation/required field indicator in the edit view, so I added that, too.
@@ -124,6 +124,7 @@ | |||
</div> | |||
|
|||
<%= f.association :copyright, as: :select, | |||
selected: 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if for the edit view we can do something like selected: 2 if license.nil?
(not real code). My reasoning is that because of the registrar data load pre-creating theses, I think most users hit the edit form and not the new form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point. I'll see what options we have there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks and works as expected.
I added a comment as to whether we can figure out how to make the feature work safely for the edit form. If not, I can approve as-is. But if we can make edit work safely (i.e. only override selection if no data exists for that field) that would be better.
@JPrevost I think the latest commit addresses your concern about the edit form. It's a bit kludgy to preselect the associated copyright, but without that condition, that field would be blank if the thesis already had a copyright. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works how I think it makes sense... let's hope when you check in with stakeholders it's what they meant :)
Thanks for taking the extra time to make the tweaks!
Why these changes are being introduced: Stakeholders have requested that we preselect the 'author' copyright value, and make the license field conditionally required when that copyright value is selected. Relevant ticket(s): * [ETD-627](https://mitlibraries.atlassian.net/browse/ETD-627) How this addresses that need: This adds the `selected` property to the desired option in the copyright field. It also updates the `conditionalLicenseField` function to toggle the `required` property on the license field when it is shown or hidden. Side effects of this change: * Past experience has made me wary of toggling the `required` prop in this way. However, it is generally reliable under a single binary condition (either the 'Author' copyright value is selected, or it isn't). I haven't noticed any issues in click-testing. * `selected` is tied to a value, so in this case we are preselecting the first option. This corresponds to 'Author' in both staging and prod, but it would be better to make an explicit association. If the data were to change order somehow, the wrong copyright holder could be preselected.
e5ce406
to
671efa1
Compare
Why these changes are being introduced:
Stakeholders have requested that we preselect the 'author' copyright value, and make the license field conditionally required when that copyright value is selected.
Relevant ticket(s):
How this addresses that need:
This adds the
selected
property to the desired option in the copyright field. It also updates theconditionalLicenseField
function to toggle therequired
property on the license field when it is shown or hidden.Side effects of this change:
required
prop in this way. However, it is generally reliable under a single binary condition (either the 'Author' copyright value is selected, or it isn't). I haven't noticed any issues in click-testing.selected
is tied to a value, so in this case we are preselecting the first option. This corresponds to 'Author' in both staging and prod, but it would be better to make an explicit association. If the data were to change order somehow, the wrong copyright holder could be preselected.Developer
our guide and
all issues introduced by these changes have been resolved or opened as new
issues (link to those issues in the Pull Request details above)
Code Reviewer
(not just this pull request message)
Requires database migrations?
NO
Includes new or updated dependencies?
NO