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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix settings menu and edge cases
Wieland Lindenthalc62318860e7f
diff --git a/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb b/modules/storages/app/controllers/storages/admin/projects_storages_controller.rbindex 86d01faaaf1..553ea86f4a7 100644--- a/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb@@ -28,14 +28,12 @@# See COPYRIGHT and LICENSE files for more details.#++-class Storages::Admin::ProjectsStoragesController < ApplicationController- layout 'admin'+class Storages::Admin::ProjectsStoragesController < Projects::SettingsControllerbefore_action :find_optional_projectbefore_action :authorizemenu_item :settings_projects_storages-def index@projects_storages = Storages::ProjectStorage.where(project: @project).includes(:storage)@@ -44,7 +42,7 @@ class Storages::Admin::ProjectsStoragesController < ApplicationControllerdef new@project_storage = Storages::ProjectStorage.new(project: @project)- @available_storages = Storages::Storage.where.not(storage_id: @project.projects_storages.pluck(:storage_id))+ @available_storages = Storages::Storage.where.not(id: @project.projects_storages.pluck(:storage_id))render '/storages/project_settings/new'end@@ -66,10 +64,6 @@ class Storages::Admin::ProjectsStoragesController < ApplicationControllerredirect_to project_settings_projects_storages_pathend- current_menu_item %i[index new] do- :settings_projects_storages- end-privatedef permitted_project_storage_paramsdiff --git a/modules/storages/app/controllers/storages/projects/settings_controller.rb b/modules/storages/app/controllers/storages/projects/settings_controller.rbdeleted file mode 100644index 8fd35fd7b04..00000000000--- a/modules/storages/app/controllers/storages/projects/settings_controller.rb+++ /dev/null@@ -1,45 +0,0 @@-#-- encoding: UTF-8--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2021 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.-#++--class Storages::Projects::SettingsController < Projects::SettingsController- menu_item :project_settings_storages-- def index- # tbd- end-- def create- # tbd- end-- def delete- # tbd- end-enddiff --git a/modules/storages/app/views/storages/project_settings/_toast_no_storage_set_up.html.erb b/modules/storages/app/views/storages/project_settings/_toast_no_storage_set_up.html.erbindex 2496c745447..23d2856b152 100644--- a/modules/storages/app/views/storages/project_settings/_toast_no_storage_set_up.html.erb+++ b/modules/storages/app/views/storages/project_settings/_toast_no_storage_set_up.html.erb@@ -1,7 +1,7 @@<div class="op-toast -info"><div class="op-toast--content"><p>- <strong><%= t(:'storages.instruction.no_storage_set_up') %></strong>+ <strong><%= t(:'storages.instructions.no_storage_set_up') %></strong></p><p><%= t(:"storages.instructions.setting_up_additional_storages") %>diff --git a/modules/storages/app/views/storages/project_settings/index.html.erb b/modules/storages/app/views/storages/project_settings/index.html.erbindex 370ecd4361e..7878c10dd33 100644--- a/modules/storages/app/views/storages/project_settings/index.html.erb+++ b/modules/storages/app/views/storages/project_settings/index.html.erb@@ -1,7 +1,7 @@<% html_title t(:label_administration), t("project_module_storages") %><% if ::Storages::Storage.any? %>- <%= toolbar title: t("project_module_storages") do %>+ <%= toolbar title: t("storages.page_titles.project_settings.index") do %><li class="toolbar-item"><%= link_to new_project_settings_projects_storage_path,diff --git a/modules/storages/app/views/storages/project_settings/new.html.erb b/modules/storages/app/views/storages/project_settings/new.html.erbindex 01ccd37e656..ca1ff1e6d29 100644--- a/modules/storages/app/views/storages/project_settings/new.html.erb+++ b/modules/storages/app/views/storages/project_settings/new.html.erb@@ -1,24 +1,39 @@<% html_title t(:label_administration), t("project_module_storages") %><% local_assigns[:additional_breadcrumb] = t('storages.label_new_storage') %>-<%= toolbar title: t("storages.label_new_storage") %>+<%= toolbar title: t("storages.page_titles.project_settings.new") %><%= labelled_tabular_form_for @project_storage, url: project_settings_projects_storages_path do |f| -%><%= error_messages_for_contract @project_storage, @errors %><section class="form--section">- <div class="form--field -required">- <%= f.select :storage_id,- @available_storages.map { |storage| ["#{storage.name} (#{storage.provider_type})", storage.id] },- selected: @available_storages.first&.id.to_s,- container_class: '-slim' %>- <% if User.current.admin? %>- <span class="form--field-instructions">- <%= t(:"storages.instructions.setting_up_additional_storages") %>- <%= link_to "#{t(:label_administration)} / #{t(:project_module_storages)}", controller: '/storages/admin/storages', action: :index %>.- </span>- <% end %>- </div>+ <% if @available_storages.any? %>+ <div class="form--field -required">+ <%= f.select :storage_id,+ @available_storages.map { |storage| ["#{storage.name} (#{storage.provider_type})", storage.id] },+ selected: @available_storages.first.id.to_s,+ container_class: '-slim' %>+ <% if User.current.admin? %>+ <span class="form--field-instructions">+ <%= t(:"storages.instructions.setting_up_additional_storages") %>+ <%= link_to "#{t(:label_administration)} / #{t(:project_module_storages)}", controller: '/storages/admin/storages', action: :index %>.+ </span>+ <% end %>+ </div>+ <%= styled_button_tag t(:button_create), class: "-highlight -with-icon icon-checkmark" %>+ <% else %>+ <div class="op-toast -info">+ <div class="op-toast--content">+ <p>+ <strong><%= t(:'storages.instructions.all_available_storages_already_added') %></strong>+ </p>+ <% if User.current.admin? %>+ <p>+ <%= t(:"storages.instructions.setting_up_additional_storages") %>+ <%= link_to "#{t(:label_administration)} / #{t(:project_module_storages)}", controller: '/storages/admin/storages', action: :index %>.+ </p>+ <% end %>+ </div>+ </div>+ <% end %></section>-- <%= styled_button_tag t(:button_create), class: "-highlight -with-icon icon-checkmark" %><% end %>diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex a2eeabe52d7..3d740c1abb6 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -15,10 +15,15 @@ en:provider_type: "Provider type"storages:+ page_titles:+ project_settings:+ index: "File storages available in this project"+ new: "Enable a file storage for this project"instructions:name: "Please use a short name. It will get used as a tab title in the work package view."no_storage_set_up: "There are no file storages set up, yet."setting_up_additional_storages: "For setting up additional file storages, please visit"+ all_available_storages_already_added: "All available storages are already added to the project."label_creator: "Creator"label_file_link: "File link"label_file_links: "File links"