Skip to content

AO3-7404 Enhancements to works New Comment page#5743

Open
bre-nana wants to merge 15 commits intootwcode:masterfrom
bre-nana:AO3-7404
Open

AO3-7404 Enhancements to works New Comment page#5743
bre-nana wants to merge 15 commits intootwcode:masterfrom
bre-nana:AO3-7404

Conversation

@bre-nana
Copy link
Copy Markdown
Contributor

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7404

Purpose

On the New Comment page of a work:

  • Make the work title in the header a link to the work
  • Title case the header i.e. "New Comment on [work title]"
  • Remove the "Back" button

Also added some translations for the Comments page header, and the "Comment" button on the New Comment page.

Testing Instructions

Below is an additional testing scenario to ensure the changes I've made on the Comments page haven't changed the functionality. I plan to comment this on the Jira ticket when/if this PR is merged.

Steps to reproduce

  1. (optionally) Log in
  2. Find a work and go to its Comments page (/works/xxx/comments)

What happens (and what should still happen)

The page header says "Reading Comments on [work title]" and the work title is a link to the work.

Credit

bre-nana (she/they/he)

@bre-nana
Copy link
Copy Markdown
Contributor Author

Sorry about the reviewdog lint failure - I can't seem to figure it out 😅
Please let me know what is required!

Comment thread app/views/comments/new.html.erb Outdated
Comment on lines +7 to +11
<%= render partial: "comments/comment_form", locals: {
comment: @comment,
commentable: @commentable,
button_name: t(".actions.comment")
} %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"the start of the line" here is the ruby code excluding the <%= tag, so you need to indent lines 8-11 by 4 more spaces

erblint actually has the -a option for autocorrecting errors which is especially nice for small files like this one (or where there aren't errors in code irrelevant to your pr in general), here the command would be erblint -a app/views/comments/new.html.erb (or docker compose run --rm web bundle exec erblint -a app/views/comments/new.html.erb if you're using docker)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks! fixed on d2d7dba

Comment thread config/locales/views/en.yml Outdated
Comment on lines +918 to +922
page_heading_html: Reading Comments on %{link}
new:
actions:
comment: Comment
page_heading_html: New Comment on %{link}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

link variables should be descriptive, i suggest commentable_link like in the strings below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks! fixed on 41c4211

Comment thread app/views/comments/new.html.erb Outdated
Comment on lines 14 to 15
<!--subnav-->
<p class="navigation actions" role="navigation"><!--TODO: INVESTIGATE this baffling link--><%= link_to ts("Back"), @commentable.is_a?(Tag) ? tag_path(@commentable) : polymorphic_path(@commentable) %></p>
<!--/subnav-->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the subnav comments could be removed too if you want to, i'm pretty sure there's no reason for them to be here anymore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks! fixed on d2d7dba

Comment on lines +7 to 17
Scenario: Reading comments page for a work displays correctly

Given the work "Generic Work"
When I am logged in as "commenter"
And I visit the comments page for the work "Generic Work"
Then I should see "Reading Comments on"
And I should see a page link to the work "Generic Work" within ".comments-index h2.heading"

Scenario: New comment page for a work displays correctly

Given the work "Generic Work"
Copy link
Copy Markdown
Contributor

@slavalamp slavalamp Apr 18, 2026

Choose a reason for hiding this comment

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

also just a nitpick since i'm already requesting other changes, but the empty lines after scenario descriptions aren't needed, so you can remove them in these two tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks! fixed on d2d7dba

Comment thread app/helpers/comments_helper.rb Outdated
title = link_to(commentable.commentable_name, commentable)
end
(ts('Reading Comments on ') + title).html_safe
t("comments.index.page_heading_html", commentable_link: title)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah, also sorry for not catching this earlier, looks like comments helper i18n strings should go into comments_helper in the config/locales/helpers/en.yml file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ahh yep thanks! still trying to wrap my head around how the config/locales folder is structured 😅
should be fixed on adef561

Copy link
Copy Markdown
Contributor

@slavalamp slavalamp left a comment

Choose a reason for hiding this comment

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

thanks! this looks good to me, it needs to be approved by an official volunteer now (assuming i didn't miss anything else)

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