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

[#53672] Hide attachments in Files tab

Pavel Balashouad88c1f13620
diff --git a/app/components/admin/attachments_settings_header_component.html.erb b/app/components/admin/attachments_settings_header_component.html.erb
new file mode 100644
index 00000000000..b1debfad5ce
--- /dev/null
+++ b/app/components/admin/attachments_settings_header_component.html.erb
@@ -0,0 +1,53 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+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 { @title } %>
+ <% header.with_breadcrumbs([{ href: admin_index_path, text: t("label_administration") },
+ { href: admin_settings_storages_path, text: t("project_module_storages") },
+ @title]) %>
+<% 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 { "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") }
+ end
+ end
+end
+%>
diff --git a/app/components/admin/virus_scanning/index_page_header_component.rb b/app/components/admin/attachments_settings_header_component.rb
similarity index 72%
rename from app/components/admin/virus_scanning/index_page_header_component.rb
rename to app/components/admin/attachments_settings_header_component.rb
index 1ccf9648cb6..f9a955648a2 100644
--- a/app/components/admin/virus_scanning/index_page_header_component.rb
+++ b/app/components/admin/attachments_settings_header_component.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-# -- copyright
+#-- copyright
# OpenProject is an open source project management software.
-# Copyright (C) 2010-2023 the OpenProject GmbH
+# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@@ -26,17 +26,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-# ++
+#++
-module Admin::VirusScanning
- # rubocop:disable OpenProject/AddPreviewForViewComponent
- class IndexPageHeaderComponent < ApplicationComponent
- include ApplicationHelper
-
- def breadcrumb_items
- [{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_attachments_path, text: t("attributes.attachments") },
- t("settings.antivirus.title")]
+module Admin
+ class AttachmentsSettingsHeaderComponent < ApplicationComponent
+ def initialize(title:, selected:)
+ raise 'selected must 1, 2 or 3' if [1, 2, 3].exclude?(selected)
+ @title = title
+ @selected = selected
end
end
end
diff --git a/app/components/admin/quarantined_attachments/index_page_header_component.html.erb b/app/components/admin/quarantined_attachments/index_page_header_component.html.erb
deleted file mode 100644
index 994462d0815..00000000000
--- a/app/components/admin/quarantined_attachments/index_page_header_component.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%=
- render(Primer::OpenProject::PageHeader.new) do |header|
- header.with_title { t('antivirus_scan.quarantined_attachments.title') }
- header.with_breadcrumbs(breadcrumb_items)
- end
-%>
diff --git a/app/components/admin/virus_scanning/index_page_header_component.html.erb b/app/components/admin/virus_scanning/index_page_header_component.html.erb
deleted file mode 100644
index 44a4a26f3f3..00000000000
--- a/app/components/admin/virus_scanning/index_page_header_component.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%= render(Primer::OpenProject::PageHeader.new) do |header| %>
- <% header.with_title do %>
- <%= t('settings.antivirus.title') %>
- <% end %>
- <% header.with_breadcrumbs(breadcrumb_items)%>
-<% end %>
diff --git a/app/controllers/admin/attachments/quarantined_attachments_controller.rb b/app/controllers/admin/attachments/quarantined_attachments_controller.rb
index c3fba094ea5..2a7c0b8594d 100644
--- a/app/controllers/admin/attachments/quarantined_attachments_controller.rb
+++ b/app/controllers/admin/attachments/quarantined_attachments_controller.rb
@@ -35,7 +35,7 @@ module Admin
before_action :find_attachment, only: %i[destroy]
- menu_item :attachment_quarantine
+ menu_item :attachments
def index; end
diff --git a/app/controllers/admin/settings/attachments_settings_controller.rb b/app/controllers/admin/settings/attachments_settings_controller.rb
index 5b2440de78b..8ab3bb5e6f4 100644
--- a/app/controllers/admin/settings/attachments_settings_controller.rb
+++ b/app/controllers/admin/settings/attachments_settings_controller.rb
@@ -28,10 +28,12 @@
module Admin::Settings
class AttachmentsSettingsController < ::Admin::SettingsController
- menu_item :attachments_settings
+ menu_item :attachments
- def default_breadcrumb
- t(:"attributes.attachments")
+ def default_breadcrumb; end
+
+ def show_local_breadcrumb
+ false
end
def settings_params
diff --git a/app/controllers/admin/settings/virus_scanning_settings_controller.rb b/app/controllers/admin/settings/virus_scanning_settings_controller.rb
index 047391403b7..63dcf7cc92c 100644
--- a/app/controllers/admin/settings/virus_scanning_settings_controller.rb
+++ b/app/controllers/admin/settings/virus_scanning_settings_controller.rb
@@ -28,7 +28,7 @@
module Admin::Settings
class VirusScanningSettingsController < ::Admin::SettingsController
- menu_item :virus_scanning_settings
+ menu_item :attachments
before_action :require_ee
before_action :check_clamav, only: %i[update], if: -> { scan_enabled? }
@@ -36,6 +36,7 @@ module Admin::Settings
def show_local_breadcrumb
false
end
+
def av_form
selected = params.dig(:settings, :antivirus_scan_mode)&.to_sym || :disabled
@@ -87,7 +88,7 @@ module Admin::Settings
def rescan_files
flash[:notice] = t("settings.antivirus.remaining_rescanned_files",
- file_count: t(:label_x_files, count: Attachment.status_uploaded.count))
+ file_count: t(:label_x_files, count: Attachment.status_uploaded.count))
Attachment.status_uploaded.update_all(status: :rescan)
job = Attachments::VirusRescanJob.perform_later
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 94e4281e5ae..9537886bbb2 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -91,6 +91,10 @@ class ProjectsController < ApplicationController
hide_project_in_layout
end
+ def set_hide_attachments
+ @project.update_column(:hide_attachments, params["value"])
+ end
+
private
def has_managed_project_folders?(project)
diff --git a/app/views/admin/attachments/quarantined_attachments/index.html.erb b/app/views/admin/attachments/quarantined_attachments/index.html.erb
index adc11766647..37e16a02860 100644
--- a/app/views/admin/attachments/quarantined_attachments/index.html.erb
+++ b/app/views/admin/attachments/quarantined_attachments/index.html.erb
@@ -1,5 +1,37 @@
-<% html_title t('antivirus_scan.quarantined_attachments.title') %>
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 the OpenProject GmbH
-<%= render ::Admin::QuarantinedAttachments::IndexPageHeaderComponent.new %>
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<%=
+ render(Admin::AttachmentsSettingsHeaderComponent.new(
+ title: t('antivirus_scan.quarantined_attachments.title'),
+ selected: 3,
+ ))
+%>
<%= render ::Admin::QuarantinedAttachments::TableComponent.new(rows: @attachments) %>
diff --git a/app/views/admin/settings/attachments_settings/show.html.erb b/app/views/admin/settings/attachments_settings/show.html.erb
index 2b4cac263e6..1d8a2116e9e 100644
--- a/app/views/admin/settings/attachments_settings/show.html.erb
+++ b/app/views/admin/settings/attachments_settings/show.html.erb
@@ -26,7 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= toolbar title: t(:'attributes.attachments') %>
+
+<%=
+ render(Admin::AttachmentsSettingsHeaderComponent.new(
+ title: t(:"attributes.attachments"),
+ selected: 1,
+ ))
+%>
<%= styled_form_tag(
admin_settings_attachments_path,
@@ -45,6 +51,9 @@ See COPYRIGHT and LICENSE files for more details.
) %>
</div>
</div>
+ <div class="form--field">
+ <%= setting_check_box :hide_attachments, container_class: '-slim' %>
+ </div>
</section>
<%= styled_button_tag t(:button_save), class: '-primary -with-icon icon-checkmark' %>
<% end %>
diff --git a/app/views/admin/settings/virus_scanning_settings/show.html.erb b/app/views/admin/settings/virus_scanning_settings/show.html.erb
index b036a72431b..8181473af8e 100644
--- a/app/views/admin/settings/virus_scanning_settings/show.html.erb
+++ b/app/views/admin/settings/virus_scanning_settings/show.html.erb
@@ -26,9 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-<% html_title t(:label_administration), t('settings.antivirus.title') %>
-<%= render ::Admin::VirusScanning::IndexPageHeaderComponent.new %>
+<%=
+ render(Admin::AttachmentsSettingsHeaderComponent.new(
+ title: t('settings.antivirus.title'),
+ selected: 2
+ ))
+%>
<%= styled_form_tag(
admin_settings_virus_scanning_path,
diff --git a/config/constants/settings/definition.rb b/config/constants/settings/definition.rb
index 3777da14c0d..e0655a0fc1a 100644
--- a/config/constants/settings/definition.rb
+++ b/config/constants/settings/definition.rb
@@ -736,6 +736,12 @@ module Settings
default: "",
writable: false
},
+ hide_attachments: {
+ description: "Hide attachments by default.",
+ format: :boolean,
+ default: false,
+ writable: true
+ },
https: {
description: "Set assumed connection security for the Rails processes",
format: :boolean,
@@ -761,14 +767,14 @@ module Settings
default: 3
},
httpx_operation_timeout: {
- description: '',
+ description: "",
format: :float,
writable: false,
allowed: (0..),
default: 10
},
httpx_request_timeout: {
- description: '',
+ description: "",
format: :float,
writable: false,
allowed: (0..),
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index da27d59089c..c71ea9bea60 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -374,34 +374,6 @@ Redmine::MenuManager.map :admin_menu do |menu|
icon: "help2",
if: Proc.new { User.current.allowed_globally?(:edit_attribute_help_texts) }
- menu.push :attachments,
- { controller: "/admin/settings/attachments_settings", action: :show },
- caption: :"attributes.attachments",
- icon: "attachment",
- if: Proc.new { User.current.admin? }
-
- menu.push :attachments_settings,
- { controller: "/admin/settings/attachments_settings", action: :show },
- if: Proc.new { User.current.admin? },
- caption: :label_setting_plural,
- parent: :attachments
-
- menu.push :virus_scanning_settings,
- { controller: "/admin/settings/virus_scanning_settings", action: :show },
- caption: :"settings.antivirus.title",
- parent: :attachments,
- enterprise_feature: "virus_scanning",
- if: Proc.new { User.current.admin? }
-
- menu.push :attachment_quarantine,
- { controller: "/admin/attachments/quarantined_attachments", action: :index },
- caption: :"antivirus_scan.quarantined_attachments.title",
- parent: :attachments,
- if: Proc.new {
- User.current.admin? &&
- (EnterpriseToken.allows_to?(:virus_scanning) || Attachment.status_quarantined.any?)
- }
-
menu.push :enumerations,
{ controller: "/enumerations" },
if: Proc.new { User.current.admin? },
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 0a37a04c8ed..c9b6d119502 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -3058,6 +3058,7 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}
setting_app_subtitle: "Application subtitle"
setting_app_title: "Application title"
setting_attachment_max_size: "Attachment max. size"
+ setting_hide_attachments: "Hide attachements by default"
setting_antivirus_scan_mode: "Scan mode"
setting_antivirus_scan_action: "Infected file action"
setting_autofetch_changesets: "Autofetch repository changes"
diff --git a/config/routes.rb b/config/routes.rb
index cb7d74789d1..144c1370435 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -220,6 +220,7 @@ Rails.application.routes.draw do
# Destroy uses a get request to prompt the user before the actual DELETE request
get :destroy_info, as: "confirm_destroy"
+ post :set_hide_attachments
end
resources :versions, only: %i[new create] do
diff --git a/app/components/admin/quarantined_attachments/index_page_header_component.rb b/db/migrate/20240424160513_add_hide_attachments_to_projects.rb
similarity index 70%
rename from app/components/admin/quarantined_attachments/index_page_header_component.rb
rename to db/migrate/20240424160513_add_hide_attachments_to_projects.rb
index ed0adf5629a..7adaf9754d0 100644
--- a/app/components/admin/quarantined_attachments/index_page_header_component.rb
+++ b/db/migrate/20240424160513_add_hide_attachments_to_projects.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-# -- copyright
+#-- copyright
# OpenProject is an open source project management software.
-# Copyright (C) 2010-2023 the OpenProject GmbH
+# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@@ -26,17 +26,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-# ++
+#++
-module Admin::QuarantinedAttachments
- # rubocop:disable OpenProject/AddPreviewForViewComponent
- class IndexPageHeaderComponent < ApplicationComponent
- include ApplicationHelper
-
- def breadcrumb_items
- [{ href: admin_index_path, text: t("label_administration") },
- { href: admin_settings_attachments_path, text: t("attributes.attachments") },
- t("antivirus_scan.quarantined_attachments.title")]
- end
+class AddHideAttachmentsToProjects < ActiveRecord::Migration[7.1]
+ def change
+ add_column :projects, :hide_attachments, :boolean, default: false
end
end
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.html
index d6fbd561885..ed9b2fba0f5 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.html
@@ -4,6 +4,7 @@
<section
class="op-tab-content--tab-section"
[ngClass]="{ 'op-tab-content--tab-section_no-header': (showAttachmentHeader$ | async) === false }"
+ *ngIf="!this.workPackage.hideAttachments"
data-test-selector="op-tab-content--tab-section"
>
<div
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
index 9376db1e35d..888b1c95ed7 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
@@ -27,7 +27,7 @@
//++
import { Injector } from '@angular/core';
-import { combineLatest, Observable } from 'rxjs';
+import { combineLatest, Observable, BehaviorSubject } from 'rxjs';
import { map } from 'rxjs/operators';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
@@ -43,7 +43,7 @@ export function workPackageFilesCount(
return combineLatest(
[
- attachmentService.collection(workPackage.$links.attachments.href || ''),
+ workPackage.hideAttachments ? new BehaviorSubject([]) : attachmentService.collection(workPackage.$links.attachments.href || ''),
fileLinkService.collection(workPackage.$links.fileLinks?.href || ''),
],
).pipe(
diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rb
index b265ac2761d..eff368af858 100644
--- a/lib/api/v3/work_packages/work_package_representer.rb
+++ b/lib/api/v3/work_packages/work_package_representer.rb
@@ -468,6 +468,13 @@ module API
status_id && status.is_readonly?
end
+ property :hide_attachments,
+ writable: false,
+ render_nil: false,
+ getter: ->(*) do
+ project.hide_attachments || Setting.hide_attachments
+ end
+
associated_resource :category
associated_resource :type
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index 4ad8567e81e..7c7983b3d81 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -50,13 +50,8 @@ class Storages::Admin::StoragesController < ApplicationController
before_action :ensure_valid_provider_type_selected, only: %i[select_provider]
before_action :require_ee_token_for_one_drive, only: %i[select_provider]
- # menu_item is defined in the Redmine::MenuManager::MenuController
- # module, included from ApplicationController.
- # The menu item is defined in the engine.rb
- menu_item :storages_admin_settings
+ menu_item :external_file_storages
- # Index page with a list of Storages objects
- # Called by: Global app/config/routes.rb to serve Web page
def index
@storages = Storages::Storage.all
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 11f1b119213..b2c6cd63a98 100644
--- a/modules/storages/app/views/storages/admin/storages/index.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/index.html.erb
@@ -1,4 +1,3 @@
-<!-- Standard Ruby view, please see the controller for comments -->
<% html_title t(:label_administration), t("project_module_storages") %>
<% button_block = lambda do |button|
@@ -7,11 +6,12 @@
I18n.t("storages.label_storage")
end %>
-<%= render(Primer::OpenProject::PageHeader.new) do |header| %>
- <% header.with_title { t("project_module_storages") } %>
+<%= render(Primer::OpenProject::PageHeader.new(border_bottom: 0)) do |header| %>
+ <% 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") },
- t("project_module_storages")]) %>
+ { href: admin_settings_storages_path, text: t("project_module_storages") },
+ t("external_file_storages")]) %>
<%= header.with_action_menu(menu_arguments: { test_selector: 'storages-select-provider-action-menu',
anchor_align: :end },
diff --git a/modules/storages/app/views/storages/project_settings/index.html.erb b/modules/storages/app/views/storages/project_settings/index.html.erb
index ab04939601b..a193324174b 100644
--- a/modules/storages/app/views/storages/project_settings/index.html.erb
+++ b/modules/storages/app/views/storages/project_settings/index.html.erb
@@ -29,21 +29,51 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title t(:label_administration), t("project_module_storages") %>
-<% if ::Storages::Storage.any? %>
- <%= toolbar title: t("storages.page_titles.project_settings.index") do %>
-
- <li class="toolbar-item">
- <%= link_to new_project_settings_project_storage_path,
- { class: 'button -primary',
- aria: { label: t(:'storages.label_new_storage') },
- title: t(:'storages.label_new_storage') } do %>
- <%= op_icon('button--icon icon-add') %>
- <span class="button--text"><%= ::Storages::Storage.model_name.human %></span>
- <% end %>
- </li>
- <% end %>
-
- <%= render(::Storages::ProjectStorages::TableComponent.new(rows: @project_storages)) %>
-<% else %>
- <%= render partial: '/storages/project_settings/toast_no_storage_set_up' %>
-<% end %>
+<%= render(Primer::OpenProject::PageHeader.new(border_bottom: 0)) do |header|
+ header.with_title { t("project_module_storages") }
+ header.with_breadcrumbs([{ href: project_settings_general_path, text: t("label_project_settings") },
+ t("project_module_storages")])
+ header.with_action_button(tag: :a,
+ href: new_project_settings_project_storage_path,
+ scheme: :primary,
+ mobile_icon: :plus,
+ mobile_label: t(:'storages.label_storage'),
+ size: :medium,
+ aria: { label: t(:'storages.label_new_storage') },
+ title: t(:'storages.label_new_storage')) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ t(:'storages.label_storage')
+ end
+end
+%>
+
+<%= render(Primer::Alpha::TabPanels.new(label: "label", align: :left)) do |component|
+ component.with_tab(selected: true, id: "tab-1") do |tab|
+ tab.with_text { t(:"external_file_storages") }
+ tab.with_panel {
+ render(::Storages::ProjectStorages::TableComponent.new(rows: @project_storages))
+ }
+ end
+ component.with_tab(selected: false, id: "tab-2") do |tab|
+ tab.with_text { t(:"attributes.attachments") }
+ tab.with_panel {
+ render(Primer::OpenProject::FlexLayout.new) do |l|
+ l.with_row(flex_layout: true) do |row|
+ row.with_column do
+ render(Primer::Beta::Text.new) {"Show attachments in the work packages files tab"}
+ end
+ row.with_column do
+ render(Primer::Alpha::ToggleSwitch.new(src: set_hide_attachments_project_path(@project),
+ csrf_token: form_authenticity_token,
+ status_label_position: :end,
+ checked: @project.hide_attachments,))
+ end
+ end
+ l.with_row do
+ render(Primer::Beta::Text.new) {"Deactivating this option will only hide the attachments list. Files uploaded with the help of the rich text editor will still be uploaded to the attachments internal storage."}
+ end
+ end
+ }
+ end
+end
+%>
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index b840047e8a9..a496d7b85cb 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -40,6 +40,7 @@ en:
api_v3:
errors:
too_many_elements_created_at_once: Too many elements created at once. Expected %{max} at most, got %{actual}.
+ external_file_storages: External file storages
permission_create_files: 'External Storage: Create files'
permission_delete_files: 'External Storage: Delete files'
permission_header_for_project_module_storages: Automatically managed project folders
@@ -49,7 +50,7 @@ en:
permission_share_files: 'External Storage: Share files'
permission_view_file_links: View file links
permission_write_files: 'External Storage: Write files'
- project_module_storages: File storages
+ project_module_storages: Files
storages:
buttons:
complete_without_setup: Complete without it
diff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rb
index 3346fa4035f..d296f37dfc2 100644
--- a/modules/storages/lib/open_project/storages/engine.rb
+++ b/modules/storages/lib/open_project/storages/engine.rb
@@ -163,12 +163,26 @@ module OpenProject::Storages
# Add a "storages_admin_settings" to the admin_menu with the specified link,
# condition ("if:"), caption and icon.
menu :admin_menu,
- :storages_admin_settings,
+ :files,
{ controller: "/storages/admin/storages", action: :index },
if: Proc.new { User.current.admin? },
caption: :project_module_storages,
icon: "hosting"
+ menu :admin_menu,
+ :external_file_storages,
+ { controller: "/storages/admin/storages", action: :index },
+ if: Proc.new { User.current.admin? },
+ caption: :external_file_storages,
+ parent: :files
+
+ menu :admin_menu,
+ :attachments,
+ { controller: "/admin/settings/attachments_settings", action: :show },
+ if: Proc.new { User.current.admin? },
+ caption: :"attributes.attachments",
+ parent: :files
+
menu :project_menu,
:settings_project_storages,
{ controller: "/storages/admin/project_storages", action: "index" },