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

Add outcome option to agenda item menu

Mir Bhatiabbc9c7831831
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 93aa74942a1..b6654f819ab 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
@@ -67,6 +67,7 @@
)
edit_action_item(menu) if @meeting_agenda_item.editable?
add_note_action_item(menu) if @meeting_agenda_item.editable? && @meeting_agenda_item.notes.blank?
+ add_outcome_action_item(menu) if @meeting_agenda_item.editable? && @meeting.in_progress? && outcome_enabled? && !@meeting_agenda_item.outcomes.exists?
unless first? && last?
menu.with_divider
move_actions(menu)
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 81e5a6edfa8..e0c5decc108 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
@@ -105,6 +105,17 @@ module MeetingAgendaItems
end
end
+ def add_outcome_action_item(menu)
+ menu.with_item(label: t("label_agenda_item_add_outcome"),
+ href: new_meeting_outcome_path(@meeting_agenda_item.meeting,
+ meeting_agenda_item_id: @meeting_agenda_item&.id),
+ content_arguments: {
+ data: { "turbo-stream": true }
+ }) do |item|
+ item.with_leading_visual_icon(icon: :plus)
+ end
+ end
+
def copy_action_item(menu)
url = meeting_url(@meeting, anchor: "item-#{@meeting_agenda_item.id}")
menu.with_item(label: t("button_copy_link_to_clipboard"),
diff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erb
index 824162e8767..355e7aa2c66 100644
--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.html.erb
@@ -2,7 +2,7 @@
component_wrapper do
render(Primer::Box.new(p: 3, classes: "outcome-container", border_radius: 2)) do
grid_layout("op-meeting-outcome-notes", tag: :div, id: "item-#{@meeting_outcome.id}") do |grid|
- grid.with_area(:title, tag: :span) do
+ grid.with_area(:title, tag: :span, classes: "title") do
render(Primer::Beta::Heading.new(tag: :h5)) { "Outcome" }
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sass b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sass
index 17f860f4c73..5244707e446 100644
--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sass
+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.sass
@@ -3,6 +3,10 @@
.outcome-container
background-color: var(--grid-background-color)
+ // To prevent flickering when changing meeting states due to the actions button icon
+ .title
+ height: 32px
+
.op-meeting-outcome-notes
display: grid
grid-template-columns: auto fit-content(40px)
diff --git a/modules/meeting/app/controllers/meeting_outcomes_controller.rb b/modules/meeting/app/controllers/meeting_outcomes_controller.rb
index 5ffb204fe6a..f416bbee9ee 100644
--- a/modules/meeting/app/controllers/meeting_outcomes_controller.rb
+++ b/modules/meeting/app/controllers/meeting_outcomes_controller.rb
@@ -40,10 +40,11 @@ class MeetingOutcomesController < ApplicationController
before_action :authorize, except: %i[new create]
def new
+ update_all_via_turbo_stream
+
if @meeting.in_progress?
render_outcome_form_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item)
else
- update_all_via_turbo_stream
render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))
end
@@ -65,16 +66,14 @@ class MeetingOutcomesController < ApplicationController
)
@meeting_outcome = call.result
-
if call.success?
render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,
meeting_outcome: @meeting_outcome, hide_notes: false, state: :show)
- # else
- # # show errors
+ else
# update_new_component_via_turbo_stream(
# hidden: false, meeting_agenda_item: @meeting_agenda_item, type: @agenda_item_type
# )
- # render_base_error_in_flash_message_via_turbo_stream(call.errors)
+ render_base_error_in_flash_message_via_turbo_stream(call.errors)
end
respond_with_turbo_streams
@@ -114,6 +113,7 @@ class MeetingOutcomesController < ApplicationController
if call.success?
render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,
meeting_outcome: call.result, hide_notes: false, state: :show)
+ update_all_via_turbo_stream
# else
end
@@ -129,6 +129,7 @@ class MeetingOutcomesController < ApplicationController
if call.success?
render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,
hide_notes: true)
+ update_all_via_turbo_stream
# else
end
diff --git a/modules/meeting/app/models/meeting_outcome.rb b/modules/meeting/app/models/meeting_outcome.rb
index b08bd151b9d..2ac1e084b2e 100644
--- a/modules/meeting/app/models/meeting_outcome.rb
+++ b/modules/meeting/app/models/meeting_outcome.rb
@@ -50,6 +50,6 @@ class MeetingOutcome < ApplicationRecord
# end
def editable?
- !meeting_agenda_item.meeting&.closed?
+ meeting_agenda_item.meeting&.in_progress?
end
end
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index 40227100796..444af587fec 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -423,12 +423,14 @@ en:
label_agenda_item_move_up: "Move up"
label_agenda_item_move_down: "Move down"
label_agenda_item_add_notes: "Add notes"
+ label_agenda_item_add_outcome: "Add outcome"
label_agenda_item_work_package: "Agenda item work package"
label_agenda_outcome_actions: "Agenda outcome actions"
label_agenda_outcome_edit: "Edit outcome"
label_agenda_outcome_delete: "Remove outcome"
+ text_outcome_not_editable_anymore: "This outcome is not editable anymore."
text_agenda_item_title: 'Agenda item "%{title}"'
text_agenda_work_package_deleted: 'Agenda item for deleted work package'