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

Cleanup code

Henriette Darge44f5e054cd2e
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb
index 2ae2301c320..766b00ecdba 100644
--- a/app/views/activities/index.html.erb
+++ b/app/views/activities/index.html.erb
@@ -34,8 +34,10 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { (@author.nil? ? t(:label_activity) : t(:label_user_activity, value: link_to_user(@author))).html_safe }
header.with_description { t(:label_date_from_to, start: format_date(@date_to - @days), end: format_date(@date_to - 1)) }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- t(:label_activity)]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ t(:label_activity)
+ ].compact
)
end
%>
diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb
index f3d59f71b21..eff11a9e565 100644
--- a/app/views/news/edit.html.erb
+++ b/app/views/news/edit.html.erb
@@ -32,9 +32,11 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { @news.title }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- *([href: project_news_index_path(@project.id), text: t(:label_news_plural)] if @project),
- @news.title]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ ({ href: project_news_index_path(@project.id), text: t(:label_news_plural) } if @project),
+ @news.title
+ ].compact
)
end
%>
diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb
index 5fe57f6f2df..9f391574cc6 100644
--- a/app/views/news/index.html.erb
+++ b/app/views/news/index.html.erb
@@ -37,8 +37,10 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t(:label_news_plural) }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- t(:label_news_plural)]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ t(:label_news_plural)
+ ].compact
)
end
%>
diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb
index 4dfd8b1b224..9db18882e4a 100644
--- a/app/views/news/show.html.erb
+++ b/app/views/news/show.html.erb
@@ -31,9 +31,11 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { "#{avatar(@news.author)} #{h @news.title}".html_safe }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- *([href: project_news_index_path(@project.id), text: t(:label_news_plural)] if @project),
- @news.title]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ ({ href: project_news_index_path(@project.id), text: t(:label_news_plural) } if @project),
+ @news.title
+ ].compact
)
if User.current.allowed_in_project?(:manage_news, @project)
header.with_action_button(
diff --git a/lib/open_project/patches/primer_page_header_breadcrumb.rb b/lib/open_project/patches/primer_page_header_breadcrumb.rb
index af6717b1260..5e3e220c4d5 100644
--- a/lib/open_project/patches/primer_page_header_breadcrumb.rb
+++ b/lib/open_project/patches/primer_page_header_breadcrumb.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -30,7 +32,7 @@ module OpenProject
module Patches
module PrimerPageHeaderBreadcrumb
def with_breadcrumbs(breadcrumbs, **)
- super([{ href: home_path, text: helpers.organization_name}] + breadcrumbs, **)
+ super([{ href: home_path, text: helpers.organization_name }] + breadcrumbs, **)
end
end
end
diff --git a/modules/boards/app/views/boards/boards/index.html.erb b/modules/boards/app/views/boards/boards/index.html.erb
index 524bb0cccfd..5a5a2e0a026 100644
--- a/modules/boards/app/views/boards/boards/index.html.erb
+++ b/modules/boards/app/views/boards/boards/index.html.erb
@@ -33,8 +33,10 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t("boards.label_boards") }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- t("boards.label_boards")]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ t("boards.label_boards")
+ ].compact
)
end
%>
diff --git a/modules/boards/app/views/boards/boards/new.html.erb b/modules/boards/app/views/boards/boards/new.html.erb
index da90c86177b..a8c21c9c24b 100644
--- a/modules/boards/app/views/boards/boards/new.html.erb
+++ b/modules/boards/app/views/boards/boards/new.html.erb
@@ -33,9 +33,11 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t("boards.label_create_new_board") }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- *([href: project_work_package_boards_path(@project.id), text: t("boards.label_boards")] if @project),
- t("boards.label_create_new_board")]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ ({ href: project_work_package_boards_path(@project.id), text: t("boards.label_boards") } if @project),
+ t("boards.label_create_new_board")
+ ].compact
)
end
%>
diff --git a/modules/calendar/app/views/calendar/calendars/index.html.erb b/modules/calendar/app/views/calendar/calendars/index.html.erb
index 4d41239814d..f59568c776d 100644
--- a/modules/calendar/app/views/calendar/calendars/index.html.erb
+++ b/modules/calendar/app/views/calendar/calendars/index.html.erb
@@ -32,8 +32,10 @@ See COPYRIGHT and LICENSE files for more details.
render Primer::OpenProject::PageHeader.new do |header|
header.with_title { t(:label_calendar_plural) }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- t(:label_calendar_plural)]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project),
+ t(:label_calendar_plural)
+ ].compact
)
end
%>
diff --git a/modules/meeting/app/components/meetings/header_component.rb b/modules/meeting/app/components/meetings/header_component.rb
index aeb1534878f..5d6fa8d81ad 100644
--- a/modules/meeting/app/components/meetings/header_component.rb
+++ b/modules/meeting/app/components/meetings/header_component.rb
@@ -75,7 +75,7 @@ module Meetings
def breadcrumb_items
[
- *([{ href: project_overview_path(@project.id), text: @project.name }] if @project.present?),
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project.present?),
{ href: @project.present? ? project_meetings_path(@project.id) : meetings_path,
text: I18n.t(:label_meeting_plural) },
meeting_series_element,
diff --git a/modules/meeting/app/components/meetings/index_page_header_component.rb b/modules/meeting/app/components/meetings/index_page_header_component.rb
index d61229b89b3..931a75ab07a 100644
--- a/modules/meeting/app/components/meetings/index_page_header_component.rb
+++ b/modules/meeting/app/components/meetings/index_page_header_component.rb
@@ -46,10 +46,12 @@ module Meetings
end
def breadcrumb_items
- [*([{ href: project_overview_path(@project.id), text: @project.name }] if @project.present?),
- { href: url_for({ controller: "meetings", action: :index, project_id: @project }),
- text: I18n.t(:label_meeting_plural) },
- current_breadcrumb_element]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project.present?),
+ { href: url_for({ controller: "meetings", action: :index, project_id: @project }),
+ text: I18n.t(:label_meeting_plural) },
+ current_breadcrumb_element
+ ].compact
end
def current_breadcrumb_element
diff --git a/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb b/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb
index 3636394d294..5813be8ffc1 100644
--- a/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb
+++ b/modules/meeting/app/components/recurring_meetings/show_page_header_component.rb
@@ -83,10 +83,12 @@ module RecurringMeetings
end
def breadcrumb_items
- [*([{ href: project_overview_path(@project.id), text: @project.name }] if @project.present?),
- { href: @project.present? ? project_meetings_path(@project.id) : meetings_path,
- text: I18n.t(:label_meeting_plural) },
- page_title(true)]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project.present?),
+ { href: @project.present? ? project_meetings_path(@project.id) : meetings_path,
+ text: I18n.t(:label_meeting_plural) },
+ page_title(true)
+ ].compact
end
end
end
diff --git a/modules/meeting/app/views/recurring_meetings/new.html.erb b/modules/meeting/app/views/recurring_meetings/new.html.erb
index b17a5736112..fe589a50de1 100644
--- a/modules/meeting/app/views/recurring_meetings/new.html.erb
+++ b/modules/meeting/app/views/recurring_meetings/new.html.erb
@@ -31,10 +31,12 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t(:label_recurring_meeting_new) }
header.with_breadcrumbs(
- [*([{ href: project_overview_path(@project.id), text: @project.name }] if @project.present?),
- { href: @project.present? ? project_recurring_meetings_path(@project.id) : recurring_meetings_path,
- text: I18n.t(:label_meeting_plural) },
- t(:label_recurring_meeting_new)]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project.present?),
+ { href: @project.present? ? project_recurring_meetings_path(@project.id) : recurring_meetings_path,
+ text: I18n.t(:label_meeting_plural) },
+ t(:label_recurring_meeting_new)
+ ].compact
)
end
%>
diff --git a/modules/reporting/app/components/cost_reports/index_page_header_component.rb b/modules/reporting/app/components/cost_reports/index_page_header_component.rb
index aeddab9323a..232a18dab84 100644
--- a/modules/reporting/app/components/cost_reports/index_page_header_component.rb
+++ b/modules/reporting/app/components/cost_reports/index_page_header_component.rb
@@ -44,10 +44,12 @@ module CostReports
end
def breadcrumb_items
- [*([{ href: project_overview_path(@project.id), text: @project.name }] if @project.present?),
- { href: url_for({ controller: "cost_reports", action: :index, project_id: @project }),
- text: I18n.t(:cost_reports_title) },
- current_breadcrumb_element]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name } if @project.present?),
+ { href: url_for({ controller: "cost_reports", action: :index, project_id: @project }),
+ text: I18n.t(:cost_reports_title) },
+ current_breadcrumb_element
+ ].compact
end
def current_breadcrumb_element
diff --git a/modules/team_planner/app/views/team_planner/team_planner/new.html.erb b/modules/team_planner/app/views/team_planner/team_planner/new.html.erb
index e54051de008..36d5d6429b7 100644
--- a/modules/team_planner/app/views/team_planner/team_planner/new.html.erb
+++ b/modules/team_planner/app/views/team_planner/team_planner/new.html.erb
@@ -32,8 +32,10 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t("team_planner.label_new_team_planner") }
header.with_breadcrumbs(
- [*([href: project_overview_path(@project.id), text: @project.name] if @project),
- t("team_planner.label_new_team_planner")]
+ [
+ ({ href: project_overview_path(@project.id), text: @project.name} if @project),
+ t("team_planner.label_new_team_planner")
+ ].compact
)
end
%>