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
Extract FormComponent into erb view and grid layout
Oliver Günther655443094595
diff --git a/frontend/src/global_styles/content/_autocomplete_primerized.sass b/frontend/src/global_styles/content/_autocomplete_primerized.sassindex 7509737e315..4c6eebdddb0 100644--- a/frontend/src/global_styles/content/_autocomplete_primerized.sass+++ b/frontend/src/global_styles/content/_autocomplete_primerized.sass@@ -30,5 +30,5 @@&.ng-select--primerized.ng-select-containerborder-radius: 6px- height: 28px !important- min-height: 28px !important+ height: 32px !important+ min-height: 32px !importantdiff --git a/modules/meeting/app/components/_index.sass b/modules/meeting/app/components/_index.sassindex 6765a36a8a5..3cdcef54bec 100644--- a/modules/meeting/app/components/_index.sass+++ b/modules/meeting/app/components/_index.sass@@ -1 +1,2 @@@import "./meeting_agenda_items/item_component/show_component.sass"+@import "./meeting_agenda_items/form_component.sass"diff --git a/modules/meeting/app/components/meeting_agenda_items/form_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/form_component.html.erbnew file mode 100644index 00000000000..0dc0ae003bc--- /dev/null+++ b/modules/meeting/app/components/meeting_agenda_items/form_component.html.erb@@ -0,0 +1,62 @@+<%=+ component_wrapper(data: wrapper_data_attributes) do+ primer_form_with(+ model: @meeting_agenda_item,+ method: @method,+ url: @submit_path+ ) do |f|+ grid_layout('op-meeting-agenda-item-form', tag: :div) do |grid|+ grid.with_area(:title) do+ case @type+ when :simple+ render(MeetingAgendaItem::Title.new(f))+ when :work_package+ render(MeetingAgendaItem::WorkPackage.new(f))+ end+ end++ grid.with_area(:duration) do+ render(MeetingAgendaItem::Duration.new(f))+ end++ grid.with_area(:notes,+ display: display_notes_input_value,+ data: { 'meeting-agenda-item-form-target': "notesInput" }) do+ render(MeetingAgendaItem::Notes.new(f))+ end++ grid.with_area(:add_note,+ display: display_notes_add_button_value,+ data: { 'meeting-agenda-item-form-target': "notesAddButton" }) do+ render(Primer::Beta::Button.new(+ scheme: :secondary,+ data: {+ action: 'click->meeting-agenda-item-form#addNotes keydown.enter->meeting-agenda-item-form#addNotes'+ }+ )) do |component|+ component.with_leading_visual_icon(icon: :plus)+ MeetingAgendaItem.human_attribute_name(:notes)+ end+ end++ grid.with_area(:actions) do+ flex_layout do |flex|+ flex.with_column(mr: 2) do+ render(Primer::Beta::Button.new(+ scheme: :secondary,+ tag: :a,+ href: @cancel_path,+ data: { 'turbo-stream': true }+ )) do |_c|+ t("button_cancel")+ end+ end+ flex.with_column do+ render(MeetingAgendaItem::Submit.new(f, type: @type))+ end+ end+ end+ end+ end+ end+%>diff --git a/modules/meeting/app/components/meeting_agenda_items/form_component.rb b/modules/meeting/app/components/meeting_agenda_items/form_component.rbindex d992e0b7fcc..0f5e8a429b4 100644--- a/modules/meeting/app/components/meeting_agenda_items/form_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/form_component.rb@@ -43,18 +43,6 @@ module MeetingAgendaItems@type = typeend- def call- component_wrapper(data: wrapper_data_attributes) do- primer_form_with(- model: @meeting_agenda_item,- method: @method,- url: @submit_path- ) do |f|- form_content_partial(f)- end- end- end-def render?User.current.allowed_to?(:edit_meetings, @meeting.project)end@@ -69,96 +57,15 @@ module MeetingAgendaItems}end- def form_content_partial(form)- flex_layout do |flex|- flex.with_row do- form_fields_partial(form)- end- flex.with_row(mt: 2) do- form_notes_partial(form)- end- flex.with_row do- form_actions_partial(form)- end- end- end-- def form_fields_partial(form)- flex_layout do |flex|- flex.with_column(flex: 1) do- case @type- when :simple- render(MeetingAgendaItem::Title.new(form))- when :work_package- render(MeetingAgendaItem::WorkPackage.new(form))- end- end- flex.with_column(ml: 2) do- render(MeetingAgendaItem::Duration.new(form))- end- end- end-- def form_notes_partial(form)- render(Primer::Box.new(data: { 'meeting-agenda-item-form-target': "notesInput" },- display: display_notes_input_value)) do- render(MeetingAgendaItem::Notes.new(form))- end- enddef display_notes_input_value@meeting_agenda_item.notes.blank? ? :none : nilend- def form_actions_partial(form)- flex_layout(justify_content: :space_between, mt: 2) do |flex|- flex.with_column do- additional_elements_partial- end- flex.with_column do- save_or_cancel_partial(form)- end- end- end-- def additional_elements_partial- render(Primer::Beta::Button.new(- scheme: :secondary,- display: display_notes_add_button_value,- data: {- 'meeting-agenda-item-form-target': "notesAddButton",- action: 'click->meeting-agenda-item-form#addNotes keydown.enter->meeting-agenda-item-form#addNotes'- }- )) do |component|- component.with_leading_visual_icon(icon: :plus)- MeetingAgendaItem.human_attribute_name(:notes)- end- enddef display_notes_add_button_value@meeting_agenda_item.notes.blank? ? nil : :noneend- def save_or_cancel_partial(form)- flex_layout(justify_content: :flex_end) do |flex|- flex.with_column(mr: 2) do- back_link_partial- end- flex.with_column do- render(MeetingAgendaItem::Submit.new(form, type: @type))- end- end- end-- def back_link_partial- render(Primer::Beta::Button.new(- scheme: :secondary,- tag: :a,- href: @cancel_path,- data: { 'turbo-stream': true }- )) do |_c|- t("button_cancel")- end- endendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/form_component.sass b/modules/meeting/app/components/meeting_agenda_items/form_component.sassnew file mode 100644index 00000000000..0d26789aa6e--- /dev/null+++ b/modules/meeting/app/components/meeting_agenda_items/form_component.sass@@ -0,0 +1,13 @@+@import 'helpers'++.op-meeting-agenda-item-form+ display: grid+ grid-template-columns: 1fr 180px+ grid-template-areas: "title duration" "notes notes" "add_note actions"+ grid-gap: 8px++ &--actions+ justify-self: end++ @media screen and (max-width: $breakpoint-sm)+ grid-template-areas: "title title" "duration duration" "notes notes" "add_note actions"