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
refactor dialog to have form and footer divided correctly
Klaus Zandersfe51c0ef2efc
diff --git a/modules/costs/app/components/time_entries/entry_dialog_component.html.erb b/modules/costs/app/components/time_entries/entry_dialog_component.html.erbindex c53510ac272..393559baa98 100644--- a/modules/costs/app/components/time_entries/entry_dialog_component.html.erb+++ b/modules/costs/app/components/time_entries/entry_dialog_component.html.erb@@ -1,4 +1,10 @@<%= render(Primer::Alpha::Dialog.new(title: 'Log Time', size: :large, id: MODAL_ID, data: { "controller" => "time-entry", "application-target" => "dynamic" })) do |d| %><% d.with_header(variant: :large, mb: 3) %>+ <% d.with_body do %><%= render(TimeEntries::TimeEntryFormComponent.new(time_entry: time_entry)) %>+ <% end %>+ <% d.with_footer(variant: :large) do %>+ <%= render(Primer::ButtonComponent.new(data: { 'close-dialog-id': "time-entry-dialog" })) { I18n.t("button_cancel") } %>+ <%= render(Primer::ButtonComponent.new(scheme: :primary, type: :submit, test_selector: "create-time-entry-button", form: 'time-entry-form')) { "Create Time Entry" } %>+ <% end %><% end %>diff --git a/modules/costs/app/components/time_entries/time_entry_form.rb b/modules/costs/app/components/time_entries/time_entry_form.rbindex 29a333cd6a0..ac6f2f95a89 100644--- a/modules/costs/app/components/time_entries/time_entry_form.rb+++ b/modules/costs/app/components/time_entries/time_entry_form.rb@@ -47,13 +47,13 @@ module TimeEntriesf.work_package_autocompleter name: :work_package_id,label: "Work package",autocomplete_options: {+ focusDirectly: false,append_to: "#time-entry-dialog",filters: [{ name: "project_id", operator: "=", values: [model.project_id] }]-}end- f.text_field name: :activity, label: "Activity"+ f.text_field name: :activity_id, label: "Activity"f.text_field name: :comments, label: "Comments"diff --git a/modules/costs/app/components/time_entries/time_entry_form_component.html.erb b/modules/costs/app/components/time_entries/time_entry_form_component.html.erbindex f09289b5028..aa48dfc426c 100644--- a/modules/costs/app/components/time_entries/time_entry_form_component.html.erb+++ b/modules/costs/app/components/time_entries/time_entry_form_component.html.erb@@ -30,26 +30,7 @@ See COPYRIGHT and LICENSE files for more details.<%=component_wrapper doprimer_form_with(**form_options) do |form|- component_collection do |collection|- collection.with_component(Primer::Alpha::Dialog::Body.new) do- component_collection do |coll|- # coll.with_component content_tag(:pre, time_entry.pretty_inspect)- coll.with_component render(TimeEntries::TimeEntryForm.new(form))- end- end-- collection.with_component(Primer::Alpha::Dialog::Footer.new) do- component_collection do |footer|- footer.with_component(Primer::ButtonComponent.new(data: { 'close-dialog-id': "time-entry-dialog" })) do- I18n.t("button_cancel")- end-- footer.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit, test_selector: "create-api-token-button")) do- I18n.t("my.access_token.new_access_token_dialog_submit_button_text")- end- end+ render(TimeEntries::TimeEntryForm.new(form))endend- end- end%>diff --git a/modules/costs/app/components/time_entries/time_entry_form_component.rb b/modules/costs/app/components/time_entries/time_entry_form_component.rbindex b41aaf120f8..887e712496c 100644--- a/modules/costs/app/components/time_entries/time_entry_form_component.rb+++ b/modules/costs/app/components/time_entries/time_entry_form_component.rb@@ -47,7 +47,8 @@ module TimeEntriesdef form_optionsbase = {model: time_entry,- data: { turbo: true }+ data: { turbo: true },+ id: "time-entry-form"}if time_entry.persisted?