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
Convert meeting tab views to erb
Oliver Günther7c3059f226f0
diff --git a/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.html.erb b/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.html.erbnew file mode 100644index 00000000000..30319961c8f--- /dev/null+++ b/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.html.erb@@ -0,0 +1,43 @@+<%=+ content_tag("turbo-frame", id: "add-work-package-to-meeting-dialog-frame") do+ component_wrapper do+ primer_form_with(+ model: @meeting_agenda_item,+ method: :post,+ url: work_package_meeting_agenda_items_path(@work_package)+ ) do |f|+ component_collection do |collection|+ collection.with_component(Primer::Alpha::Dialog::Body.new(test_selector: 'op-add-work-package-to-meeting-dialog-body')) do+ flex_layout(my: 3) do |flex|+ flex.with_row do+ if @base_errors&.any?+ render(Primer::Beta::Flash.new(mb: 3, icon: :stop, scheme: :danger)) { @base_errors.join("\n") }+ end+ end+ flex.with_row do+ render(MeetingAgendaItem::MeetingForm.new(f))+ end+ flex.with_row(mt: 3) do+ render(MeetingAgendaItem::Notes.new(f))+ end+ end+ end+ collection.with_component(Primer::Alpha::Dialog::Footer.new) do+ component_collection do |collection1|+ collection1.with_component(Primer::ButtonComponent.new(+ data: {+ 'close-dialog-id': "add-work-package-to-meeting-dialog"+ }+ )) do+ t("button_cancel")+ end+ collection1.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) do+ t("button_save")+ end+ end+ end+ end+ end+ end+ end+%>diff --git a/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.rb b/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.rbindex 74805729d99..8c61e10aee0 100644--- a/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.rb+++ b/modules/meeting/app/components/work_package_meetings_tab/add_work_package_to_meeting_form_component.rb@@ -39,63 +39,5 @@ module WorkPackageMeetingsTab@meeting_agenda_item = meeting_agenda_item || MeetingAgendaItem.new(work_package: @work_package)@base_errors = base_errorsend-- def call- content_tag("turbo-frame", id: "add-work-package-to-meeting-dialog-frame") do- component_wrapper do- primer_form_with(- model: @meeting_agenda_item,- method: :post,- url: work_package_meeting_agenda_items_path(@work_package)- ) do |f|- component_collection do |collection|- collection.with_component(Primer::Alpha::Dialog::Body.new(test_selector: 'op-add-work-package-to-meeting-dialog-body')) do- form_content_partial(f)- end- collection.with_component(Primer::Alpha::Dialog::Footer.new) do- form_actions_partial- end- end- end- end- end- end-- private-- def form_content_partial(form)- flex_layout(my: 3) do |flex|- flex.with_row do- base_error_partial- end- flex.with_row do- render(MeetingAgendaItem::MeetingForm.new(form))- end- flex.with_row(mt: 3) do- render(MeetingAgendaItem::Notes.new(form))- end- end- end-- def base_error_partial- if @base_errors&.any?- render(Primer::Beta::Flash.new(mb: 3, icon: :stop, scheme: :danger)) { @base_errors.join("\n") }- end- end-- def form_actions_partial- component_collection do |collection|- collection.with_component(Primer::ButtonComponent.new(- data: {- 'close-dialog-id': "add-work-package-to-meeting-dialog"- }- )) do- t("button_cancel")- end- collection.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) do- t("button_save")- end- end- endendenddiff --git a/modules/meeting/app/components/work_package_meetings_tab/heading_component.html.erb b/modules/meeting/app/components/work_package_meetings_tab/heading_component.html.erbnew file mode 100644index 00000000000..3bb93be6981--- /dev/null+++ b/modules/meeting/app/components/work_package_meetings_tab/heading_component.html.erb@@ -0,0 +1,24 @@+<%=+ component_wrapper do+ flex_layout(justify_content: :space_between, align_items: :center) do |flex|+ flex.with_column do+ render(Primer::Beta::Text.new(color: :subtle)) { t("text_add_work_package_to_meeting_description") }+ end+ if allowed_to_add_to_meeting?+ flex.with_column(ml: 3) do+ render(OpTurbo::OpPrimer::AsyncDialogComponent.new(+ id: "add-work-package-to-meeting-dialog",+ src: dialog_work_package_meeting_agenda_items_path(@work_package),+ size: :xlarge,+ title: t("label_add_work_package_to_meeting_dialog_title"),+ button_icon: :plus,+ button_text: t("label_add_work_package_to_meeting_dialog_button"),+ button_attributes: {+ test_selector: "op-add-work-package-to-meeting-dialog-trigger"+ }+ ))+ end+ end+ end+ end+%>diff --git a/modules/meeting/app/components/work_package_meetings_tab/heading_component.rb b/modules/meeting/app/components/work_package_meetings_tab/heading_component.rbindex a0eb4532c3c..3ae9a1fd8b4 100644--- a/modules/meeting/app/components/work_package_meetings_tab/heading_component.rb+++ b/modules/meeting/app/components/work_package_meetings_tab/heading_component.rb@@ -38,44 +38,10 @@ module WorkPackageMeetingsTab@work_package = work_packageend- def call- component_wrapper do- flex_layout(justify_content: :space_between, align_items: :center) do |flex|- flex.with_column do- info_partial- end- if allowed_to_add_to_meeting?- flex.with_column(ml: 3) do- add_to_meeting_partial- end- end- end- end- end-privatedef allowed_to_add_to_meeting?User.current.allowed_to?(:edit_meetings, @work_package.project)end-- def info_partial- render(Primer::Beta::Text.new(color: :subtle)) { t("text_add_work_package_to_meeting_description") }- end-- def add_to_meeting_partial- # we need to render a dialog with size :xlarge as the RTE requires this size to be able to render the toolbar properly- render(OpTurbo::OpPrimer::AsyncDialogComponent.new(- id: "add-work-package-to-meeting-dialog",- src: dialog_work_package_meeting_agenda_items_path(@work_package),- size: :xlarge,- title: t("label_add_work_package_to_meeting_dialog_title"),- button_icon: :plus,- button_text: t("label_add_work_package_to_meeting_dialog_button"),- button_attributes: {- test_selector: "op-add-work-package-to-meeting-dialog-trigger"- }- ))- endendenddiff --git a/modules/meeting/app/components/work_package_meetings_tab/index_component.html.erb b/modules/meeting/app/components/work_package_meetings_tab/index_component.html.erbnew file mode 100644index 00000000000..47fb9b95c0a--- /dev/null+++ b/modules/meeting/app/components/work_package_meetings_tab/index_component.html.erb@@ -0,0 +1,33 @@+<%=+ content_tag("turbo-frame", id: "work-package-meetings-tab-content") do+ component_wrapper do+ flex_layout(test_selector: 'op-work-package-meetings-tab-container') do |flex|+ flex.with_row do+ render(WorkPackageMeetingsTab::HeadingComponent.new(work_package: @work_package))+ end+ flex.with_row(mt: 3) do+ render(Primer::Alpha::TabNav.new(label: "label")) do |component|+ component.with_tab(selected: @direction == :upcoming,+ href: work_package_meetings_tab_index_path(@work_package,+ direction: :upcoming)) do |tab|+ tab.with_text { t("label_upcoming_meetings_short") }+ tab.with_counter(count: @upcoming_meetings_count, test_selector: 'op-upcoming-meetings-counter')+ end+ component.with_tab(selected: @direction == :past,+ href: work_package_meetings_tab_index_path(@work_package,+ direction: :past)) do |tab|+ tab.with_text { t("label_past_meetings_short") }+ tab.with_counter(count: @past_meetings_count, test_selector: 'op-past-meetings-counter')+ end+ end+ end+ flex.with_row do+ render(WorkPackageMeetingsTab::ListComponent.new(+ agenda_items_grouped_by_meeting: @agenda_items_grouped_by_meeting,+ direction: @direction+ ))+ end+ end+ end+ end+%>diff --git a/modules/meeting/app/components/work_package_meetings_tab/index_component.rb b/modules/meeting/app/components/work_package_meetings_tab/index_component.rbindex 72f22eab228..6408da3eda9 100644--- a/modules/meeting/app/components/work_package_meetings_tab/index_component.rb+++ b/modules/meeting/app/components/work_package_meetings_tab/index_component.rb@@ -42,49 +42,5 @@ module WorkPackageMeetingsTab@upcoming_meetings_count = upcoming_meetings_count@past_meetings_count = past_meetings_countend-- def call- content_tag("turbo-frame", id: "work-package-meetings-tab-content") do- frame_content_partial- end- end-- private-- def frame_content_partial- component_wrapper do- flex_layout(test_selector: 'op-work-package-meetings-tab-container') do |flex|- flex.with_row do- render(WorkPackageMeetingsTab::HeadingComponent.new(work_package: @work_package))- end- flex.with_row(mt: 3) do- tabbed_navigation_partial- end- flex.with_row do- render(WorkPackageMeetingsTab::ListComponent.new(- agenda_items_grouped_by_meeting: @agenda_items_grouped_by_meeting,- direction: @direction- ))- end- end- end- end-- def tabbed_navigation_partial- render(Primer::Alpha::TabNav.new(label: "label")) do |component|- component.with_tab(selected: @direction == :upcoming,- href: work_package_meetings_tab_index_path(@work_package,- direction: :upcoming)) do |tab|- tab.with_text { t("label_upcoming_meetings_short") }- tab.with_counter(count: @upcoming_meetings_count, test_selector: 'op-upcoming-meetings-counter')- end- component.with_tab(selected: @direction == :past,- href: work_package_meetings_tab_index_path(@work_package,- direction: :past)) do |tab|- tab.with_text { t("label_past_meetings_short") }- tab.with_counter(count: @past_meetings_count, test_selector: 'op-past-meetings-counter')- end- end- endendenddiff --git a/modules/meeting/app/components/work_package_meetings_tab/list_component.html.erb b/modules/meeting/app/components/work_package_meetings_tab/list_component.html.erbnew file mode 100644index 00000000000..bc2d8269fff--- /dev/null+++ b/modules/meeting/app/components/work_package_meetings_tab/list_component.html.erb@@ -0,0 +1,23 @@+<%=+ if @agenda_items_grouped_by_meeting.any?+ flex_layout do |flex|+ @agenda_items_grouped_by_meeting.each do |meeting, meeting_agenda_items|+ flex.with_row(mt: 3) do+ render(WorkPackageMeetingsTab::MeetingComponent.new(+ meeting:, meeting_agenda_items:+ ))+ end+ end+ end+ else+ render(Primer::Beta::Blankslate.new(border: true)) do |component|+ component.with_visual_icon(icon: "comment-discussion")+ if @direction == :upcoming+ component.with_heading(tag: :h4).with_content(t("text_work_package_has_no_upcoming_meeting_agenda_items"))+ component.with_description { t("text_work_package_add_to_meeting_hint") }+ else+ component.with_heading(tag: :h4).with_content(t("text_work_package_has_no_past_meeting_agenda_items"))+ end+ end+ end+%>diff --git a/modules/meeting/app/components/work_package_meetings_tab/list_component.rb b/modules/meeting/app/components/work_package_meetings_tab/list_component.rbindex ee54d1ffffb..e3c13719ca8 100644--- a/modules/meeting/app/components/work_package_meetings_tab/list_component.rb+++ b/modules/meeting/app/components/work_package_meetings_tab/list_component.rb@@ -37,35 +37,5 @@ module WorkPackageMeetingsTab@agenda_items_grouped_by_meeting = agenda_items_grouped_by_meeting@direction = directionend-- def call- if @agenda_items_grouped_by_meeting.any?- flex_layout do |flex|- @agenda_items_grouped_by_meeting.each do |meeting, meeting_agenda_items|- flex.with_row(mt: 3) do- render(WorkPackageMeetingsTab::MeetingComponent.new(- meeting:, meeting_agenda_items:- ))- end- end- end- else- empty_state_partial- end- end-- private-- def empty_state_partial- render(Primer::Beta::Blankslate.new(border: true)) do |component|- component.with_visual_icon(icon: "comment-discussion")- if @direction == :upcoming- component.with_heading(tag: :h4).with_content(t("text_work_package_has_no_upcoming_meeting_agenda_items"))- component.with_description { t("text_work_package_add_to_meeting_hint") }- else- component.with_heading(tag: :h4).with_content(t("text_work_package_has_no_past_meeting_agenda_items"))- end- end- endendenddiff --git a/modules/meeting/app/components/work_package_meetings_tab/meeting_component.html.erb b/modules/meeting/app/components/work_package_meetings_tab/meeting_component.html.erbnew file mode 100644index 00000000000..3bd0638a0fe--- /dev/null+++ b/modules/meeting/app/components/work_package_meetings_tab/meeting_component.html.erb@@ -0,0 +1,25 @@+<%=+ render(Primer::Beta::BorderBox.new(padding: :condensed,+ test_selector: "op-meeting-container-#{@meeting.id}")) do |border_box|+ border_box.with_header do+ flex_layout do |flex|+ flex.with_column(mr: 1) do+ render(Primer::Beta::Link.new(href: meeting_path(@meeting), target: "_blank", font_size: :normal,+ font_weight: :bold, scheme: :primary, underline: false)) do+ @meeting.title+ end+ end+ flex.with_column do+ render(Primer::Beta::Text.new(font_size: :normal, color: :muted)) do+ format_time(@meeting.start_time)+ end+ end+ end+ end+ @meeting_agenda_items.each do |meeting_agenda_item|+ border_box.with_row do+ render(WorkPackageMeetingsTab::MeetingAgendaItemComponent.new(meeting_agenda_item:))+ end+ end+ end+%>diff --git a/modules/meeting/app/components/work_package_meetings_tab/meeting_component.rb b/modules/meeting/app/components/work_package_meetings_tab/meeting_component.rbindex 22f6a0cc1d9..432c61e2304 100644--- a/modules/meeting/app/components/work_package_meetings_tab/meeting_component.rb+++ b/modules/meeting/app/components/work_package_meetings_tab/meeting_component.rb@@ -37,45 +37,5 @@ module WorkPackageMeetingsTab@meeting = meeting@meeting_agenda_items = meeting_agenda_itemsend-- def call- render(Primer::Beta::BorderBox.new(padding: :condensed,- test_selector: "op-meeting-container-#{@meeting.id}")) do |border_box|- border_box.with_header do- header_partial- end- @meeting_agenda_items.each do |meeting_agenda_item|- border_box.with_row do- render(WorkPackageMeetingsTab::MeetingAgendaItemComponent.new(meeting_agenda_item:))- end- end- end- end-- private-- def header_partial- flex_layout do |flex|- flex.with_column(mr: 1) do- meeting_link_partial- end- flex.with_column do- meeting_time_partial- end- end- end-- def meeting_link_partial- render(Primer::Beta::Link.new(href: meeting_path(@meeting), target: "_blank", font_size: :normal,- font_weight: :bold, scheme: :primary, underline: false)) do- @meeting.title- end- end-- def meeting_time_partial- render(Primer::Beta::Text.new(font_size: :normal, color: :muted)) do- format_time(@meeting.start_time)- end- endendend