cleanup erb#23360
Conversation
There was a problem hiding this comment.
Pull request overview
This PR cleans up four Backlogs ERB templates by consolidating mixed <% ... %> / <%= ... %> tags into single <%= ... %> expression blocks that call ViewComponent slot APIs in plain Ruby. The visual output and component behavior are unchanged; the change purely improves readability and consistency with the prior-art style already used in other OpenProject ERB files (e.g., backlog_component.html.erb, meetings/header_component.html.erb).
Changes:
- Replaced verbose interleaved ERB tags with single expression blocks invoking slot setters as Ruby method calls.
- Inlined the
inbox_containerlocal ininbox_component.html.erbinto thecontainer:argument. - Used last-expression-as-content style (e.g.,
t(".label_start_sprint")) for slot button labels, matching existing patterns.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| modules/backlogs/app/components/backlogs/sprint_page_header_component.html.erb | Collapses page header slot configuration into one <%= render ... %> block. |
| modules/backlogs/app/components/backlogs/sprint_component.html.erb | Rewrites sprint card list, action buttons, and menu groups using a single Ruby expression block. |
| modules/backlogs/app/components/backlogs/inbox_component.html.erb | Rewrites inbox list rendering, inlines inbox_container, and converts truncation/show-more handling to a Ruby block. |
| modules/backlogs/app/components/backlogs/bucket_component.html.erb | Rewrites bucket list, header menu, and empty state slots into a single Ruby expression block. |
myabc
left a comment
There was a problem hiding this comment.
Looks fine. AFAICT SprintComponent can be made into one contiguous block.
If not for the: <% header.with_description(display: :flex, direction: :column, classes: "row-gap-2") do %>
<%= render(Primer::Alpha::Stack.new(direction: :horizontal, align: :center)) do %>
<%= render(Backlogs::SprintStatusBadgeComponent.new(sprint:)) %>
<%= render(Primer::Beta::Text.new(classes: "velocity", aria: { live: "polite" })) do %>
<%= story_points_total %> <%= t(:"backlogs.points_label", count: story_points_total) %>
<% end %>
<% if sprint.date_range_set? %>
<%= render(Primer::Beta::Text.new(role: :group, ml: :auto, mr: 2)) do %>
<%= render(Primer::Beta::Octicon.new(:calendar, size: :small, mr: 1)) %>
<%= format_date_range([sprint.start_date, sprint.finish_date]) %>
<% end %>
<% end %>
<% end %>
<% end %> |
Ticket
Part of https://community.openproject.org/wp/74386
What are you trying to accomplish?
Cleanup erb
Merge checklist