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

[#55189] Replace tabs with PageHeader tabs in Files Module

Pavel Balashou4b4bce2fe5ad
diff --git a/app/components/admin/attachments_settings_header_component.html.erb b/app/components/admin/attachments_settings_header_component.html.erb
index 52ccc429b46..9374b9a49ad 100644
--- a/app/components/admin/attachments_settings_header_component.html.erb
+++ b/app/components/admin/attachments_settings_header_component.html.erb
@@ -29,25 +29,23 @@ See COPYRIGHT and LICENSE files for more details.
<% helpers.html_title t(:label_administration), @title %>
-<%= render(Primer::OpenProject::PageHeader.new(border_bottom: 0)) do |header| %>
- <% header.with_title { t(:"attributes.attachments") } %>
- <% header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_storages_path, text: t("project_module_storages") },
- t(:"attributes.attachments")]) %>
-<% end %>
-
-<%= render(Primer::Alpha::TabNav.new(label: "label")) do |component|
- component.with_tab(selected: @selected == 1, href: admin_settings_attachments_path) do |tab|
- tab.with_text { t("settings.general") }
- end
- component.with_tab(selected: @selected == 2, href: admin_settings_virus_scanning_path) do |tab|
- tab.with_icon(icon: :"op-enterprise-addons") unless EnterpriseToken.allows_to?("virus_scanning")
- tab.with_text { t(:"settings.antivirus.title") }
- end
- if User.current.admin? && (EnterpriseToken.allows_to?(:virus_scanning) || Attachment.status_quarantined.any?)
- component.with_tab(selected: @selected == 3, href: admin_quarantined_attachments_path) do |tab|
- tab.with_text { t(:"antivirus_scan.quarantined_attachments.title") }
+<%= render(Primer::OpenProject::PageHeader.new(border_bottom: 0)) do |header|
+ header.with_title { t(:"attributes.attachments") }
+ header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_storages_path, text: t("project_module_storages") },
+ t(:"attributes.attachments")])
+ header.with_tab_nav(label: nil) do |tab_nav|
+ tab_nav.with_tab(selected: @selected == 1, href: admin_settings_attachments_path) do |tab|
+ tab.with_text { t("settings.general") }
+ end
+ tab_nav.with_tab(selected: @selected == 2, href: admin_settings_virus_scanning_path) do |tab|
+ tab.with_icon(icon: :"op-enterprise-addons") unless EnterpriseToken.allows_to?("virus_scanning")
+ tab.with_text { t(:"settings.antivirus.title") }
+ end
+ if User.current.admin? && (EnterpriseToken.allows_to?(:virus_scanning) || Attachment.status_quarantined.any?)
+ tab_nav.with_tab(selected: @selected == 3, href: admin_quarantined_attachments_path) do |tab|
+ tab.with_text { t(:"antivirus_scan.quarantined_attachments.title") }
+ end
end
end
-end
-%>
+end %>
diff --git a/modules/storages/app/views/storages/project_settings/attachments.html.erb b/modules/storages/app/views/storages/project_settings/attachments.html.erb
index 27290a91a05..3d41c9e4b86 100644
--- a/modules/storages/app/views/storages/project_settings/attachments.html.erb
+++ b/modules/storages/app/views/storages/project_settings/attachments.html.erb
@@ -44,15 +44,13 @@ See COPYRIGHT and LICENSE files for more details.
button.with_leading_visual_icon(icon: :plus)
t(:'storages.label_storage')
end
-end
-%>
-
-<%= render(Primer::Alpha::TabNav.new(label: nil)) do |component|
- component.with_tab(selected: false, href: external_file_storages_project_settings_project_storages_path) do |tab|
- tab.with_text { t(:"external_file_storages") }
- end
- component.with_tab(selected: true, href: attachments_project_settings_project_storages_path) do |tab|
- tab.with_text { t(:"attributes.attachments") }
+ header.with_tab_nav(label: nil) do |tab_nav|
+ tab_nav.with_tab(selected: false, href: external_file_storages_project_settings_project_storages_path) do |tab|
+ tab.with_text { t(:"external_file_storages") }
+ end
+ tab_nav.with_tab(selected: true, href: attachments_project_settings_project_storages_path) do |tab|
+ tab.with_text { t(:"attributes.attachments") }
+ end
end
end
%>
diff --git a/modules/storages/app/views/storages/project_settings/external_file_storages.html.erb b/modules/storages/app/views/storages/project_settings/external_file_storages.html.erb
index b98050d4f73..dead53328da 100644
--- a/modules/storages/app/views/storages/project_settings/external_file_storages.html.erb
+++ b/modules/storages/app/views/storages/project_settings/external_file_storages.html.erb
@@ -44,15 +44,13 @@ See COPYRIGHT and LICENSE files for more details.
button.with_leading_visual_icon(icon: :plus)
t(:'storages.label_storage')
end
-end
-%>
-
-<%= render(Primer::Alpha::TabNav.new(label: nil)) do |component|
- component.with_tab(selected: true, href: external_file_storages_project_settings_project_storages_path) do |tab|
- tab.with_text { t(:"external_file_storages") }
- end
- component.with_tab(selected: false, href: attachments_project_settings_project_storages_path) do |tab|
- tab.with_text { t(:"attributes.attachments") }
+ header.with_tab_nav(label: nil) do |tab_nav|
+ tab_nav.with_tab(selected: true, href: external_file_storages_project_settings_project_storages_path) do |tab|
+ tab.with_text { t(:"external_file_storages") }
+ end
+ tab_nav.with_tab(selected: false, href: attachments_project_settings_project_storages_path) do |tab|
+ tab.with_text { t(:"attributes.attachments") }
+ end
end
end
%>