Skip to content

Conversation

@ReverM
Copy link
Contributor

@ReverM ReverM commented Dec 10, 2025

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

ReverM and others added 8 commits December 4, 2025 10:37
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
@ReverM
Copy link
Contributor Author

ReverM commented Dec 10, 2025

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.

@slavalamp
Copy link
Contributor

slavalamp commented Dec 10, 2025

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"

@ReverM ReverM changed the title AO3 7214 + 7215 Bookmark Javascript Improvement AO3-7214 AO3-7215 Bookmark Javascript Improvement Dec 10, 2025
@ReverM
Copy link
Contributor Author

ReverM commented Dec 10, 2025

though the pr name should begin like this: "AO3-7214 AO3-7215"

Changed the PR name accordingly

Copy link
Collaborator

@sarken sarken left a 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', '#');
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants