Skip to content

[59915] Update PageHeaders & SubHeaders in the (rails) project pages (Part 2) #18600

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

Open
wants to merge 48 commits into
base: dev
Choose a base branch
from

Conversation

bsatarnejad
Copy link
Contributor

Ticket

https://community.openproject.org/wp/59915

What are you trying to accomplish?

Update page header in remaining rails pages

@bsatarnejad bsatarnejad force-pushed the 59915-update-pageheaders-subheaders-in-the-rails-project-pages-part-2 branch from 2b42ff6 to e1679b6 Compare April 14, 2025 14:19
@bsatarnejad bsatarnejad requested a review from HDinger April 15, 2025 07:13
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Hi @bsatarnejad

I did not manage to go through all of it yet, but would like to give you some initial feedback already:

  • Please extract the more complex PageHeaders into separate components. Especially the one for the wiki/show page is so complex, it has to be extracted. I think a general rule of thumb would be that as soon as you have logic inside, extract it into a component (e.g when having if clauses or permission checks)
  • Please do not use classes for testing but provide test_selectors to the elements which you then access in the class.
  • I am wondering whether in this example, the toolbar should read "Seeded project / Wiki / Coole version" . What do you think?
Bildschirmfoto 2025-04-15 um 15 21 07

@HDinger HDinger modified the milestones: 15.5.x, 16.0.x Apr 15, 2025
@bsatarnejad
Copy link
Contributor Author

Hi @bsatarnejad

I did not manage to go through all of it yet, but would like to give you some initial feedback already:

  • Please extract the more complex PageHeaders into separate components. Especially the one for the wiki/show page is so complex, it has to be extracted. I think a general rule of thumb would be that as soon as you have logic inside, extract it into a component (e.g when having if clauses or permission checks)
  • Please do not use classes for testing but provide test_selectors to the elements which you then access in the class.
  • I am wondering whether in this example, the toolbar should read "Seeded project / Wiki / Coole version" . What do you think?
Bildschirmfoto 2025-04-15 um 15 21 07

Hey @HDinger thanks for the hints.
Regarding the breadcrumb in the image, I think it is correct now based on what we discussed before in UX meeting:

Use breadcrumb fromat:

{Project name} → {Wiki name}

<% breadcrumb_paths(*(@page.ancestors.reverse.collect { |parent| link_to h(parent.breadcrumb_title), { id: parent, project_id: parent.project } } + [h(@page.breadcrumb_title)])) %>
<%=
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { h(@page.title) }
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels weird.. I'd expect something like "History of {title}" and get rid of that second headline. Or just "History" and represent the title in the breadcrumb

@bsatarnejad bsatarnejad force-pushed the 59915-update-pageheaders-subheaders-in-the-rails-project-pages-part-2 branch from aee5379 to d74f47f Compare April 17, 2025 05:16
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Looks good, I only have minor remarks left 👍

<% end %>
<%=
render(Primer::OpenProject::SubHeader.new) do |subheader|
if show_create?
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be before calling the component to avoid empty space:

Bildschirmfoto 2025-04-17 um 14 12 35

breadcrumb_for_page(@project, @page)
)
end
%>
Copy link
Contributor

Choose a reason for hiding this comment

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

The breadcrumb and the title does not match
Bildschirmfoto 2025-04-17 um 14 17 21

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I take it from your comment here: #18600 (comment),
'History' for title and page.title in breadcrumb, did I misunderstand?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is not what I meant.. Normally, the breadcrumb and the title should be the same. The only excpetion is when using the selected_item_font option. So you have two options:

  • Both show "History"
  • The title shows "History", the breadcrumb shows "Blup: History"

within('[data-test-selector="wiki-page-header-breadcrumbs"]') do
expect(page).to have_text(parent_page.title.to_s)
end
expect(page).to have_css(".breadcrumb-item",
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the point of testing this? You are already checking the for the title to be part of the breadcrumb above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, It was duplicated, fixed.

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

Successfully merging this pull request may close these issues.

3 participants