-
Notifications
You must be signed in to change notification settings - Fork 651
AO3-7214 AO3-7215 Bookmark Javascript Improvement #5499
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
base: master
Are you sure you want to change the base?
Conversation
Changed id to class so that every button that can do one feature behaves the same and changed the organisation of the jquery
Since the new tests have been moved to their new feature file to test javascript feature these are not needed
|
Appologies if having multiple ticket in one PR is bad etiquette. I decided to put both in the same PR, as they were extremely closely related, and would likely be waiting on each other if done separately. |
|
yeah, putting two tickets in one pr is fine when it's exact the same fix for both though the pr name should begin like this: "AO3-7214 AO3-7215" |
Changed the PR name accordingly |
sarken
left a comment
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.
Thanks for working on this! In addition to the question I left on the JavaScript file, I think you also need to changeid to class for the buttons in the bookmarkable_blurb, which is used for pages where we show multiple bookmarks under a single item, e.g., a tag's bookmark listing.
| $j('#bookmark_form_close_for_<%= bookmark_form_id %>').click(function(){ | ||
| $j('#bookmark_form_placement_for_<%= bookmark_form_id %>').hide(); | ||
| $j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').show(); | ||
| $j('.bookmark_form_trigger_for_<%= bookmark_form_id %>').attr('href', '#'); |
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 was a little confused by this line. It didn't seem necessary at first, but when I removed it, I noticed that it seems to fix an issue introduced by the other changes in this file.
Here's what I noticed:
Currently, if I go to a bookmarks index, press "Save" on something I don't have bookmarked, enter some text in the form, and then use the "x" to close the form without saving, the form opens with my text entered the next time I press "Save."
It seems like that behavior breaks when this line is removed: the second time I press "Save," the form gets reloaded and my text is lost.
Is that indeed what this line is fixing? If so, do you know why that bug happens, and if there is any other way we could avoid it? Removing the original href means it's no longer possible to right-click "Save" and open the form in a new window, which is somewhat unfortunate. We can live with it if we have to, but it would be a good idea to have a code comment explaining why this line is needed.
Issue
https://otwarchive.atlassian.net/browse/AO3-7214
https://otwarchive.atlassian.net/browse/AO3-7215
Purpose
This adresses both tickets 7214 and 7215 by making all buttons that could edit a bookmark disappear when the form is open, by allowing a closed form to be reopened (7215) and by fixing the opening and closing of multiple forms at the same time.
7214 was fixed by removing the variables and jquerying the appropriate component each time the form is closed or reopened.
7215 was fixed by changing the href of the opening buttons as part of the closing event, as well as changing the id to a class so every element is affected at the same time.
Credit
Danaël / Rever ( they / he )
Jira account goes by Danaël Villeneuve