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

make admin settings storage routes consistent with existing admin settings routes

Christophe Bliard48f3c23bbdb7
diff --git a/modules/storages/app/cells/storages/storages_row_cell.rb b/modules/storages/app/cells/storages/storages_row_cell.rb
index ad1a49a1110..f0b4ed1b3a9 100644
--- a/modules/storages/app/cells/storages/storages_row_cell.rb
+++ b/modules/storages/app/cells/storages/storages_row_cell.rb
@@ -8,7 +8,7 @@ module Storages
include ::Redmine::I18n # Internationalization support (defines I18n.t(...) translation)
def name
- link_to model.name, storage_path(model)
+ link_to model.name, admin_settings_storage_path(model)
end
# Delegate delegates the execution of certain methods to :model.
@@ -27,7 +27,7 @@ module Storages
def delete_link
link_to '',
- storage_path(model),
+ admin_settings_storage_path(model),
class: 'icon icon-delete',
data: { confirm: I18n.t('storages.delete_warning.storage') },
title: I18n.t(:button_delete),
@@ -36,7 +36,7 @@ module Storages
def edit_link
link_to '',
- edit_storage_path(model),
+ edit_admin_settings_storage_path(model),
class: 'icon icon-edit',
accesskey: accesskey(:edit),
title: I18n.t(:button_edit)
diff --git a/modules/storages/app/cells/storages/storages_table_cell.rb b/modules/storages/app/cells/storages/storages_table_cell.rb
index dcbcc696d4a..6f83136ea3c 100644
--- a/modules/storages/app/cells/storages/storages_table_cell.rb
+++ b/modules/storages/app/cells/storages/storages_table_cell.rb
@@ -32,7 +32,7 @@ module Storages
# Used by: app/cells/views/table/show.erb and
# Purpose: return the link to be used to create the storage
def inline_create_link
- link_to(new_storage_path,
+ link_to(new_admin_settings_storage_path,
class: 'wp-inline-create--add-link',
title: I18n.t('storages.label_new_storage')) do
op_icon('icon icon-add')
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index 1a224ba5c4c..cfcbbaf3a4f 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -85,8 +85,8 @@ class Storages::Admin::StoragesController < ApplicationController
if service_result.success?
flash[:notice] = I18n.t(:notice_successful_create)
- # storage_path is automagically created by Ruby routes.
- redirect_to storage_path(@object)
+ # admin_settings_storage_path is automagically created by Ruby routes.
+ redirect_to admin_settings_storage_path(@object)
else
@errors = service_result.errors
render :new
@@ -110,7 +110,7 @@ class Storages::Admin::StoragesController < ApplicationController
if service_result.success?
flash[:notice] = I18n.t(:notice_successful_update)
- redirect_to storage_path(@object)
+ redirect_to admin_settings_storage_path(@object)
else
@errors = service_result.errors
render :edit
@@ -128,7 +128,7 @@ class Storages::Admin::StoragesController < ApplicationController
flash[:info] = I18n.t(:notice_successful_delete)
# Redirect to the index page
- redirect_to storages_path
+ redirect_to admin_settings_storages_path
end
# Used by: admin layout
@@ -138,7 +138,7 @@ class Storages::Admin::StoragesController < ApplicationController
if action_name == :index
t(:project_module_storages)
else
- ActionController::Base.helpers.link_to(t(:project_module_storages), storages_path)
+ ActionController::Base.helpers.link_to(t(:project_module_storages), admin_settings_storages_path)
end
end
diff --git a/modules/storages/app/views/storages/admin/storages/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erb
index fa88740199f..a3f3fbf9c76 100644
--- a/modules/storages/app/views/storages/admin/storages/edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb
@@ -3,7 +3,7 @@
<% local_assigns[:additional_breadcrumb] = @object.name %>
<%= toolbar title: t('label_edit_x', x: @object.name) %>
-<%= labelled_tabular_form_for @object, url: storage_path(@object) do |f| -%>
+<%= labelled_tabular_form_for @object, url: admin_settings_storage_path(@object) do |f| -%>
<%= render partial: '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/storages/index.html.erb b/modules/storages/app/views/storages/admin/storages/index.html.erb
index f836df632cb..7407e26ad86 100644
--- a/modules/storages/app/views/storages/admin/storages/index.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/index.html.erb
@@ -3,7 +3,7 @@
<%= toolbar title: t("project_module_storages") do %>
<li class="toolbar-item">
- <%= link_to new_storage_path,
+ <%= link_to new_admin_settings_storage_path,
{ class: 'button -alt-highlight',
aria: { label: t('storages.label_new_storage') },
title: t('storages.label_new_storage') } do %>
@@ -13,4 +13,4 @@
</li>
<% end %>
-<%= rails_cell ::Storages::StoragesTableCell, @storages %>
\ No newline at end of file
+<%= rails_cell ::Storages::StoragesTableCell, @storages %>
diff --git a/modules/storages/app/views/storages/admin/storages/new.html.erb b/modules/storages/app/views/storages/admin/storages/new.html.erb
index af32c17b6d8..156c6954507 100644
--- a/modules/storages/app/views/storages/admin/storages/new.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/new.html.erb
@@ -3,7 +3,7 @@
<% local_assigns[:additional_breadcrumb] = t('storages.label_new_storage') %>
<%= toolbar title: t("storages.label_new_storage") %>
-<%= labelled_tabular_form_for @object, url: storages_path(@object) do |f| -%>
+<%= labelled_tabular_form_for @object, url: admin_settings_storages_path(@object) do |f| -%>
<%= render partial: '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/storages/show.html.erb b/modules/storages/app/views/storages/admin/storages/show.html.erb
index 11132cd30f2..5e374d35c05 100644
--- a/modules/storages/app/views/storages/admin/storages/show.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/show.html.erb
@@ -33,14 +33,14 @@ See COPYRIGHT and LICENSE files for more details.
<%= toolbar title: "#{t('project_module_storages')} - #{@object.name}",
title_class: 'no-padding-bottom' do %>
<li class="toolbar-item">
- <%= link_to edit_storage_path(@object),
+ <%= link_to edit_admin_settings_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(@object),
+ <%= link_to admin_settings_storage_path(@object),
method: :delete,
data: { confirm: I18n.t('storages.delete_warning.storage') },
class: 'button -danger' do %>
diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rb
index 264078ab718..7d70368cbde 100644
--- a/modules/storages/config/routes.rb
+++ b/modules/storages/config/routes.rb
@@ -1,6 +1,8 @@
OpenProject::Application.routes.draw do
- scope 'admin/settings' do
- resources :storages, controller: 'storages/admin/storages'
+ namespace :admin do
+ namespace :settings do
+ resources :storages, controller: '/storages/admin/storages'
+ end
end
scope 'projects/:project_id', as: 'project' do
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index 434710e6a05..b48fcd614a7 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -36,7 +36,7 @@ describe 'Admin storages', :enable_storages, :storage_server_helpers, type: :fea
end
it 'creates, edits and deletes storages', webmock: true do
- visit storages_path
+ visit admin_settings_storages_path
expect(page).to have_title('File storages')
expect(page.find('.title-container')).to have_text('File storages')
expect(page).to have_text(I18n.t('storages.no_results'))
@@ -83,14 +83,14 @@ describe 'Admin storages', :enable_storages, :storage_server_helpers, type: :fea
expect(page).to have_text(admin.name)
page.find("a", text: 'Other NC').click
- expect(page).to have_current_path storage_path(created_storage)
+ expect(page).to have_current_path admin_settings_storage_path(created_storage)
page.find('.button--icon.icon-delete').click
alert_text = page.driver.browser.switch_to.alert.text
expect(alert_text).to eq(I18n.t('storages.delete_warning.storage'))
page.driver.browser.switch_to.alert.accept
- expect(page).to have_current_path(storages_path)
+ expect(page).to have_current_path(admin_settings_storages_path)
expect(page).not_to have_text("Other NC")
end
end