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

Use current_occurrence to decide possible actions

Mir Bhatia4b08cf06ef57
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 00699fc68bc..7a0f68d0075 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
@@ -76,22 +76,24 @@
end
with_item_group(menu) do
- menu.with_sub_menu_item(label: "Move") do |submenu|
- with_item_group(submenu) { move_actions(submenu) } unless first? && last?
+ if editable?
+ menu.with_sub_menu_item(label: "Move") do |submenu|
+ with_item_group(submenu) { move_actions(submenu) } unless first? && last?
- with_item_group(submenu) do
- 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)
+ with_item_group(submenu) do
+ 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 visible_sections?
end
- end
- with_item_group(submenu) do
- move_to_next_meeting_action_item(submenu) if move_to_next_meeting_enabled?
+ with_item_group(submenu) do
+ move_to_next_meeting_action_item(submenu) if move_to_next_meeting_enabled?
+ end
end
end
end
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 c5532734bfb..7a73d9c848d 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
@@ -214,7 +214,12 @@ module MeetingAgendaItems
tag: :button,
content_arguments: { data: {
action: "click->meetings--add-params#interceptMoveTo",
- href: drop_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, type: :to_backlog)
+ href: drop_meeting_agenda_item_path(
+ @meeting_agenda_item.meeting,
+ @meeting_agenda_item,
+ type: :to_backlog,
+ current_occurrence: @current_occurrence
+ )
} }) do |item|
item.with_leading_visual_icon(icon: "discussion-outdated")
end
@@ -222,12 +227,18 @@ module MeetingAgendaItems
def move_to_current_meeting_action_item(menu)
return unless editable?
+ return if many_sections?
menu.with_item(label: I18n.t(:label_agenda_item_move_to_current_meeting),
tag: :button,
content_arguments: { data: {
action: "click->meetings--add-params#interceptMoveTo",
- href: drop_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, type: :to_current)
+ href: drop_meeting_agenda_item_path(
+ @meeting_agenda_item.meeting,
+ @meeting_agenda_item,
+ type: :to_current,
+ current_occurrence: @current_occurrence
+ )
} }) do |item|
item.with_leading_visual_icon(icon: "cross-reference")
end
@@ -235,17 +246,16 @@ module MeetingAgendaItems
def move_to_section_action_item(menu)
return unless editable?
+ return unless many_sections?
menu.with_item(label: I18n.t(:label_agenda_item_move_to_section),
- tag: :button,
- content_arguments: {
- data: {
- action: "click->meetings--add-params#interceptMoveTo",
- href: move_to_section_dialog_meeting_agenda_item_path(
- @meeting_agenda_item.meeting,
- @meeting_agenda_item
- )
- }
+ href: move_to_section_dialog_meeting_agenda_item_path(
+ @meeting_agenda_item.meeting,
+ @meeting_agenda_item,
+ current_occurrence: @current_occurrence
+ ),
+ form_arguments: {
+ method: :put, data: { "turbo-stream": true }
}) do |item|
item.with_leading_visual_icon(icon: "op-move")
end
@@ -273,6 +283,12 @@ module MeetingAgendaItems
@meeting.templated?
end
+ def move_to_different_section_or_meeting_action_added?
+ return false unless editable?
+
+ !in_template? || in_backlog? || move_to_next_meeting_enabled?
+ end
+
def editable?
@editable ||= @meeting_agenda_item.editable? && can_manage_agendas?
end
@@ -281,10 +297,18 @@ module MeetingAgendaItems
true
end
- def visible_sections?
- return true if @meeting.templated?
+ # def visible_sections?
+ # return true if @meeting.templated?
+ #
+ # @meeting.sections.many?
+ # end
- @meeting.sections.many? && @meeting.sections.first.title.blank?
+ def many_sections?
+ if @meeting_agenda_item.in_backlog? && @current_occurrence.present?
+ @current_occurrence.sections.many?
+ else
+ @meeting.sections.many?
+ end
end
end
end