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

Fix unfound template when service failed in update action

Christophe Bliarddee704d83d63
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index 46a5c8d05cc..17a288cf34f 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -50,17 +50,11 @@ class Storages::Admin::StoragesController < ApplicationController
# Called by: Global app/config/routes.rb to serve Web page
def index
@storages = Storages::Storage.all
-
- # The view is located in a slightly off-standard directory
- # Why not use a leading "/" as in other places?
- render 'storages/admin/index'
end
# Show page with details of one Storage object.
# Called by: Global app/config/routes.rb to serve Web page
- def show
- render 'storages/admin/show'
- end
+ def show; end
# Show the admin page to create a new Storage object.
# Sets the attributes provider_type and name as default values and then
@@ -79,10 +73,6 @@ class Storages::Admin::StoragesController < ApplicationController
contract_class: EmptyContract)
.call(provider_type: 'nextcloud', name: I18n.t('storages.provider_types.nextcloud'))
.result
-
- # Render the new page in a slightly off-standard location
- # Error handling is done in the view page
- render 'storages/admin/new'
end
# Actually create a Storage object.
@@ -103,7 +93,7 @@ class Storages::Admin::StoragesController < ApplicationController
redirect_to storage_path(@object)
else
@errors = service_result.errors
- render 'storages/admin/new'
+ render :new
end
end
# rubocop:enable Metrics/AbcSize
@@ -111,9 +101,7 @@ class Storages::Admin::StoragesController < ApplicationController
# Edit page is very similar to new page, except that we don't need to set
# default attribute values because the object already exists
# Called by: Global app/config/routes.rb to serve Web page
- def edit
- render 'storages/admin/edit'
- end
+ def edit; end
# Update is similar to create above
# See also: create above
@@ -129,7 +117,7 @@ class Storages::Admin::StoragesController < ApplicationController
flash[:notice] = I18n.t(:notice_successful_update)
redirect_to storage_path(@object)
else
- render action: :edit
+ render :edit
end
end
diff --git a/modules/storages/app/views/storages/admin/_form.html.erb b/modules/storages/app/views/storages/admin/storages/_form.html.erb
similarity index 100%
rename from modules/storages/app/views/storages/admin/_form.html.erb
rename to modules/storages/app/views/storages/admin/storages/_form.html.erb
diff --git a/modules/storages/app/views/storages/admin/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erb
similarity index 88%
rename from modules/storages/app/views/storages/admin/edit.html.erb
rename to modules/storages/app/views/storages/admin/storages/edit.html.erb
index e76e31f05a5..8a712bf9d0b 100644
--- a/modules/storages/app/views/storages/admin/edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb
@@ -5,6 +5,6 @@
<%= 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 } %>
+ <%= 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/index.html.erb b/modules/storages/app/views/storages/admin/storages/index.html.erb
similarity index 100%
rename from modules/storages/app/views/storages/admin/index.html.erb
rename to modules/storages/app/views/storages/admin/storages/index.html.erb
diff --git a/modules/storages/app/views/storages/admin/new.html.erb b/modules/storages/app/views/storages/admin/storages/new.html.erb
similarity index 88%
rename from modules/storages/app/views/storages/admin/new.html.erb
rename to modules/storages/app/views/storages/admin/storages/new.html.erb
index 614c60945e5..6fc15587eca 100644
--- a/modules/storages/app/views/storages/admin/new.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/new.html.erb
@@ -5,6 +5,6 @@
<%= 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 } %>
+ <%= 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/show.html.erb b/modules/storages/app/views/storages/admin/storages/show.html.erb
similarity index 100%
rename from modules/storages/app/views/storages/admin/show.html.erb
rename to modules/storages/app/views/storages/admin/storages/show.html.erb