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[Op#50737]: update general info update to turbo streams
Kabiru Mwenja45001c239875
diff --git a/modules/storages/app/components/storages/admin/general_info_component.html.erb b/modules/storages/app/components/storages/admin/general_info_component.html.erbindex 3a0d97e4172..0b3752c92ce 100644--- a/modules/storages/app/components/storages/admin/general_info_component.html.erb+++ b/modules/storages/app/components/storages/admin/general_info_component.html.erb@@ -20,7 +20,8 @@scheme: :invisible,href: edit_host_admin_settings_storage_path(storage),aria: { label: I18n.t('storages.label_edit_storage_host') } ,- test_selector: 'storage-edit-host-button'+ test_selector: 'storage-edit-host-button',+ data: { turbo_stream: true }))enddiff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex a7cbc239889..565ed5e2bbe 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -142,12 +142,15 @@ class Storages::Admin::StoragesController < ApplicationController# default attribute values because the object already exists;# Called by: Global app/config/routes.rb to serve Web pagedef edit; end- def edit_host; end++ def edit_host+ respond_to { |format| format.turbo_stream }+ end# Update is similar to create above# See also: create above# Called by: Global app/config/routes.rb to serve Web page- def update+ def update # rubocop:disable Metrics/AbcSizeservice_result = ::Storages::Storages::UpdateService.new(user: current_user, model: @storage).call(@storage_params)@@ -155,14 +158,16 @@ class Storages::Admin::StoragesController < ApplicationControllerif service_result.success?flash[:notice] = I18n.t(:notice_successful_update)+respond_to do |format|format.html { redirect_to edit_admin_settings_storage_path(@storage) }format.turbo_streamend- elsif OpenProject::FeatureDecisions.storage_primer_design_active?- render :edit_hostelse- render :edit+ respond_to do |format|+ format.html { render :edit }+ format.turbo_stream { render :edit_host }+ endendenddiff --git a/modules/storages/app/views/storages/admin/storages/edit_host.html.erb b/modules/storages/app/views/storages/admin/storages/edit_host.html.erbdeleted file mode 100644index 84ca93a5740..00000000000--- a/modules/storages/app/views/storages/admin/storages/edit_host.html.erb+++ /dev/null@@ -1,11 +0,0 @@-<%=- render(OpTurbo::FrameComponent.new(id: :storage_general_info_section)) do- render(- Storages::Admin::Forms::GeneralInfoFormComponent.new(- @storage,- form_method: :patch,- cancel_button_path: edit_admin_settings_storage_path(@storage)- )- )- end-%>diff --git a/modules/storages/app/views/storages/admin/storages/edit_host.turbo_stream.erb b/modules/storages/app/views/storages/admin/storages/edit_host.turbo_stream.erbnew file mode 100644index 00000000000..3e37f5e0dc5--- /dev/null+++ b/modules/storages/app/views/storages/admin/storages/edit_host.turbo_stream.erb@@ -0,0 +1,40 @@+<%#-- copyright+OpenProject is an open source project management software.+Copyright (C) 2012-2023 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.++++#%>++<%= turbo_stream.update :storage_general_info_section do %>+ <%=+ render(+ Storages::Admin::Forms::GeneralInfoFormComponent.new(+ @storage,+ form_method: :patch,+ cancel_button_path: edit_admin_settings_storage_path(@storage)+ )+ )+ %>+<% end %>diff --git a/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erb b/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erbindex 66f69f80ae9..25bcfabe222 100644--- a/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erb+++ b/modules/storages/app/views/storages/admin/storages/update.turbo_stream.erb@@ -1,7 +1,7 @@-<%= turbo_stream.update dom_id(@storage, :general_info) do %>- <%= render(::Storages::Admin::GeneralInfoComponent.new(@storage)) %>-<% end %>-<%= turbo_stream.update dom_id(@storage, :edit_storage_header) do %><%= @storage.name %><% end %>++<%= turbo_stream.update :storage_general_info_section do %>+ <%= render(::Storages::Admin::GeneralInfoComponent.new(@storage)) %>+<% end %>