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

Use data-turbo to avoid inline form

Oliver Günther42184024686e
diff --git a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
index be11f3507b4..c64db36c773 100644
--- a/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
+++ b/modules/meeting/app/components/meetings/side_panel/state_component.html.erb
@@ -22,28 +22,13 @@
end
if edit_enabled?
- open_state.with_row(mt: [0, 3, 3, 3, 3]) do
- form_for(@meeting, method: "put", url: change_state_meeting_path(@meeting),
- data: { 'turbo-stream': true }) do |f|
- flex_layout do |open_state_actions|
- open_state_actions.with_row do
- f.hidden_field :state, value: "closed"
- end
-
- open_state_actions.with_row do
- render(Primer::Beta::Button.new(
- scheme: :link,
- color: :default,
- underline: false,
- font_weight: :bold,
- type: :submit
- )) do |button|
- button.with_leading_visual_icon(icon: :lock)
- t("label_meeting_close_action")
- end
- end
- end
- end
+ section.with_footer_button(
+ tag: :a,
+ href: change_state_meeting_path(@meeting, state: 'closed'),
+ data: { 'turbo-stream': true, 'turbo-method': 'put' }
+ ) do |button|
+ button.with_leading_visual_icon(icon: :unlock)
+ t("label_meeting_close_action")
end
end
end
@@ -67,28 +52,12 @@
if edit_enabled?
section.with_footer_button(
- closed_state.with_row(mt: [0, 3, 3, 3, 3]) do
- form_for(@meeting, method: "put", url: change_state_meeting_path(@meeting),
- data: { 'turbo-stream': true }) do |f|
- flex_layout do |closed_state_actions|
- closed_state_actions.with_row do
- f.hidden_field :state, value: "open"
- end
-
- closed_state_actions.with_row do
- render(Primer::Beta::Button.new(
- scheme: :link,
- color: :default,
- underline: false,
- font_weight: :bold,
- type: :submit
- )) do |button|
- button.with_leading_visual_icon(icon: :unlock)
- t("label_meeting_reopen_action")
- end
- end
- end
- end
+ tag: :a,
+ href: change_state_meeting_path(@meeting, state: 'open'),
+ data: { 'turbo-stream': true, 'turbo-method': 'put' }
+ ) do |button|
+ button.with_leading_visual_icon(icon: :unlock)
+ t("label_meeting_reopen_action")
end
end
end
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index 9b5e4f417bd..61cd650816b 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -208,7 +208,7 @@ class MeetingsController < ApplicationController
end
def change_state
- case structured_meeting_params[:state]
+ case params[:state]
when "open"
@meeting.open!
when "closed"
diff --git a/modules/meeting/spec/support/pages/structured_meeting/show.rb b/modules/meeting/spec/support/pages/structured_meeting/show.rb
index 223a8f9e149..0eab0d7a05a 100644
--- a/modules/meeting/spec/support/pages/structured_meeting/show.rb
+++ b/modules/meeting/spec/support/pages/structured_meeting/show.rb
@@ -212,12 +212,12 @@ module Pages::StructuredMeeting
def close_meeting
click_on("Close meeting")
- expect(page).to have_button("Reopen meeting")
+ expect(page).to have_link("Reopen meeting")
end
def reopen_meeting
click_on("Reopen meeting")
- expect(page).to have_button("Close meeting")
+ expect(page).to have_link("Close meeting")
end
def close_dialog