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

Extract view logic into separate file (async_dialog)

Henriette Dargee8383de4b21e
diff --git a/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.html.erb b/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.html.erb
new file mode 100644
index 00000000000..2f55d2afbf5
--- /dev/null
+++ b/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.html.erb
@@ -0,0 +1,26 @@
+<%=
+ render(Primer::Box.new(data: stimulus_attributes)) do
+ render(Primer::Alpha::Dialog.new(
+ id: @id,
+ title: @title,
+ size: @size
+ )) do |dialog|
+ dialog.with_show_button(**merged_button_attributes) do |button|
+ button.with_leading_visual_icon(icon: @button_icon) if @button_icon
+ @button_text
+ end
+
+ content_tag("turbo-frame",
+ id: "#{@id}-frame",
+ loading: :lazy,
+ src: @src,
+ data: { 'op-turbo-op-primer-async-dialog-target': "frameElement" }) do
+ flex_layout(justify_content: :center) do |flex|
+ flex.with_column(my: 5) do
+ render(Primer::Beta::Spinner.new)
+ end
+ end
+ end
+ end
+ end
+%>
diff --git a/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.rb b/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.rb
index 6a0c4c18cbd..7bd1da3c33a 100644
--- a/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.rb
+++ b/modules/meeting/app/components/op_turbo/op_primer/async_dialog_component.rb
@@ -44,19 +44,6 @@ module OpTurbo
@button_attributes = button_attributes
end
- def call
- render(Primer::Box.new(data: stimulus_attributes)) do
- render(Primer::Alpha::Dialog.new(
- id: @id,
- title: @title,
- size: @size
- )) do |dialog|
- button_partial(dialog)
- frame_partial
- end
- end
- end
-
private
def stimulus_attributes
@@ -66,13 +53,6 @@ module OpTurbo
}
end
- def button_partial(dialog)
- dialog.with_show_button(**merged_button_attributes) do |button|
- button.with_leading_visual_icon(icon: @button_icon) if @button_icon
- @button_text
- end
- end
-
def merged_button_attributes
stimuls_action_ref = 'click->op-turbo-op-primer-async-dialog#reinitFrame'
@@ -81,24 +61,6 @@ module OpTurbo
@button_attributes
end
-
- def frame_partial
- content_tag("turbo-frame",
- id: "#{@id}-frame",
- loading: :lazy,
- src: @src,
- data: { 'op-turbo-op-primer-async-dialog-target': "frameElement" }) do
- loading_state_partial
- end
- end
-
- def loading_state_partial
- flex_layout(justify_content: :center) do |flex|
- flex.with_column(my: 5) do
- render(Primer::Beta::Spinner.new)
- end
- end
- end
end
end
end