-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Subject tag changes #10138
base: master
Are you sure you want to change the base?
Subject tag changes #10138
Conversation
Removes `work` tag type, and adds four distinct subject types. Adds `body` input to the "add tag" form. Fixes bug where incorrect subject page link is rendered on tag page. Replace subject page "Edit" button with "Tag" button, when no associated tag is found. If there is a tag, a link to the tag page is included beneath the tag description. Update the Tag.create method to take a `tag` dictionary, and to return the newly created tag.
Creates handler for paths like `/tag/{tag_type}/add`, and new templates for adding and editing specific tag types. The generic "Add Tag" form template has been updated to show and hide the appropriate form elements whenever the selected tag type is changed. Additionally, existing tag form templates have been updated to take a `page` object (instead of one parameter for each property a `Tag` may have). The subject page "Tag" link has been updated to point to `/tag/{tag_type}/add`, where `tag_type` is one of our four subject types. Patron's who follow the link will be served the form for adding subject tags (instead of the generalized add tag form, available at `/tag/add`).
The subject page handler now makes a call to fetch related tags after the subject has been returned from Solr. Data fetched from the `/subjects` `json` endpoint are no longer decorated with tag data.
Adds new `validate_subject_tag` and `create_tag` functions. Updates existing `create_subject_tag` function to take a dictionary. Updates existing handlers to use the correct tag validation and creation methods.
Form would fail to submit when `collection` type was chosen and all fields filled. The issue was the required subject tag body, which is only required for subject tags. Inputs specific to a tag sub-type are now removed if that tag type is not selected.
- Sanitize tag description in tag view - Update subject key derivation in tag view - Reduce number of DB calls required to decorate a subject page with tags - Tag edit `GET` handler returns edit form specific to the existing tag's type - Use correct sub-type validations on tag edit - Remove `utils.unflatten` call when creating tag - `utils.unflatten` is made specifically for processing the book edit form
e52b1fe
to
1c17c70
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #10138 +/- ##
==========================================
+ Coverage 17.12% 17.44% +0.31%
==========================================
Files 89 89
Lines 4752 4792 +40
Branches 831 848 +17
==========================================
+ Hits 814 836 +22
- Misses 3428 3436 +8
- Partials 510 520 +10 ☔ View full report in Codecov by Sentry. |
01aaaf0
to
7f45814
Compare
53a99e9
to
7e861fd
Compare
fe8c8a4
to
12fca88
Compare
c6dc94f
to
0d81650
Compare
- Disambiguation links now point to subject pages - Disambiguation link for current page is no longer included
- Move disambiguation section - Add tag body to top of `contentBody` div
- Require `body` for all tag types - Add duplicate tag validations - Reload page with flash message when duplicate tag exists - Update flash messages to render hyperlinks
0f30126
to
2b2e593
Compare
0370a6d
to
860a95e
Compare
Outstanding tasks:
|
SUBJECT_SUB_TYPES = ["subject", "person", "place", "time"] | ||
TAG_TYPES = SUBJECT_SUB_TYPES + ["collection"] |
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 are being used as display strings. get_subject_tag_types
and get_tag_types
will need to be updated such that they return lists of localized tag type strings.
match = list(web.ctx.site.things(q)) | ||
return match[0] if match else None | ||
def find(cls, tag_name, tag_type=None): | ||
"""Returns a Tag key for a given tag name.""" |
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.
"""Returns a Tag key for a given tag name.""" | |
"""Returns a list of keys for Tags that match the search criteria.""" |
4468b30
to
5ba6a4b
Compare
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.
There are accessibility issues in these changes.
<div class="formElement"> | ||
<div class="label"><label for="tag_type">$_("Tag type")</label></div> | ||
<div class="input"> | ||
<select name="tag_type" id="tag_type" required> | ||
<select name="tag_type" required> |
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.
Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.
for more information, see https://pre-commit.ci
Supplants #9843
General Tag Changes
collection
subject
,person
,place
,time
work
-type tags have been removedbody
propertyTag
modelTag.find()
updated to return multiple valuestag_type
no longer a required parameterTag.create()
updated to take adict
representation of a Tagdict
validations are expected to occur beforecreate
is calledTag.create()
now returns the newly createdTag
object (instead of a key)Tag
page templatesGeneral Tag view -
/templates/type/tag/view.html
subject_key
Tag.body
to the page (if the tag is a subject tag)Tag
edit
andadd
views have been consolidated as/templates/type/tag/form.html
Subject page
Tag
views of subject tags with a similar nameaddtag.py
unflatten
calls on patron input have been removedunflatten
is used specifically for book edit form dataMissing from this PR
body
is not automatically generatedsanitize
andformat
calls/tags/OL123T/{tag_type}/{tag_label}
)ReadableUrlProcessor
Technical
Testing
Screenshot
Stakeholders