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

Exclude index pages from items used to generate the mobile back button

Henriette Darge9f9a74e4ef19
diff --git a/app/components/members/index_page_header_component.rb b/app/components/members/index_page_header_component.rb
index 18bd0019258..d13a3ef4498 100644
--- a/app/components/members/index_page_header_component.rb
+++ b/app/components/members/index_page_header_component.rb
@@ -39,7 +39,7 @@ class Members::IndexPageHeaderComponent < ApplicationComponent
def breadcrumb_items
[{ href: project_overview_path(@project.id), text: @project.name },
- { href: project_members_path(@project), text: t(:label_member_plural) },
+ { href: project_members_path(@project), text: I18n.t(:label_member_plural), skip_for_mobile: first_menu_item? },
current_breadcrumb_element]
end
@@ -74,6 +74,7 @@ class Members::IndexPageHeaderComponent < ApplicationComponent
def current_query
query_name = nil
+ query_href = nil
menu_header = nil
Members::Menu.new(project: @project, params:).menu_items.find do |section|
@@ -85,6 +86,14 @@ class Members::IndexPageHeaderComponent < ApplicationComponent
end
end
- { query_name:, menu_header: }
+ { query_name:, query_href:, menu_header: }
+ end
+
+ def first_menu_item?
+ if current_query.present?
+ return current_query[:query_href] == project_members_path(@project)
+ end
+
+ false
end
end
diff --git a/app/components/notifications/index_page_header_component.rb b/app/components/notifications/index_page_header_component.rb
index 6d6eb0f7c16..d82bd0be5a2 100644
--- a/app/components/notifications/index_page_header_component.rb
+++ b/app/components/notifications/index_page_header_component.rb
@@ -46,7 +46,7 @@ module Notifications
end
def breadcrumb_items
- [{ href: notifications_path, text: I18n.t("js.notifications.title") },
+ [{ href: notifications_path, text: I18n.t("js.notifications.title"), skip_for_mobile: first_menu_item? },
current_breadcrumb_element]
end
@@ -73,5 +73,9 @@ module Notifications
.new(params:, current_user: User.current)
.selected_menu_item
end
+
+ def first_menu_item?
+ current_item&.href == notifications_path
+ end
end
end
diff --git a/app/components/projects/index_page_header_component.rb b/app/components/projects/index_page_header_component.rb
index b0a202216b1..43474279bc1 100644
--- a/app/components/projects/index_page_header_component.rb
+++ b/app/components/projects/index_page_header_component.rb
@@ -112,7 +112,7 @@ class Projects::IndexPageHeaderComponent < ApplicationComponent
def breadcrumb_items
[
- { href: projects_path, text: t(:label_project_plural) },
+ { href: projects_path, text: t(:label_project_plural), skip_for_mobile: first_menu_item? },
current_breadcrumb_element
]
end
@@ -135,6 +135,11 @@ class Projects::IndexPageHeaderComponent < ApplicationComponent
.selected_menu_group
end
+ def first_menu_item?
+ current_item = current_section&.children&.select { |x| x.selected == true }&.first
+ current_item&.title == ::ProjectQueries::Static.query(ProjectQueries::Static::DEFAULT).name
+ end
+
def header_save_action(header:, message:, label:, href:, method: nil)
header.with_action_text { message }
diff --git a/app/components/projects/settings/index_page_header_component.html.erb b/app/components/projects/settings/index_page_header_component.html.erb
index 508c6416192..57ffb6b2482 100644
--- a/app/components/projects/settings/index_page_header_component.html.erb
+++ b/app/components/projects/settings/index_page_header_component.html.erb
@@ -4,7 +4,7 @@
header.with_breadcrumbs(
[
{ href: project_overview_path(@project.id), text: @project.name },
- { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") },
+ { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings"), skip_for_mobile: true },
t(:label_information_plural)
]
)
diff --git a/app/components/settings/project_phase_definitions/index_header_component.rb b/app/components/settings/project_phase_definitions/index_header_component.rb
index 2e20391173c..f0ffdd1984e 100644
--- a/app/components/settings/project_phase_definitions/index_header_component.rb
+++ b/app/components/settings/project_phase_definitions/index_header_component.rb
@@ -34,7 +34,7 @@ module Settings
def breadcrumbs_items
[
{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_project_custom_fields_path, text: t("label_project_plural") },
+ { href: admin_settings_project_custom_fields_path, text: t("label_project_plural"), skip_for_mobile: true },
t("settings.project_phase_definitions.heading")
]
end
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb
index 3333f06634a..b3f7956e902 100644
--- a/app/views/admin/index.html.erb
+++ b/app/views/admin/index.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t(:label_overview) }
header.with_breadcrumbs(
- [{ href: admin_index_path, text: t(:label_administration) },
+ [{ href: admin_index_path, text: t(:label_administration), skip_for_mobile: true },
t(:label_overview)]
)
end
diff --git a/app/views/admin/settings/aggregation_settings/show.html.erb b/app/views/admin/settings/aggregation_settings/show.html.erb
index 279ee7ce5ce..14308e9ff81 100644
--- a/app/views/admin/settings/aggregation_settings/show.html.erb
+++ b/app/views/admin/settings/aggregation_settings/show.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { t(:"menus.admin.aggregation") }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t(:label_administration) },
- { href: admin_settings_aggregation_path, text: t(:"menus.admin.mails_and_notifications") },
+ { href: admin_settings_aggregation_path, text: t(:"menus.admin.mails_and_notifications"), skip_for_mobile: true },
t(:"menus.admin.aggregation")]
)
end
diff --git a/app/views/admin/settings/api_settings/show.html.erb b/app/views/admin/settings/api_settings/show.html.erb
index e118f8e9fe3..1eeeba35ca0 100644
--- a/app/views/admin/settings/api_settings/show.html.erb
+++ b/app/views/admin/settings/api_settings/show.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { t(:label_api_access_key_type) }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_api_path, text: t("menus.admin.api_and_webhooks") },
+ { href: admin_settings_api_path, text: t("menus.admin.api_and_webhooks"), skip_for_mobile: true },
t(:label_api_access_key_type)]
)
end
diff --git a/app/views/admin/settings/authentication_settings/show.html.erb b/app/views/admin/settings/authentication_settings/show.html.erb
index d99a6730281..2b33e0ad750 100644
--- a/app/views/admin/settings/authentication_settings/show.html.erb
+++ b/app/views/admin/settings/authentication_settings/show.html.erb
@@ -55,7 +55,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { t("authentication.login_and_registration") }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t(:label_administration) },
- { href: admin_settings_authentication_path, text: t(:label_authentication) },
+ { href: admin_settings_authentication_path, text: t(:label_authentication), skip_for_mobile: true },
t("authentication.login_and_registration")]
)
render_tab_header_nav(header, tabs)
diff --git a/app/views/admin/settings/general_settings/show.html.erb b/app/views/admin/settings/general_settings/show.html.erb
index ed36df515ca..a17939c97de 100644
--- a/app/views/admin/settings/general_settings/show.html.erb
+++ b/app/views/admin/settings/general_settings/show.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { t(:label_general) }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_general_path, text: t(:label_system_settings) },
+ { href: admin_settings_general_path, text: t(:label_system_settings), skip_for_mobile: true },
t(:label_general)]
)
end
diff --git a/app/views/admin/settings/users_settings/show.html.erb b/app/views/admin/settings/users_settings/show.html.erb
index 7ca9d92401d..fece879f2ed 100644
--- a/app/views/admin/settings/users_settings/show.html.erb
+++ b/app/views/admin/settings/users_settings/show.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { t(:label_user_settings) }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_users_path, text: t(:label_user_and_permission) },
+ { href: admin_settings_users_path, text: t(:label_user_and_permission), skip_for_mobile: true },
t(:label_user_settings)]
)
end
diff --git a/app/views/admin/settings/work_packages_general/show.html.erb b/app/views/admin/settings/work_packages_general/show.html.erb
index 88b6713f3c4..b662cea990c 100644
--- a/app/views/admin/settings/work_packages_general/show.html.erb
+++ b/app/views/admin/settings/work_packages_general/show.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title { t(:label_general) }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_work_packages_general_path, text: t(:label_work_package_plural) },
+ { href: admin_settings_work_packages_general_path, text: t(:label_work_package_plural), skip_for_mobile: true },
t(:label_general)]
)
end
diff --git a/app/views/admin/settings/working_days_and_hours_settings/show.html.erb b/app/views/admin/settings/working_days_and_hours_settings/show.html.erb
index 410b88269bc..ddebe53fef9 100644
--- a/app/views/admin/settings/working_days_and_hours_settings/show.html.erb
+++ b/app/views/admin/settings/working_days_and_hours_settings/show.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_title(test_selector: "op-working-days-admin-settings--title") { t(:label_working_days_and_hours) }
header.with_breadcrumbs(
[{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_working_days_and_hours_path, text: t(:label_calendars_and_dates) },
+ { href: admin_settings_working_days_and_hours_path, text: t(:label_calendars_and_dates), skip_for_mobile: true },
t(:label_working_days_and_hours)]
)
end
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index 442d0ce72e2..fb93aaf021e 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t(:label_profile) }
header.with_breadcrumbs(
- [{ href: my_account_path, text: t(:label_my_account) },
+ [{ href: my_account_path, text: t(:label_my_account), skip_for_mobile: true },
t(:label_profile)]
)
end
diff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erb
index c84bc9b26f0..5aa4aa5d36b 100644
--- a/app/views/wiki/index.html.erb
+++ b/app/views/wiki/index.html.erb
@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_breadcrumbs(
[
{ href: project_overview_path(@project.id), text: @project.name },
- { href: url_for({ controller: "/wiki", action: "index", project_id: @project.identifier, id: @related_page }), text: t("activerecord.models.wiki") },
+ { href: url_for({ controller: "/wiki", action: "index", project_id: @project.identifier, id: @related_page }), text: t("activerecord.models.wiki"), skip_for_mobile: true },
t(:label_wiki_toc)
]
)
diff --git a/modules/costs/app/views/admin/costs_settings/show.html.erb b/modules/costs/app/views/admin/costs_settings/show.html.erb
index f8472a3b89a..c3408c3e163 100644
--- a/modules/costs/app/views/admin/costs_settings/show.html.erb
+++ b/modules/costs/app/views/admin/costs_settings/show.html.erb
@@ -35,7 +35,7 @@ See COPYRIGHT and LICENSE files for more details.
header.with_breadcrumbs(
[
{ href: admin_index_path, text: t("label_administration") },
- { href: admin_costs_settings_path, text: t(:project_module_costs) },
+ { href: admin_costs_settings_path, text: t(:project_module_costs), skip_for_mobile: true },
t(:label_defaults)
]
)
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 931a75ab07a..d223b8370d1 100644
--- a/modules/meeting/app/components/meetings/index_page_header_component.rb
+++ b/modules/meeting/app/components/meetings/index_page_header_component.rb
@@ -49,7 +49,7 @@ module Meetings
[
({ 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) },
+ text: I18n.t(:label_meeting_plural), skip_for_mobile: first_menu_item? },
current_breadcrumb_element
].compact
end
@@ -81,5 +81,9 @@ module Meetings
.new(project: @project, params: params.merge(current_href: request.path))
.selected_menu_item
end
+
+ def first_menu_item?
+ current_item&.href == (@project.present? ? project_meetings_path(@project.identifier) : meetings_path)
+ end
end
end
diff --git a/modules/overviews/app/views/overviews/overviews/show.html.erb b/modules/overviews/app/views/overviews/overviews/show.html.erb
index 1460a8e5842..c51821e4eee 100644
--- a/modules/overviews/app/views/overviews/overviews/show.html.erb
+++ b/modules/overviews/app/views/overviews/overviews/show.html.erb
@@ -8,7 +8,7 @@
header.with_title(variant: :medium) { t("overviews.label") }
header.with_breadcrumbs(
[
- { href: project_path(@project), text: @project.name },
+ { href: project_path(@project), text: @project.name, skip_for_mobile: true },
t("overviews.label")
]
)
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 232a18dab84..7b6fc9e582f 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
@@ -39,15 +39,11 @@ module CostReports
@user = User.current
end
- def page_title
- I18n.t(:label_meeting_plural)
- 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) },
+ text: I18n.t(:cost_reports_title), skip_for_mobile: current_section && current_section.header.present? },
current_breadcrumb_element
].compact
end
diff --git a/modules/storages/app/views/storages/admin/storages/index.html.erb b/modules/storages/app/views/storages/admin/storages/index.html.erb
index 24da22ddbb9..e0cd0848a6b 100644
--- a/modules/storages/app/views/storages/admin/storages/index.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/index.html.erb
@@ -11,7 +11,7 @@ end %>
<% header.with_title { t("external_file_storages") } %>
<% header.with_description { t("storages.page_titles.file_storages.subtitle") } %>
<% header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_storages_path, text: t("project_module_storages") },
+ { href: admin_settings_storages_path, text: t("project_module_storages"), skip_for_mobile: true },
t("external_file_storages")]) %>
<% end %>