Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Further DRY up ItemComponent template

Alexander Brandon Colesf05ada0561a2
diff --git a/modules/grids/app/components/grids/widgets/news_component/item_component.html.erb b/modules/grids/app/components/grids/widgets/news_component/item_component.html.erb
index 49b55066ffc..7325e020a1f 100644
--- a/modules/grids/app/components/grids/widgets/news_component/item_component.html.erb
+++ b/modules/grids/app/components/grids/widgets/news_component/item_component.html.erb
@@ -32,16 +32,8 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::Box.new(mt: 2, pb: 2)) do
component_collection do |body|
body.with_component(
- if project
- render(
- Primer::Beta::Link.new(
- font_weight: :bold,
- underline: true,
- href: news_path(item)
- )
- ) { item.title }
- else
- render(Primer::OpenProject::FlexLayout.new) do |layout|
+ flex_layout do |layout|
+ unless project
layout.with_column do
render(
Primer::Beta::Link.new(
@@ -52,10 +44,10 @@ See COPYRIGHT and LICENSE files for more details.
)
) { "#{item.project.name}:" }
end
+ end
- layout.with_column do
- render(Primer::Beta::Link.new(ml: 1, font_weight: :bold, underline: true, href: news_path(item))) { item.title }
- end
+ layout.with_column do
+ render(Primer::Beta::Link.new(ml: 1, font_weight: :bold, underline: true, href: news_path(item))) { item.title }
end
end
)