Skip to content
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

Save subject page body to Tag.body when tags are created #9843

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Sep 4, 2024

Addresses: #9685

Makes the following changes to the subject page editing flow:

  • Saves the subject key to the fkey field when a tag is created from a /subjects/* page
  • Stores the subject page HTML on new Tag as body
  • Adds a "Page Body" textarea to the tag form inputs
  • Patrons are redirected to the /tags/* page when they navigate to a subject page that is linked to a Tag
  • Updates subject page template edit button's copy to "Create Tag" when no linked tag is found

Limitations

  • The "Page Body" field is not pre-populated with the subject page HTML

Technical

fkey is meant to be immutable, and is displayed in a read-only input.

Testing

Try the following:

  1. Navigate to a subject page that has no associated Tag. Ensure that there is a "Create Tag" button in the upper-right corner of the content body.
  2. Click the "Create Tag" button. Leaving the "Page Body" field blank, submit the form.
  3. Verify that you are viewing a /tags/* page, and that the subject page's body is being rendered.
  4. Attempt to navigate back to the original subject page. Verify that you are redirected to the linked Tag page.

Screenshot

image
The "Create Tag" button

Stakeholders

@jimchamp jimchamp marked this pull request as draft September 4, 2024 19:27
Comment on lines -38 to -41
$if has_tag:
<h3 itemprop="description">
$page.tag['description']
</h3>
Copy link
Collaborator Author

@jimchamp jimchamp Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we do want this somewhere on the page, just not in a heading element (and maybe somewhere else on the page).

Maybe displaying this before tag.body in /type/tag/view.html is the right spot? This would ensure that:

  1. The description is always present in the tag's view
  2. The description only appears on the page once when tag.body is a rendered subject page

@jimchamp jimchamp force-pushed the pre-populate-tag-body branch 2 times, most recently from 670055b to 80d1541 Compare September 10, 2024 22:04
@jimchamp jimchamp mentioned this pull request Sep 13, 2024
12 tasks
@jimchamp jimchamp added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Sep 25, 2024
@jimchamp
Copy link
Collaborator Author

jimchamp commented Sep 25, 2024

Labeled Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] until the following are addressed:

  • Bug: Bad Request error is returned on Tag edit
  • Flow: Librarians given the opportunity to edit the tag before it is created (reinstate edit view on tag creation)
  • UI: Change "Promote to Tag" button copy to "Edit"
  • UX: Pre-populate initial edit form with the /subject/{subject} page's HTML

The last item will likely require that the conditional logic that was added to the "Edit" button is removed (i.e. the button's href and copy should be the same, regardless of whether a tag is linked to the subject page).

jimchamp and others added 9 commits October 7, 2024 08:01
`wmd` is throwing an error on `/tag/add` pages, and will not render two
preview panes.  Since a tag's description is not rendered anywhere,
there is no need to include the markdown editor for that input.
Clicking the "Promote to Tag" button now creates a new Tag and redirects
to the new Tag's "view" page.
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants