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
Add backlog component and visibility conditions
Mir Bhatia2a52c42b44ed
diff --git a/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/list_component.html.erbindex 9f78903439a..1c8b5dd03c0 100644--- a/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb@@ -3,12 +3,18 @@flex_layout(mb: 3) do |flex|if @meeting.template?flex.with_row(mb: 3) do- render Primer::Alpha::Banner.new(scheme: :default,- icon: :info,- dismiss_scheme: :none) do- t("recurring_meeting.template.banner_html",- link: link_to(@meeting.recurring_meeting.title,- project_recurring_meeting_path(@meeting.project, @meeting.recurring_meeting)))+ render Primer::Alpha::Banner.new(+ scheme: :default,+ icon: :info,+ dismiss_scheme: :none+ ) do+ t(+ "recurring_meeting.template.banner_html",+ link: link_to(+ @meeting.recurring_meeting.title,+ project_recurring_meeting_path(@meeting.project, @meeting.recurring_meeting)+ )+ )endendend@@ -16,7 +22,7 @@first_and_last = [@meeting.sections.first, @meeting.sections.last]render(MeetingSections::ShowComponent.with_collection(- @meeting.sections,+ sections_except_backlog,first_and_last:))diff --git a/modules/meeting/app/components/meeting_agenda_items/list_component.rb b/modules/meeting/app/components/meeting_agenda_items/list_component.rbindex 6a74a2f6a96..31a2f064bf4 100644--- a/modules/meeting/app/components/meeting_agenda_items/list_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/list_component.rb@@ -1,4 +1,5 @@# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -68,5 +69,9 @@ module MeetingAgendaItemsdef insert_target_modifier_id"meeting-section-new-item"end++ def sections_except_backlog+ @meeting.sections.reject(&:backlog?)+ endendenddiff --git a/modules/meeting/app/components/meeting_sections/backlog_component.html.erb b/modules/meeting/app/components/meeting_sections/backlog_component.html.erbnew file mode 100644index 00000000000..1055b549118--- /dev/null+++ b/modules/meeting/app/components/meeting_sections/backlog_component.html.erb@@ -0,0 +1,15 @@+<%=+ component_wrapper(data: wrapper_data_attributes) do+ if show?+ flex_layout(mb: 3) do |flex|+ flex.with_row(classes: "dragula-container", id: insert_target_modifier_id, data: { "allowed-drop-type": "section" }.merge(drop_target_config)) do+ render(+ MeetingSections::ShowComponent.new(+ meeting_section: @backlog+ )+ )+ end+ end+ end+ end+%>diff --git a/modules/meeting/app/components/meeting_sections/backlog_component.rb b/modules/meeting/app/components/meeting_sections/backlog_component.rbnew file mode 100644index 00000000000..2de8cf9f570--- /dev/null+++ b/modules/meeting/app/components/meeting_sections/backlog_component.rb@@ -0,0 +1,80 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module MeetingSections+ class BacklogComponent < ApplicationComponent+ include ApplicationHelper+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers++ def initialize(meeting:, form_hidden: true, form_type: :simple)+ super++ @meeting = meeting+ @form_hidden = form_hidden+ @form_type = form_type+ @backlog = meeting.backlog+ end++ def empty?+ @meeting.agenda_items.empty? && @meeting.sections.empty?+ end++ private++ def show?+ end++ def wrapper_data_attributes+ {+ controller: "generic-drag-and-drop",+ "application-target": "dynamic"+ }+ end++ def drop_target_config+ {+ "is-drag-and-drop-target": true,+ "target-container-accessor": ".Box > ul", # the accessor of the container that contains the drag and drop items+ "target-id": @backlog.id, # the id of the target+ "target-allowed-drag-type": "agenda-item" # the type of dragged items which are allowed to be dropped in this target+ }+ end++ def insert_target_modified?+ true+ end++ def insert_target_modifier_id+ "meeting-section-new-item"+ end+ end+enddiff --git a/modules/meeting/app/components/meeting_sections/header_component.html.erb b/modules/meeting/app/components/meeting_sections/header_component.html.erbindex bd763b7a6db..bbaea7e7b7c 100644--- a/modules/meeting/app/components/meeting_sections/header_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/header_component.html.erb@@ -7,18 +7,39 @@render(Primer::OpenProject::DragHandle.new(classes: "handle"))endend+grid.with_area(:content, tag: :span) dorender(Primer::Beta::Text.new(font_weight: :bold, mr: 2)) do@meeting_section.title.presence || I18n.t("meeting_section.untitled_title")endend- if @meeting_section.agenda_items_sum_duration_in_minutes > 0++ if @meeting_section.agenda_items_sum_duration_in_minutes > 0 && !backlog?grid.with_area(:duration, Primer::Beta::Text, color: :subtle, mr: 1) dorender(Primer::Beta::Text.new(font_weight: :normal, color: :subtle)) dorender(OpenProject::Common::DurationComponent.new(@meeting_section.agenda_items_sum_duration_in_minutes, :minutes, abbreviated: true))endendend++ if backlog?+ grid.with_area(:duration, ml: 1, mr: 1, classes: "backlog-header") do+ concat(render(Primer::Beta::Counter.new(count: @meeting_agenda_items.count, scheme: :primary, mr: 1)))+ concat(+ render(+ Primer::Beta::IconButton.new(+ tag: :a,+ scheme: :invisible,+ icon: @expanded ? "chevron-up" : "chevron-down",+ "aria-label": I18n.t(:label_agenda_backlog_toggle),+ href: toggle_meeting_section_path(@meeting, @meeting_section, expanded: @expanded),+ data: { turbo_stream: true }+ )+ )+ )+ end+ end+grid.with_area(:actions, tag: :div, justify_self: :end, classes: "hide-when-print") doif editable?render(Primer::Alpha::ActionMenu.new(data: { test_selector: "meeting-section-action-menu" })) do |menu|@@ -36,6 +57,14 @@endendend++ if backlog? && @expanded+ grid.with_area(:description, tag: :span, classes: "hide-when-print hidden-for-mobile") do+ render(Primer::Beta::Text.new(font_weight: :normal, color: :subtle)) do+ I18n.t(:text_agenda_backlog)+ end+ end+ endendelseprimer_form_with(diff --git a/modules/meeting/app/components/meeting_sections/header_component.rb b/modules/meeting/app/components/meeting_sections/header_component.rbindex 35ef3da18ab..8e2aaaddba5 100644--- a/modules/meeting/app/components/meeting_sections/header_component.rb+++ b/modules/meeting/app/components/meeting_sections/header_component.rb@@ -33,13 +33,15 @@ module MeetingSectionsinclude OpPrimer::ComponentHelpersinclude OpTurbo::Streamable- def initialize(meeting_section:, state: :show, first_and_last: [])+ def initialize(meeting_section:, state: :show, first_and_last: [], expanded: true)super@meeting_section = meeting_section+ @meeting = meeting_section.meeting@meeting_agenda_items = meeting_section.agenda_items@first_and_last = first_and_last@state = state+ @expanded = expandedendprivate@@ -162,5 +164,9 @@ module MeetingSectionsitem.with_leading_visual_icon(icon: :trash)endend++ def backlog?+ @meeting_section == @meeting.backlog+ endendenddiff --git a/modules/meeting/app/components/meeting_sections/header_component.sass b/modules/meeting/app/components/meeting_sections/header_component.sassindex e855233a9e5..34c61b2dd3b 100644--- a/modules/meeting/app/components/meeting_sections/header_component.sass+++ b/modules/meeting/app/components/meeting_sections/header_component.sass@@ -3,11 +3,12 @@.op-meeting-sectiondisplay: gridgrid-template-columns: 20px auto 1fr fit-content(40px)- grid-template-areas: "drag-handle content duration actions"+ grid-template-areas: "drag-handle content duration actions" ". description description description"&--drag-handle,&--duration,- &--content+ &--content,+ &--descriptionalign-self: center&--actions@@ -19,5 +20,9 @@&--content@include text-shortener+ .backlog-header+ display: flex+ align-items: center+@media screen and (max-width: $breakpoint-lg)grid-template-columns: 20px auto 1fr 50pxdiff --git a/modules/meeting/app/components/meeting_sections/show_component.html.erb b/modules/meeting/app/components/meeting_sections/show_component.html.erbindex 7795c5ec196..d067b55a575 100644--- a/modules/meeting/app/components/meeting_sections/show_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/show_component.html.erb@@ -3,7 +3,7 @@render(border_box_container(mt: 3, data: drag_and_drop_target_config)) do |component|if render_section_wrapper?component.with_header(font_weight: :bold, pl: 0) do- render(MeetingSections::HeaderComponent.new(meeting_section: @meeting_section, state: @state))+ render(MeetingSections::HeaderComponent.new(meeting_section: @meeting_section, state: @state, expanded: @expanded))endendif render_new_button_in_section?@@ -17,7 +17,7 @@endendend- else+ elsif @expandedfirst_and_last = [@meeting_agenda_items.first, @meeting_agenda_items.last]@meeting_agenda_items.each do |agenda_item|render(diff --git a/modules/meeting/app/components/meeting_sections/show_component.rb b/modules/meeting/app/components/meeting_sections/show_component.rbindex 4e0dd40ac6d..768152991af 100644--- a/modules/meeting/app/components/meeting_sections/show_component.rb+++ b/modules/meeting/app/components/meeting_sections/show_component.rb@@ -37,7 +37,7 @@ module MeetingSectionswith_collection_parameter :meeting_sectiondef initialize(meeting_section:, first_and_last: [], form_hidden: true, form_type: :simple, insert_target_modified: true,- force_wrapper: false, state: :show)+ force_wrapper: false, state: :show, expanded: true)super@meeting = meeting_section.meeting@@ -49,7 +49,7 @@ module MeetingSections@insert_target_modified = insert_target_modified@force_wrapper = force_wrapper@state = state- @backlog = meeting_section.backlog?+ @expanded = expandedendprivate@@ -70,11 +70,6 @@ module MeetingSections@meeting_section.editable? && User.current.allowed_in_project?(:manage_agendas, @meeting_section.project)end- def render?- # !@backlog- true- end-def render_section_wrapper?@force_wrapper || !@meeting_section.untitled? || @meeting.sections.count > 1enddiff --git a/modules/meeting/app/components/meetings/show_component.html.erb b/modules/meeting/app/components/meetings/show_component.html.erbindex 8f153034fd5..dbce8f3012a 100644--- a/modules/meeting/app/components/meetings/show_component.html.erb+++ b/modules/meeting/app/components/meetings/show_component.html.erb@@ -16,6 +16,10 @@render(MeetingAgendaItems::NewButtonComponent.new(meeting: @meeting))end+ agenda.with_row do+ render(MeetingSections::BacklogComponent.new(meeting: @meeting))+ end+agenda.with_row(mt: 3, display: [:block, nil, :none]) doresource = ::API::V3::Meetings::MeetingRepresenter.new(@meeting, current_user: User.current, embed_links: false)concat render(Primer::Beta::Heading.new(tag: :h4)) { I18n.t(:label_attachment_plural) }diff --git a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rbindex 063780eda58..ea44b942cc4 100644--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb@@ -143,7 +143,7 @@ module Meetingsenddef render_agenda_item_form_via_turbo_stream(meeting: @meeting, meeting_section: @meeting_section, type: :simple)- if meeting.sections.empty?+ if meeting.sections.empty? && meeting_section != meeting.backlogrender_agenda_item_form_for_empty_meeting_via_turbo_stream(type:)elserender_agenda_item_form_in_section_via_turbo_stream(meeting:, meeting_section:, type:)@@ -202,6 +202,14 @@ module Meetingsupdate_new_button_via_turbo_stream(disabled: false) if form_hidden == trueend+ def update_backlog_via_turbo_stream(meeting: @meeting)+ update_via_turbo_stream(+ component: MeetingSections::BacklogComponent.new(+ meeting:+ )+ )+ end+def update_item_via_turbo_stream(state: :show, meeting_agenda_item: @meeting_agenda_item, display_notes_input: nil)replace_via_turbo_stream(component: MeetingAgendaItems::ItemComponent.new(@@ -340,24 +348,26 @@ module Meetingsendend- def update_section_header_via_turbo_stream(meeting_section: @meeting_section, state: :show)+ def update_section_header_via_turbo_stream(meeting_section: @meeting_section, state: :show, expanded: true)update_via_turbo_stream(component: MeetingSections::HeaderComponent.new(meeting_section:,- state:+ state:,+ expanded:))enddef update_section_via_turbo_stream(meeting_section: @meeting_section, form_hidden: true, form_type: :simple,- force_wrapper: false, state: :show)+ force_wrapper: false, state: :show, expanded: true)update_via_turbo_stream(component: MeetingSections::ShowComponent.new(meeting_section:,form_type:,form_hidden:,force_wrapper:,- state:+ state:,+ expanded:))end@@ -430,6 +440,7 @@ module Meetingsupdate_sidebar_component_via_turbo_streamupdate_new_button_via_turbo_streamupdate_list_via_turbo_stream+ update_backlog_via_turbo_streamendendenddiff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rbindex 02cd387402b..de9e7dae4c1 100644--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb@@ -47,7 +47,11 @@ class MeetingAgendaItemsController < ApplicationControllerrender_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))elseif params[:meeting_section_id].present?- meeting_section = @meeting.sections.find(params[:meeting_section_id])+ meeting_section = if params[:meeting_section_id] == @meeting.backlog.id.to_s+ @meeting.backlog+ else+ @meeting.sections.find(params[:meeting_section_id])+ endendrender_agenda_item_form_via_turbo_stream(meeting_section:, type: @agenda_item_type)enddiff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rbindex c2e827c2ed8..9e2c13de404 100644--- a/modules/meeting/app/controllers/meeting_sections_controller.rb+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb@@ -170,6 +170,16 @@ class MeetingSectionsController < ApplicationControllerrespond_with_turbo_streamsend+ def toggle+ @meeting_section = MeetingSection.find(toggle_params[:id])+ next_state = !ActiveModel::Type::Boolean.new.cast(toggle_params[:expanded])++ update_section_header_via_turbo_stream(expanded: next_state)+ update_section_via_turbo_stream(expanded: next_state)++ respond_with_turbo_streams+ end+privatedef set_meeting@@ -204,4 +214,8 @@ class MeetingSectionsController < ApplicationController# show additional base error messagerender_base_error_in_flash_message_via_turbo_stream(call.errors)end++ def toggle_params+ @toggle_params ||= params.permit(:id, :expanded)+ endenddiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 7e42f08ddfa..daf304ef7e1 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -286,10 +286,13 @@ class MeetingsController < ApplicationControllercase params[:state]when "open"@meeting.open!+ expanded = truewhen "closed"@meeting.closed!+ expanded = nilwhen "in_progress"@meeting.in_progress!+ expanded = falseendif @meeting.errors.any?@@ -298,6 +301,10 @@ class MeetingsController < ApplicationControllerupdate_all_via_turbo_streamend+ @meeting_section = @meeting.backlog+ update_section_header_via_turbo_stream(expanded: expanded)+ update_section_via_turbo_stream(expanded: expanded)+respond_with_turbo_streamsenddiff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rbindex 04694c7b91b..be92639d731 100644--- a/modules/meeting/app/models/meeting.rb+++ b/modules/meeting/app/models/meeting.rb@@ -53,8 +53,8 @@ class Meeting < ApplicationRecordafter_add: :send_participant_added_mailhas_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem", inverse_of: :meeting- has_many :sections, dependent: :delete_all, class_name: "MeetingSection"- has_one :backlog, -> { where(backlog: true) }, class_name: "MeetingSection"+ has_many :sections, -> { where(backlog: false) }, dependent: :delete_all, class_name: "MeetingSection"+ has_one :backlog, -> { where(backlog: true) }, dependent: :destroy, class_name: "MeetingSection"accepts_nested_attributes_for :agenda_itemsdiff --git a/modules/meeting/app/services/meetings/create_service.rb b/modules/meeting/app/services/meetings/create_service.rbindex 99c59b2dd57..ab60482cb89 100644--- a/modules/meeting/app/services/meetings/create_service.rb+++ b/modules/meeting/app/services/meetings/create_service.rb@@ -55,7 +55,7 @@ module Meetings{meeting_id: meeting.id,backlog: true,- title: "Agenda backlog"+ title: I18n.t(:label_agenda_backlog)})enddiff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 54a9292a3c9..39b4eef1067 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -428,6 +428,11 @@ en:label_agenda_outcome_delete: "Remove outcome"text_outcome_not_editable_anymore: "This outcome is not editable anymore."+ label_agenda_backlog: "Agenda backlog"+ text_agenda_backlog: "The backlog is shared with all occurrences of this series. You can drag items in and out to add or remove them from a particular meeting. The backlog is only visible when the meeting status is open and hidden once the meeting is in progress."+ label_agenda_backlog_toggle: "Toggle"++text_agenda_item_title: 'Agenda item "%{title}"'text_agenda_work_package_deleted: 'Agenda item for deleted work package'text_deleted_agenda_item: 'Deleted agenda item'diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rbindex f2ff0936874..87d11300988 100644--- a/modules/meeting/config/routes.rb+++ b/modules/meeting/config/routes.rb@@ -119,6 +119,7 @@ Rails.application.routes.draw doget :cancel_editput :dropput :move+ get :toggleendendresources :outcomes, controller: "meeting_outcomes" dodiff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rbindex a522fb332c7..44adb9676b5 100644--- a/modules/meeting/lib/open_project/meeting/engine.rb+++ b/modules/meeting/lib/open_project/meeting/engine.rb@@ -48,7 +48,8 @@ module OpenProject::Meetingmeeting_minutes: %i[history show diff],"meetings/menus": %i[show],work_package_meetings_tab: %i[index count],- recurring_meetings: %i[index show new create download_ics]+ recurring_meetings: %i[index show new create download_ics],+ meeting_sections: %i[toggle]},permissible_on: :projectpermission :create_meetings,