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

Update visibility conditions for series backlogs

Mir Bhatiadf35fd433d25
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb
index 733da063623..c3a33b187fa 100644
--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb
@@ -77,9 +77,11 @@
move_actions(menu)
end
- menu.with_divider if OpenProject::FeatureDecisions.meeting_backlogs_active?
- move_to_current_meeting_action_item(menu) if in_backlog? && OpenProject::FeatureDecisions.meeting_backlogs_active?
- move_to_backlog_action_item(menu) if !in_backlog? && OpenProject::FeatureDecisions.meeting_backlogs_active?
+ if !in_template?
+ menu.with_divider if OpenProject::FeatureDecisions.meeting_backlogs_active?
+ move_to_current_meeting_action_item(menu) if move_to_current_meeting_action?
+ move_to_backlog_action_item(menu) if move_to_backlog_action?
+ end
if move_to_next_meeting_enabled?
menu.with_divider
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
index b643c00adae..be737e35486 100644
--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
@@ -134,7 +134,7 @@ module MeetingAgendaItems
end
def move_to_next_meeting_action_item(menu)
- return if @meeting.templated?
+ return if in_template?
return if @series.nil?
next_date = @series.next_occurrence(from_time: @meeting.start_time)
@@ -228,11 +228,23 @@ module MeetingAgendaItems
end
def move_to_next_meeting_enabled?
- edit_enabled? && @meeting.recurring? && @meeting.recurring_meeting&.next_occurrence.present?
+ edit_enabled? && @meeting.recurring? && @meeting.recurring_meeting&.next_occurrence.present? && !in_template?
end
def in_backlog?
- @meeting_agenda_item.meeting_section == @meeting.backlog
+ @meeting_agenda_item.meeting_section.backlog?
+ end
+
+ def move_to_current_meeting_action?
+ in_backlog? && OpenProject::FeatureDecisions.meeting_backlogs_active?
+ end
+
+ def move_to_backlog_action?
+ !in_backlog? && OpenProject::FeatureDecisions.meeting_backlogs_active?
+ end
+
+ def in_template?
+ @meeting.templated?
end
end
end
diff --git a/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb
index d4c98edf6f7..a31fc726186 100644
--- a/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb
+++ b/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb
@@ -37,7 +37,6 @@ module MeetingSections
super
@meeting = meeting
- # @project = series.project
end
end
end
diff --git a/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb
index 8cce4d0ff7a..415158d3c0f 100644
--- a/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb
+++ b/modules/meeting/app/components/meeting_sections/backlogs/container_component.rb
@@ -42,14 +42,12 @@ module MeetingSections
@backlog = meeting.backlog
end
- # def empty?
- # @meeting.agenda_items.empty? && @meeting.sections.empty?
- # end
-
private
def show?
+ OpenProject::FeatureDecisions.meeting_backlogs_active?
end
end
end
diff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb b/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb
index b279e165410..9e1f7b67b6e 100644
--- a/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb
+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb
@@ -1,30 +1,27 @@
<%=
component_wrapper do
- if show?
- flex_layout(align_items: :flex_start) do |flex|
- flex.with_column(flex: 1, pt: 1) do
- render(
- Primer::OpenProject::BorderBox::CollapsibleHeader.new(
- box: @box, collapsed: @collapsed
- )
- ) do |header|
- header.with_title(font_weight: :bold) { I18n.t("label_agenda_backlog") }
- header.with_description { I18n.t("text_agenda_backlog") }
- header.with_count(count: @backlog.agenda_items.count)
- end
+ flex_layout(align_items: :flex_start) do |flex|
+ flex.with_column(flex: 1, pt: 1) do
+ render(
+ Primer::OpenProject::BorderBox::CollapsibleHeader.new(
+ box: @box, collapsed: @collapsed
+ )
+ ) do |header|
+ header.with_title(font_weight: :bold) { I18n.t("label_agenda_backlog") }
+ header.with_description { I18n.t("text_agenda_backlog") }
+ header.with_count(count: @backlog.agenda_items.count)
end
+ end
- flex.with_column(classes: "hide-when-print") do
- render(Primer::Alpha::ActionMenu.new(data: { test_selector: "meeting-section-action-menu" })) do |menu|
- menu.with_show_button(icon: "kebab-horizontal", "aria-label": t("settings.project_attributes.label_section_actions"), scheme: :invisible)
- add_agenda_item_action(menu)
- add_work_package_action(menu)
- menu.with_divider
- clear_action_item(menu)
- end
+ flex.with_column(classes: "hide-when-print") do
+ render(Primer::Alpha::ActionMenu.new(data: { test_selector: "meeting-section-action-menu" })) do |menu|
+ menu.with_show_button(icon: "kebab-horizontal", "aria-label": t("settings.project_attributes.label_section_actions"), scheme: :invisible)
+ add_agenda_item_action(menu)
+ add_work_package_action(menu)
+ menu.with_divider
+ clear_action_item(menu)
end
end
-
end
end
%>
diff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb
index 3ab5683f066..3e2acbcbd90 100644
--- a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb
+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb
@@ -46,10 +46,6 @@ module MeetingSections
private
- def show?
- end
-
def default
if @meeting.open?
false
diff --git a/modules/meeting/app/components/meeting_sections/show_component.html.erb b/modules/meeting/app/components/meeting_sections/show_component.html.erb
index 680505a94fd..b98e72b463d 100644
--- a/modules/meeting/app/components/meeting_sections/show_component.html.erb
+++ b/modules/meeting/app/components/meeting_sections/show_component.html.erb
@@ -5,7 +5,7 @@
component.with_header(font_weight: :bold, pl: 0) do
render(MeetingSections::HeaderComponent.new(meeting_section: @meeting_section, state: @state))
end
- elsif OpenProject::FeatureDecisions.meeting_backlogs_active? && render_backlog? && [email protected]?
+ elsif render_backlog?
component.with_header do
render(MeetingSections::Backlogs::HeaderComponent.new(backlog: @meeting_section, box: component, collapsed: @collapsed))
end
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index be92639d731..8dad3218a12 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -54,7 +54,7 @@ class Meeting < ApplicationRecord
has_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem", inverse_of: :meeting
has_many :sections, -> { where(backlog: false) }, dependent: :delete_all, class_name: "MeetingSection"
- has_one :backlog, -> { where(backlog: true) }, dependent: :destroy, class_name: "MeetingSection"
+ has_one :own_backlog, -> { where(backlog: true) }, dependent: :destroy, class_name: "MeetingSection"
accepts_nested_attributes_for :agenda_items
@@ -277,6 +277,14 @@ class Meeting < ApplicationRecord
agenda_items_sum_duration_in_minutes - (duration * 60)
end
+ def backlog
+ if recurring? && !templated?
+ recurring_meeting.template.backlog
+ else
+ own_backlog
+ end
+ end
+
private
def add_new_participants_as_watcher