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

Handle series occurrences

Mir Bhatia91cb9cf85165
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 5752adbd881..00699fc68bc 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
@@ -80,11 +80,14 @@
with_item_group(submenu) { move_actions(submenu) } unless first? && last?
with_item_group(submenu) do
- if !in_template? && !in_backlog?
- move_to_backlog_action_item(submenu)
+ if !in_template? || in_backlog?
+ if in_backlog?
+ move_to_current_meeting_action_item(submenu) if !visible_sections?
+ else
+ move_to_backlog_action_item(submenu)
+ end
+ move_to_section_action_item(submenu) if visible_sections?
end
-
- move_to_section_action_item(submenu) if in_section?
end
with_item_group(submenu) do
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 9be71d4452f..28b611ebfef 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
@@ -229,12 +229,15 @@ module MeetingAgendaItems
return unless editable?
menu.with_item(label: I18n.t(:label_agenda_item_move_to_section),
- href: move_to_section_dialog_meeting_agenda_item_path(
- @meeting_agenda_item.meeting,
- @meeting_agenda_item
- ),
+ tag: :button,
content_arguments: {
- data: { controller: "async-dialog" }
+ data: {
+ action: "click->meetings--add-params#interceptMoveTo",
+ href: move_to_section_dialog_meeting_agenda_item_path(
+ @meeting_agenda_item.meeting,
+ @meeting_agenda_item
+ )
+ }
}) do |item|
item.with_leading_visual_icon(icon: "op-move")
end
@@ -269,5 +272,11 @@ module MeetingAgendaItems
def in_section?
true
end
+
+ def visible_sections?
+ return true if @meeting.templated?
+
+ @meeting.sections.many? && @meeting.sections.first.title.blank?
+ end
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.html.erb
index 9b35078b365..310ad68cc9c 100644
--- a/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.html.erb
@@ -38,6 +38,7 @@ See COPYRIGHT and LICENSE files for more details.
dialog.with_body do
render(
MeetingAgendaItems::MoveToSectionFormComponent.new(
+ meeting: @meeting,
agenda_item: @agenda_item
)
)
diff --git a/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.rb b/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.rb
index b5db5e3dd4b..6968029610f 100644
--- a/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/move_to_section_dialog_component.rb
@@ -34,14 +34,11 @@ module MeetingAgendaItems
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
- def initialize(agenda_item:)
+ def initialize(meeting:, agenda_item:)
super
+ @meeting = meeting
@agenda_item = agenda_item
end
-
- private
-
-
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb
index 8a851afdd74..076c5db927b 100644
--- a/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.html.erb
@@ -45,7 +45,7 @@ See COPYRIGHT and LICENSE files for more details.
end
end
flex.with_row(mb: 3) do
- render(Meeting::AddToSection.new(f, wrapper_id: "move-to-section-dialog"))
+ render(Meeting::AddToSection.new(f, wrapper_id: "move-to-section-dialog", occurrence: @meeting))
end
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.rb b/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.rb
index 5675e128194..d1554662784 100644
--- a/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/move_to_section_form_component.rb
@@ -34,9 +34,10 @@ module MeetingAgendaItems
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers
- def initialize(agenda_item:)
+ def initialize(meeting:, agenda_item:)
super
+ @meeting = meeting
@agenda_item = agenda_item
end
end
diff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
index 135c1feffe7..9f11be858b9 100644
--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
@@ -250,8 +250,10 @@ class MeetingAgendaItemsController < ApplicationController
end
def move_to_section_dialog
+ meeting = params[:current_meeting_id].present? ? Meeting.find(params[:current_meeting_id]) : @meeting_agenda_item.meeting
respond_with_dialog MeetingAgendaItems::MoveToSectionDialogComponent.new(
- agenda_item: @meeting_agenda_item
+ agenda_item: @meeting_agenda_item,
+ meeting:
)
end
diff --git a/modules/meeting/app/forms/meeting/add_to_section.rb b/modules/meeting/app/forms/meeting/add_to_section.rb
index f5c197f57c2..251bd22d8a9 100644
--- a/modules/meeting/app/forms/meeting/add_to_section.rb
+++ b/modules/meeting/app/forms/meeting/add_to_section.rb
@@ -33,7 +33,7 @@ class Meeting::AddToSection < ApplicationForm
meeting_form.autocompleter(
name: :meeting_section_id,
label: I18n.t("label_add_work_package_to_meeting_section_label"),
- caption: I18n.t("label_section_selection_caption"),
+ caption:,
input_width: :large,
autocomplete_options: {
decorated: true,
@@ -55,10 +55,11 @@ class Meeting::AddToSection < ApplicationForm
end
end
- def initialize(wrapper_id: nil)
+ def initialize(wrapper_id: nil, occurrence: nil)
super()
@wrapper_id = wrapper_id
+ @occurrence = occurrence
end
private
@@ -71,7 +72,8 @@ class Meeting::AddToSection < ApplicationForm
def items
items = []
- items.concat(meeting.sections) unless meeting.blank? || any_non_backlog_sections?
+ items.concat(meeting.sections) unless meeting.blank? || meeting.templated?
+ items.concat(@occurrence.sections) if @occurrence.present? && @occurrence != meeting
items.push(meeting.backlog) if meeting.present?
items
@@ -97,10 +99,14 @@ class Meeting::AddToSection < ApplicationForm
end
def any_non_backlog_sections?
- meeting.sections.none? || (meeting.sections.one? && meeting.sections.first.title.blank?)
+ meeting.sections.none? || (meeting.sections.many? && meeting.sections.first.title.blank?)
end
def placeholder_text
I18n.t("placeholder_section_select_meeting_first") if meeting.blank?
end
+
+ def caption
+ I18n.t("label_section_selection_caption") if @occurrence.nil?
+ end
end
diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rb
index 73d7dedd2b6..aa2035891b9 100644
--- a/modules/meeting/config/routes.rb
+++ b/modules/meeting/config/routes.rb
@@ -113,7 +113,7 @@ Rails.application.routes.draw do
put :move
get :move_to_next_dialog, action: :move_to_next_meeting_dialog
post :move_to_next, action: :move_to_next_meeting
- get :move_to_section_dialog
+ put :move_to_section_dialog
post :move_to_section
end
end