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
Several improvements for the storages administration
Wieland Lindenthal56aa457079c6
diff --git a/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb b/modules/storages/app/controllers/storages/admin/projects_storages_controller.rbindex 4869a1e4f13..86d01faaaf1 100644--- a/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/projects_storages_controller.rb@@ -66,15 +66,7 @@ class Storages::Admin::ProjectsStoragesController < ApplicationControllerredirect_to project_settings_projects_storages_pathend- def default_breadcrumb- # t(:project_module_storages)- end-- def show_local_breadcrumb- true- end-- current_menu_item :index do+ current_menu_item %i[index new] do:settings_projects_storagesenddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 1928c7c25a4..cd4a1a419b0 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -30,21 +30,26 @@class Storages::Admin::StoragesController < ApplicationControllerlayout 'admin'++ model_object Storages::Storage+before_action :require_admin+ before_action :find_model_object, only: %i[show destroy edit update]+menu_item :storages_admin_settingsdef index@storages = Storages::Storage.all+render 'storages/admin/index'enddef show- @storage = Storages::Storage.find_by id: params[:id]render 'storages/admin/show'enddef new- @storage = Storages::Storage.new(provider_type: 'nextcloud', name: I18n.t('storages.provider_types.nextcloud'))+ @object = Storages::Storage.new(provider_type: 'nextcloud', name: I18n.t('storages.provider_types.nextcloud'))render 'storages/admin/new'end@@ -53,20 +58,32 @@ class Storages::Admin::StoragesController < ApplicationController.to_h.reverse_merge(creator_id: current_user.id)- @storage = Storages::Storage.create combined_params- redirect_to storage_path(@storage)+ @object = Storages::Storage.create combined_params+ redirect_to storage_path(@object)+ end++ def edit+ render 'storages/admin/edit'enddef update- # tbd+ @object.update permitted_storage_params++ redirect_to storage_path(@object)end- def delete- # tbd+ def destroy+ @object.destroy++ redirect_to storages_pathenddef default_breadcrumb- t(:project_module_storages)+ if action_name == :index+ t(:project_module_storages)+ else+ ActionController::Base.helpers.link_to(t(:project_module_storages), storages_path)+ endenddef show_local_breadcrumbdiff --git a/modules/storages/app/views/storages/admin/_form.html.erb b/modules/storages/app/views/storages/admin/_form.html.erbindex f1beb786da2..d999e620106 100644--- a/modules/storages/app/views/storages/admin/_form.html.erb+++ b/modules/storages/app/views/storages/admin/_form.html.erb@@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<%= error_messages_for_contract @storage, @errors %>+<%= error_messages_for_contract @object, @errors %><section class="form--section"><div class="form--field -required">diff --git a/modules/storages/app/views/storages/admin/edit.html.erb b/modules/storages/app/views/storages/admin/edit.html.erbnew file mode 100644index 00000000000..cdc38b91ba8--- /dev/null+++ b/modules/storages/app/views/storages/admin/edit.html.erb@@ -0,0 +1,9 @@+<% html_title t(:label_administration), t("project_module_storages") %>+<% local_assigns[:additional_breadcrumb] = @object.name %>+<%= toolbar title: @object.name %>++<%= labelled_tabular_form_for @object, url: storage_path(@object) do |f| -%>+ <%= error_messages_for_contract @object, @errors %>+ <%= render :partial => 'storages/admin/form', locals: { f: f } %>+ <%= styled_button_tag t(:button_save), class: "-highlight -with-icon icon-checkmark" %>+<% end %>diff --git a/modules/storages/app/views/storages/admin/new.html.erb b/modules/storages/app/views/storages/admin/new.html.erbindex c473093ce73..a6d5d3c2a1b 100644--- a/modules/storages/app/views/storages/admin/new.html.erb+++ b/modules/storages/app/views/storages/admin/new.html.erb@@ -2,8 +2,8 @@<% local_assigns[:additional_breadcrumb] = t('storages.label_new_storage') %><%= toolbar title: t("storages.label_new_storage") %>-<%= labelled_tabular_form_for @storage, url: storages_path(@storage) do |f| -%>- <%= error_messages_for_contract @storage, @errors %>+<%= labelled_tabular_form_for @object, url: storages_path(@object) do |f| -%>+ <%= error_messages_for_contract @object, @errors %><%= render :partial => 'storages/admin/form', locals: { f: f } %><%= styled_button_tag t(:button_create), class: "-highlight -with-icon icon-checkmark" %><% end %>diff --git a/modules/storages/app/views/storages/admin/show.html.erb b/modules/storages/app/views/storages/admin/show.html.erbindex ee090e979b9..7a5f4e85abd 100644--- a/modules/storages/app/views/storages/admin/show.html.erb+++ b/modules/storages/app/views/storages/admin/show.html.erb@@ -26,20 +26,20 @@ 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('project_module_storages'), t(@storage.name) -%>-<% local_assigns[:additional_breadcrumb] = @storage.name %>+<% html_title t(:label_administration), t('project_module_storages'), t(@object.name) -%>+<% local_assigns[:additional_breadcrumb] = @object.name %>-<%= toolbar title: "#{t('project_module_storages')} - #{@storage.name}",+<%= toolbar title: "#{t('project_module_storages')} - #{@object.name}",title_class: 'no-padding-bottom' do %><li class="toolbar-item">- <%= link_to edit_storage_path(@storage),+ <%= link_to edit_storage_path(@object),class: 'button' do %><%= op_icon('button--icon icon-edit') %><span class="button--text"><%= t(:button_edit) %></span><% end %></li><li class="toolbar-item">- <%= link_to storage_path(@storage),+ <%= link_to storage_path(@object),method: :delete,data: { confirm: I18n.t(:text_are_you_sure) },class: 'button -danger' do %>@@ -49,11 +49,31 @@ See COPYRIGHT and LICENSE files for more details.</li><% end %>-<ul>-<li><%= @storage.id %></li>-<li><%= @storage.name %></li>-<li><%= @storage.provider_type %></li>-<li><%= @storage.creator.name %></li>-<li><%= @storage.created_at %></li>-<li><%= @storage.identifier %></li>-</ul>\ No newline at end of file+<div class="attributes-group">+ <div class="attributes-key-value">+ <div class="attributes-key-value--key"><%= t(:'storages.label_name') %></div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span><%= @object.name %></span>+ </div>+ </div>+ <div class="attributes-key-value--key"><%= t(:'storages.label_provider_type') %></div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span><%= t(:"storages.provider_types.#{@object.provider_type}") %></span>+ </div>+ </div>+ <div class="attributes-key-value--key"><%= t(:'storages.label_creator') %></div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span><%= @object.creator.name %></span>+ </div>+ </div>+ <div class="attributes-key-value--key"><%= t(:'storages.label_created_at') %></div>+ <div class="attributes-key-value--value-container">+ <div class="attributes-key-value--value -text">+ <span><%= @object.created_at %></span>+ </div>+ </div>+ </div>+</div>diff --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.erbnew file mode 100644index 00000000000..2496c745447--- /dev/null+++ b/modules/storages/app/views/storages/project_settings/_toast_no_storage_set_up.html.erb@@ -0,0 +1,11 @@+<div class="op-toast -info">+ <div class="op-toast--content">+ <p>+ <strong><%= t(:'storages.instruction.no_storage_set_up') %></strong>+ </p>+ <p>+ <%= t(:"storages.instructions.setting_up_additional_storages") %>+ <%= link_to "#{t(:label_administration)} / #{t(:project_module_storages)}", controller: '/storages/admin/storages', action: :index %>.+ </p>+ </div>+</div>\ No newline at end of filediff --git a/modules/storages/app/views/storages/project_settings/index.html.erb b/modules/storages/app/views/storages/project_settings/index.html.erbindex 8aa8519ed78..370ecd4361e 100644--- a/modules/storages/app/views/storages/project_settings/index.html.erb+++ b/modules/storages/app/views/storages/project_settings/index.html.erb@@ -1,15 +1,20 @@<% html_title t(:label_administration), t("project_module_storages") %>-<%= toolbar title: t("project_module_storages") do %>- <li class="toolbar-item">- <%= link_to new_project_settings_projects_storage_path,- { class: 'button -alt-highlight',- aria: { label: t(:'storages.label_new_storage') },- title: t(:'ifc_models.label_new_storage') } do %>- <%= op_icon('button--icon icon-add') %>- <span class="button--text"><%= ::Storages::Storage.model_name.human %></span>- <% end %>- </li>-<% end %>+<% if ::Storages::Storage.any? %>+ <%= toolbar title: t("project_module_storages") do %>-<%= rails_cell ::Storages::ProjectsStoragesTableCell, @projects_storages %>\ No newline at end of file+ <li class="toolbar-item">+ <%= link_to new_project_settings_projects_storage_path,+ { class: 'button -alt-highlight',+ aria: { label: t(:'storages.label_new_storage') },+ title: t(:'ifc_models.label_new_storage') } do %>+ <%= op_icon('button--icon icon-add') %>+ <span class="button--text"><%= ::Storages::Storage.model_name.human %></span>+ <% end %>+ </li>+ <% end %>++ <%= rails_cell ::Storages::ProjectsStoragesTableCell, @projects_storages %>+<% else %>+ <%= render partial: '/storages/project_settings/toast_no_storage_set_up' %>+<% end %>\ No newline at end of filediff --git a/modules/storages/app/views/storages/project_settings/new.html.erb b/modules/storages/app/views/storages/project_settings/new.html.erbindex 11c26e69b5d..01ccd37e656 100644--- a/modules/storages/app/views/storages/project_settings/new.html.erb+++ b/modules/storages/app/views/storages/project_settings/new.html.erb@@ -9,8 +9,14 @@<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,+ 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></section>diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex c94e10d5d2e..a2eeabe52d7 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -17,6 +17,8 @@ en:storages: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"label_creator: "Creator"label_file_link: "File link"label_file_links: "File links"diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rbindex bd42a36a787..ccd604f1023 100644--- a/modules/storages/config/routes.rb+++ b/modules/storages/config/routes.rb@@ -5,7 +5,7 @@ OpenProject::Application.routes.draw doscope 'projects/:project_id', as: 'project' donamespace 'settings' do- resources :projects_storages, controller: '/storages/admin/projects_storages', only: %i[index new create destroy]+ resources :projects_storages, controller: '/storages/admin/projects_storages'endendenddiff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex 49defd94460..d3b34aaa62c 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -60,7 +60,7 @@ module OpenProject::Storagesmenu :project_menu,:settings_projects_storages,{ controller: '/storages/admin/projects_storages', action: 'index' },- caption: :'storages.label_storage',+ caption: :project_module_storages,parent: :settingsend