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 responsible to agenda items

Oliver Günther0b560ea2cf13
diff --git a/modules/meeting/app/components/meeting_agenda_items/form_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/form_component.html.erb
index 0dc0ae003bc..579c35f98fd 100644
--- a/modules/meeting/app/components/meeting_agenda_items/form_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/form_component.html.erb
@@ -19,6 +19,10 @@
render(MeetingAgendaItem::Duration.new(f))
end
+ grid.with_area(:responsible) do
+ render(MeetingAgendaItem::Responsible.new(f))
+ end
+
grid.with_area(:notes,
display: display_notes_input_value,
data: { 'meeting-agenda-item-form-target': "notesInput" }) do
diff --git a/modules/meeting/app/components/meeting_agenda_items/form_component.sass b/modules/meeting/app/components/meeting_agenda_items/form_component.sass
index bca39db6f53..5daff020414 100644
--- a/modules/meeting/app/components/meeting_agenda_items/form_component.sass
+++ b/modules/meeting/app/components/meeting_agenda_items/form_component.sass
@@ -2,8 +2,8 @@
.op-meeting-agenda-item-form
display: grid
- grid-template-columns: 1fr 140px
- grid-template-areas: "title duration" "notes notes" "add_note actions"
+ grid-template-columns: 2fr 1fr 140px
+ grid-template-areas: "title responsible duration" "notes notes notes" "add_note actions actions"
grid-gap: 8px
&--actions
@@ -11,4 +11,4 @@
@media screen and (max-width: $breakpoint-sm)
grid-template-columns: 1fr auto
- grid-template-areas: "title title" "duration duration" "notes notes" "add_note actions"
+ grid-template-areas: "title title" "duration responsible" "notes notes" "add_note actions"
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 deac9f8fe52..d902067a7dd 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
@@ -50,13 +50,12 @@
end
end
- grid.with_area(:author, tag: :div, classes: 'ellipsis') do
- title = I18n.t(:label_added_time_by,
- author: @meeting_agenda_item.author.name,
- age: helpers.distance_of_time_in_words(Time.zone.now, @meeting_agenda_item.created_at))
- flex_layout do |flex|
- flex.with_column(classes: 'ellipsis') do
- render(Users::AvatarComponent.new(user: @meeting_agenda_item.author, size: 'mini', title:, classes: 'op-principal_flex'))
+ if @meeting_agenda_item.responsible
+ grid.with_area(:responsible, tag: :div, classes: 'ellipsis') do
+ flex_layout do |flex|
+ flex.with_column(classes: 'ellipsis') do
+ render(Users::AvatarComponent.new(user: @meeting_agenda_item.responsible, size: 'mini', title:, classes: 'op-principal_flex'))
+ end
end
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass
index ca6b6b69d11..0f7fda15d69 100644
--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass
+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.sass
@@ -1,23 +1,23 @@
@import 'helpers'
-$meeting-agenda-item--author-width: 300px
+$meeting-agenda-item--responsible-width: 300px
.op-meeting-agenda-item
display: grid
- grid-template-columns: 20px auto 1fr fit-content($meeting-agenda-item--author-width) fit-content(40px)
- grid-template-areas: "drag-handle content duration author actions" ". notes notes notes notes"
+ grid-template-columns: 20px auto 1fr fit-content($meeting-agenda-item--responsible-width) fit-content(40px)
+ grid-template-areas: "drag-handle content duration responsible actions" ". notes notes notes notes"
&--drag-handle,
&--duration,
&--content,
- &--author
+ &--responsible
align-self: center
&--actions
justify-self: end
- &--author
- max-width: $meeting-agenda-item--author-width
+ &--responsbile
+ max-width: $meeting-agenda-item--responsible-width
justify-self: end
&--duration
@@ -28,7 +28,7 @@ $meeting-agenda-item--author-width: 300px
@media screen and (max-width: $breakpoint-lg)
grid-template-columns: 20px auto 1fr 50px
- grid-template-areas: "drag-handle content content actions" ". author author duration" ". notes notes notes"
+ grid-template-areas: "drag-handle content content actions" ". responsible responsible duration" ". notes notes notes"
&--author
justify-self: stretch
diff --git a/modules/meeting/app/contracts/meeting_agenda_items/base_contract.rb b/modules/meeting/app/contracts/meeting_agenda_items/base_contract.rb
index 95dca7594e9..1367d5a5532 100644
--- a/modules/meeting/app/contracts/meeting_agenda_items/base_contract.rb
+++ b/modules/meeting/app/contracts/meeting_agenda_items/base_contract.rb
@@ -41,5 +41,6 @@ module MeetingAgendaItems
attribute :title
attribute :duration_in_minutes
attribute :notes
+ attribute :responsible
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 04b39da45cb..7e3e63550a6 100644
--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
@@ -197,7 +197,7 @@ class MeetingAgendaItemsController < ApplicationController
def meeting_agenda_item_params
params
.require(:meeting_agenda_item)
- .permit(:title, :duration_in_minutes, :notes, :work_package_id, :lock_version)
+ .permit(:title, :duration_in_minutes, :responsible_id, :notes, :work_package_id, :lock_version)
end
def generic_call_failure_response(call)
diff --git a/modules/meeting/app/forms/meeting_agenda_item/responsible.rb b/modules/meeting/app/forms/meeting_agenda_item/responsible.rb
new file mode 100644
index 00000000000..6c52851e305
--- /dev/null
+++ b/modules/meeting/app/forms/meeting_agenda_item/responsible.rb
@@ -0,0 +1,52 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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.
+#++
+
+class MeetingAgendaItem::Responsible < ApplicationForm
+ form do |f|
+ f.user_autocompleter(
+ name: :responsible_id,
+ label: I18n.t("attributes.responsible"),
+ visually_hide_label: true,
+ autocomplete_options: {
+ url: ::API::V3::Utilities::PathHelper::ApiV3Path.principals,
+ filters: [{ name: "type", operator: "=", values: %w[User Group] },
+ { name: "member", operator: "=", values: [@builder.object.meeting.project_id] },
+ { name: "status", operator: "=", values: [Principal.statuses[:active], Principal.statuses[:invited]] }],
+ searchKey: "any_name_attribute",
+ multiple: false,
+ focusDirectly: false,
+ appendTo: "body",
+ disabled: @disabled
+ }
+ )
+ end
+
+ def initialize(disabled: false)
+ @disabled = disabled
+ end
+end
diff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rb
index c643fd9dd6f..a5b0751467b 100644
--- a/modules/meeting/app/models/meeting_agenda_item.rb
+++ b/modules/meeting/app/models/meeting_agenda_item.rb
@@ -39,6 +39,7 @@ class MeetingAgendaItem < ApplicationRecord
belongs_to :work_package, class_name: "::WorkPackage"
has_one :project, through: :meeting
belongs_to :author, class_name: "User", optional: false
+ belongs_to :responsible, class_name: "User", optional: true
acts_as_list scope: :meeting
default_scope { order(:position) }
diff --git a/modules/meeting/db/migrate/20240313102951_add_responsible_to_meeting.rb b/modules/meeting/db/migrate/20240313102951_add_responsible_to_meeting.rb
new file mode 100644
index 00000000000..77b0df351a1
--- /dev/null
+++ b/modules/meeting/db/migrate/20240313102951_add_responsible_to_meeting.rb
@@ -0,0 +1,6 @@
+class AddResponsibleToMeeting < ActiveRecord::Migration[7.1]
+ def change
+ add_reference :meeting_agenda_items, :responsible, type: :bigint, foreign_key: { to_table: :users }, index: true
+ add_reference :meeting_agenda_item_journals, :responsible, type: :bigint, foreign_key: { to_table: :users }, index: true
+ end
+end