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

WIP: Introduce sections for meetings

Jonas Jabarif7c8686b0f69
diff --git a/db/migrate/20240405131352_create_meeting_sections.rb b/db/migrate/20240405131352_create_meeting_sections.rb
new file mode 100644
index 00000000000..62326500f0c
--- /dev/null
+++ b/db/migrate/20240405131352_create_meeting_sections.rb
@@ -0,0 +1,32 @@
+class CreateMeetingSections < ActiveRecord::Migration[7.1]
+ def up
+ create_table :meeting_sections do |t|
+ t.integer :position
+ t.string :name
+ t.references :meeting, null: false, foreign_key: true
+
+ t.timestamps
+ end
+
+ add_reference :meeting_agenda_items, :meeting_section
+
+ create_and_assign_default_section
+ end
+
+ def down
+ remove_reference :meeting_agenda_items, :meeting_section
+ drop_table :meeting_sections
+ end
+
+ private
+
+ def create_and_assign_default_section
+ StructuredMeeting.includes(:agenda_items).find_each do |meeting|
+ section = MeetingSection.create!(
+ meeting:,
+ name: "Untitled"
+ )
+ meeting.agenda_items.update_all(meeting_section_id: section.id)
+ end
+ end
+end
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component.rb
index e52d1cb514b..9cdae6d281c 100644
--- a/modules/meeting/app/components/meeting_agenda_items/item_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/item_component.rb
@@ -86,6 +86,8 @@ module MeetingAgendaItems
scheme: :default,
data: {
id: @meeting_agenda_item.id,
+ "draggable-id": @meeting_agenda_item.id,
+ "draggable-type": "agenda-item",
"drop-url": drop_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item)
}
}
diff --git a/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb
index 76e1fcdd821..95bb68b2a04 100644
--- a/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/list_component.html.erb
@@ -2,38 +2,42 @@
component_wrapper(data: wrapper_data_attributes) do
# The borderBox needs to be `position: relative` because of bug #49853
# (The action menu items float somewhere on the page as soon as you have to scroll the Box in Firefox)
- render(Primer::Beta::BorderBox.new(position: :relative)) do |border_box|
- if @meeting.agenda_items.empty? && @form_hidden
- border_box.with_body(
- scheme: :default
- ) do
- render(Primer::Beta::Blankslate.new) do |component|
- component.with_visual_icon(icon: :book)
- component.with_heading(tag: :h2).with_content(t("text_meeting_empty_heading"))
- component.with_description do
- flex_layout do |flex|
- flex.with_row(mb: 2) do
- render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_empty_description_1") }
- end
- flex.with_row do
- render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_empty_description_2") }
- end
- end
- end
- end
- end
- else
- first_and_last = [@meeting.agenda_items.first, @meeting.agenda_items.last]
+ flex_layout do |flex|
+ flex.with_row do
+ first_and_last = [@meeting.sections.first, @meeting.sections.last]
render(
- MeetingAgendaItems::ItemComponent.with_collection(
- @meeting.agenda_items.with_includes_to_render,
- container: border_box,
+ MeetingSections::ShowComponent.with_collection(
+ @meeting.sections,
first_and_last:
)
)
end
- border_box.with_row(p: 0, border_top: 0, id: insert_target_modifier_id) do
- render(MeetingAgendaItems::NewComponent.new(meeting: @meeting, hidden: @form_hidden, type: @form_type))
+ flex.with_row do
+ render(Primer::Beta::BorderBox.new(position: :relative)) do |border_box|
+ if @meeting.agenda_items.empty? && @form_hidden
+ border_box.with_body(
+ scheme: :default
+ ) do
+ render(Primer::Beta::Blankslate.new) do |component|
+ component.with_visual_icon(icon: :book)
+ component.with_heading(tag: :h2).with_content(t("text_meeting_empty_heading"))
+ component.with_description do
+ flex_layout do |flex|
+ flex.with_row(mb: 2) do
+ render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_empty_description_1") }
+ end
+ flex.with_row do
+ render(Primer::Beta::Text.new(color: :subtle)) { t("text_meeting_empty_description_2") }
+ end
+ end
+ end
+ end
+ end
+ end
+ border_box.with_row(p: 0, border_top: 0, id: insert_target_modifier_id) do
+ render(MeetingAgendaItems::NewComponent.new(meeting: @meeting, hidden: @form_hidden, type: @form_type))
+ end
+ end
end
end
end
diff --git a/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb
index ce0328f583d..f892534554b 100644
--- a/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb
+++ b/modules/meeting/app/components/meeting_agenda_items/new_button_component.html.erb
@@ -1,5 +1,5 @@
<%=
- component_wrapper(class: "mt-3", style: 'position: relative') do
+ component_wrapper(class: "mt-3", style: "position: relative") do
render(Primer::Alpha::ActionMenu.new) do |component|
component.with_show_button(scheme: :primary, disabled: @disabled) do |button|
button.with_leading_visual_icon(icon: :plus)
@@ -10,7 +10,7 @@
tag: :a,
content_arguments: {
href: new_meeting_agenda_item_path(@meeting, type: "simple"),
- data: { 'turbo-stream': true }
+ data: { "turbo-stream": true }
}
)
component.with_item(
@@ -18,7 +18,15 @@
tag: :a,
content_arguments: {
href: new_meeting_agenda_item_path(@meeting, type: "work_package"),
- data: { 'turbo-stream': true }
+ data: { "turbo-stream": true }
+ }
+ )
+ component.with_item(
+ label: "Section",
+ tag: :a,
+ content_arguments: {
+ href: meeting_sections_path(@meeting),
+ data: { "turbo-stream": true, "turbo-method": :post }
}
)
end
diff --git a/modules/meeting/app/components/meeting_sections/header_component.html.erb b/modules/meeting/app/components/meeting_sections/header_component.html.erb
new file mode 100644
index 00000000000..f06e791b3a2
--- /dev/null
+++ b/modules/meeting/app/components/meeting_sections/header_component.html.erb
@@ -0,0 +1,59 @@
+<%=
+ component_wrapper(class: "op-meeting-section-container", data: { test_selector: "meeting-section-container-#{@meeting_section.id}" }) do
+ if @state == :show
+ flex_layout(justify_content: :space_between, align_items: :center) do |section_header_container|
+ section_header_container.with_column(flex_layout: true, align_items: :center) do |content_container|
+ content_container.with_column(mr: 2) do
+ render(Primer::OpenProject::DragHandle.new(classes: 'handle'))
+ end
+ content_container.with_column do
+ render(Primer::Beta::Text.new(font_weight: :bold)) do
+ @meeting_section.name
+ end
+ end
+ end
+ section_header_container.with_column(flex_layout: true, justify_content: :flex_end) do |actions_container|
+ actions_container.with_column 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)
+ edit_action_item(menu)
+ # move_actions(menu)
+ if @meeting_agenda_items.empty?
+ delete_action_item(menu)
+ else
+ disabled_delete_action_item(menu)
+ end
+ end
+ end
+ end
+ end
+ else
+ primer_form_with(
+ model: @meeting_section,
+ method: :put,
+ url: meeting_section_path(@meeting_section.meeting, @meeting_section),
+ ) do |f|
+ flex_layout do |editable_title_form|
+ editable_title_form.with_column(flex: 1, mr: 2) do
+ render(MeetingSection::Name.new(f))
+ end
+
+ editable_title_form.with_column(mr: 2) do
+ render(MeetingSection::Submit.new(f))
+ end
+
+ editable_title_form.with_column do
+ render(Primer::Beta::Button.new(
+ scheme: :secondary,
+ tag: :a,
+ href: cancel_edit_meeting_section_path(@meeting_section.meeting, @meeting_section),
+ data: { 'turbo-stream': true }
+ )) do |_c|
+ t("button_cancel")
+ end
+ end
+ end
+ end
+ end
+ end
+%>
diff --git a/modules/meeting/app/components/meeting_sections/header_component.rb b/modules/meeting/app/components/meeting_sections/header_component.rb
new file mode 100644
index 00000000000..7e0145ca0b5
--- /dev/null
+++ b/modules/meeting/app/components/meeting_sections/header_component.rb
@@ -0,0 +1,131 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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.
+#++
+
+module MeetingSections
+ class HeaderComponent < ApplicationComponent
+ include ApplicationHelper
+ include OpPrimer::ComponentHelpers
+ include OpTurbo::Streamable
+
+ def initialize(meeting_section:, state: :show, first_and_last: [])
+ super
+
+ @meeting_section = meeting_section
+ @meeting_agenda_items = meeting_section.agenda_items
+ @first_and_last = first_and_last
+ @state = state
+ end
+
+ private
+
+ def wrapper_uniq_by
+ @meeting_section.id
+ end
+
+ def drag_and_drop_target_config
+ {
+ "is-drag-and-drop-target": true,
+ "target-container-accessor": ".Box > ul", # the accessor of the container that contains the drag and drop items
+ "target-id": @meeting_section.id, # the id of the target
+ "target-allowed-drag-type": "custom-field" # the type of dragged items which are allowed to be dropped in this target
+ }
+ end
+
+ def move_actions(menu)
+ unless first?
+ move_action_item(menu, :highest, t("label_agenda_item_move_to_top"),
+ "move-to-top")
+ move_action_item(menu, :higher, t("label_agenda_item_move_up"), "chevron-up")
+ end
+ unless last?
+ move_action_item(menu, :lower, t("label_agenda_item_move_down"),
+ "chevron-down")
+ move_action_item(menu, :lowest, t("label_agenda_item_move_to_bottom"),
+ "move-to-bottom")
+ end
+ end
+
+ def move_action_item(menu, move_to, label_text, icon)
+ menu.with_item(label: label_text,
+ href: move_admin_settings_section_path(@meeting_section, move_to:),
+ form_arguments: {
+ method: :put, data: { "turbo-stream": true,
+ test_selector: "meeting-section-move-#{move_to}" }
+ }) do |item|
+ item.with_leading_visual_icon(icon:)
+ end
+ end
+
+ def disabled_delete_action_item(menu)
+ menu.with_item(label: t("text_destroy"),
+ disabled: true) do |item|
+ item.with_leading_visual_icon(icon: :trash)
+ end
+ end
+
+ def edit_action_item(menu)
+ menu.with_item(label: t("label_edit"),
+ href: edit_meeting_section_path(@meeting_section.meeting, @meeting_section),
+ content_arguments: {
+ data: { "turbo-stream": true, "test-selector": "meeting-section-edit" }
+ }) do |item|
+ item.with_leading_visual_icon(icon: :pencil)
+ end
+ end
+
+ def delete_action_item(menu)
+ menu.with_item(label: t("text_destroy"),
+ scheme: :danger,
+ href: meeting_section_path(@meeting_section.meeting, @meeting_section),
+ form_arguments: {
+ method: :delete, data: { confirm: t("text_are_you_sure"), "turbo-stream": true,
+ test_selector: "meeting-section-delete" }
+ }) do |item|
+ item.with_leading_visual_icon(icon: :trash)
+ end
+ end
+
+ def first?
+ @first ||=
+ if @first_and_last.first
+ @first_and_last.first == @meeting_section
+ else
+ @meeting_section.first?
+ end
+ end
+
+ def last?
+ @last ||=
+ if @first_and_last.last
+ @first_and_last.last == @meeting_section
+ else
+ @meeting_section.last?
+ end
+ end
+ end
+end
diff --git a/modules/meeting/app/components/meeting_sections/show_component.html.erb b/modules/meeting/app/components/meeting_sections/show_component.html.erb
new file mode 100644
index 00000000000..0f65419b15c
--- /dev/null
+++ b/modules/meeting/app/components/meeting_sections/show_component.html.erb
@@ -0,0 +1,31 @@
+<%=
+ component_wrapper(class: "op-meeting-section-container", data: { test_selector: "meeting-section-container-#{@meeting_section.id}" }) do
+ render(Primer::Beta::BorderBox.new(mt: 3, data: drag_and_drop_target_config)) do |component|
+ if render_section_wrapper?
+ component.with_header(font_weight: :bold) do
+ render(MeetingSections::HeaderComponent.new(meeting_section: @meeting_section))
+ end
+ end
+ if @meeting_agenda_items.empty?
+ component.with_row(data: { 'empty-list-item': true }) do
+ flex_layout(align_items: :center, justify_content: :space_between) do |empty_list_container|
+ empty_list_container.with_column(ml: 4, mr: 2) do
+ render(Primer::Beta::Text.new(color: :subtle)) { t("settings.project_attributes.label_no_project_custom_fields") }
+ end
+ end
+ end
+ else
+ first_and_last = [@meeting_agenda_items.first, @meeting_agenda_items.last]
+ @meeting_agenda_items.each do |agenda_item|
+ render(
+ MeetingAgendaItems::ItemComponent.new(
+ meeting_agenda_item: agenda_item,
+ container: component,
+ first_and_last:
+ )
+ )
+ end
+ end
+ end
+ end
+%>
diff --git a/modules/meeting/app/components/meeting_sections/show_component.rb b/modules/meeting/app/components/meeting_sections/show_component.rb
new file mode 100644
index 00000000000..ccccd3f6cdf
--- /dev/null
+++ b/modules/meeting/app/components/meeting_sections/show_component.rb
@@ -0,0 +1,64 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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.
+#++
+
+module MeetingSections
+ class ShowComponent < ApplicationComponent
+ include ApplicationHelper
+ include OpPrimer::ComponentHelpers
+ include OpTurbo::Streamable
+
+ with_collection_parameter :meeting_section
+
+ def initialize(meeting_section:, state: :show, first_and_last: [])
+ super
+
+ @meeting_section = meeting_section
+ @meeting_agenda_items = meeting_section.agenda_items
+ @first_and_last = first_and_last
+ end
+
+ private
+
+ def wrapper_uniq_by
+ @meeting_section.id
+ end
+
+ def render_section_wrapper?
+ @meeting_section.meeting.sections.count > 1
+ end
+
+ def drag_and_drop_target_config
+ {
+ "is-drag-and-drop-target": true,
+ "target-container-accessor": ".Box > ul", # the accessor of the container that contains the drag and drop items
+ "target-id": @meeting_section.id, # the id of the target
+ "target-allowed-drag-type": "custom-field" # the type of dragged items which are allowed to be dropped in this target
+ }
+ end
+ end
+end
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 414ebd2cd02..0c353b54b5e 100644
--- a/modules/meeting/app/contracts/meeting_agenda_items/base_contract.rb
+++ b/modules/meeting/app/contracts/meeting_agenda_items/base_contract.rb
@@ -36,6 +36,7 @@ module MeetingAgendaItems
attribute :meeting
attribute :work_package
+ attribute :meeting_section
attribute :position
attribute :title
diff --git a/modules/meeting/app/contracts/meeting_sections/base_contract.rb b/modules/meeting/app/contracts/meeting_sections/base_contract.rb
new file mode 100644
index 00000000000..ff89265cabe
--- /dev/null
+++ b/modules/meeting/app/contracts/meeting_sections/base_contract.rb
@@ -0,0 +1,40 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class BaseContract < ::ModelContract
+ include ModifiableItem
+
+ def self.model
+ MeetingSection
+ end
+
+ attribute :meeting
+ attribute :name
+ end
+end
diff --git a/modules/meeting/app/contracts/meeting_sections/create_contract.rb b/modules/meeting/app/contracts/meeting_sections/create_contract.rb
new file mode 100644
index 00000000000..7486bf1c1a0
--- /dev/null
+++ b/modules/meeting/app/contracts/meeting_sections/create_contract.rb
@@ -0,0 +1,75 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class CreateContract < BaseContract
+ validate :user_allowed_to_add, :validate_meeting_existence
+
+ def self.assignable_meetings(user)
+ StructuredMeeting
+ .open
+ .visible(user)
+ end
+
+ ##
+ # Meeting agenda items can currently be only created
+ # through the project permission :manage_agendas
+ # When MeetingRole becomes available, agenda items will
+ # be created through meeting permissions :manage_agendas
+ def user_allowed_to_add
+ # when creating a meeting agenda item from the work package tab and not selecting a meeting
+ # the meeting and therefore the project is not set
+ # in this case we only want to show the "Meeting can't be blank" error instead of a misleading permission base error
+ # the error is added by the models presence validation
+ return unless visible?
+
+ unless user.allowed_in_project?(:manage_agendas, model.project)
+ errors.add :base, :error_unauthorized
+ end
+ end
+
+ ##
+ # A stale browser window might provide an already deleted meeting as an option when creating an agenda item from the
+ # work package tab. This would lead to an 500 server error when trying to save the agenda item.
+ def validate_meeting_existence
+ # when creating a meeting agenda item from the work package tab and not selecting a meeting
+ # the meeting and therefore the project is not set
+ # in this case we only want to show the "Meeting can't be blank" error instead of a misleading not existance error
+ # the error is added by the models presence validation
+ return if model.meeting.nil?
+
+ errors.add :base, :does_not_exist unless visible?
+ end
+
+ private
+
+ def visible?
+ @visible ||= model.meeting&.visible?(user)
+ end
+ end
+end
diff --git a/modules/meeting/app/contracts/meeting_sections/delete_contract.rb b/modules/meeting/app/contracts/meeting_sections/delete_contract.rb
new file mode 100644
index 00000000000..1cb41b06f24
--- /dev/null
+++ b/modules/meeting/app/contracts/meeting_sections/delete_contract.rb
@@ -0,0 +1,35 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class DeleteContract < ::DeleteContract
+ include ModifiableItem
+
+ delete_permission :manage_agendas
+ end
+end
diff --git a/modules/meeting/app/contracts/meeting_sections/modifiable_item.rb b/modules/meeting/app/contracts/meeting_sections/modifiable_item.rb
new file mode 100644
index 00000000000..b054059f142
--- /dev/null
+++ b/modules/meeting/app/contracts/meeting_sections/modifiable_item.rb
@@ -0,0 +1,45 @@
+#-- 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.
+#++
+
+module MeetingSections
+ module ModifiableItem
+ extend ActiveSupport::Concern
+
+ included do
+ validate :validate_modifiable
+ end
+
+ protected
+
+ def validate_modifiable
+ unless model.modifiable?
+ errors.add :base, I18n.t(:text_agenda_item_not_editable_anymore)
+ end
+ end
+ end
+end
diff --git a/modules/meeting/app/contracts/meeting_sections/update_contract.rb b/modules/meeting/app/contracts/meeting_sections/update_contract.rb
new file mode 100644
index 00000000000..581fd423384
--- /dev/null
+++ b/modules/meeting/app/contracts/meeting_sections/update_contract.rb
@@ -0,0 +1,50 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class UpdateContract < BaseContract
+ validate :user_allowed_to_edit
+
+ # attribute :lock_version do
+ # if model.lock_version.nil? || model.lock_version_changed?
+ # errors.add :base, :error_conflict
+ # end
+ # end
+
+ ##
+ # Meeting agenda items can currently be only edited
+ # through the project permission :manage_agendas
+ # When MeetingRole becomes available, agenda items will
+ # be edited through meeting permissions :manage_agendas
+ def user_allowed_to_edit
+ unless user.allowed_in_project?(:manage_agendas, model.project)
+ errors.add :base, :error_unauthorized
+ end
+ end
+ end
+end
diff --git a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
index c5bc4f953a9..51277e13daa 100644
--- a/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
+++ b/modules/meeting/app/controllers/concerns/meetings/agenda_component_streams.rb
@@ -206,6 +206,15 @@ module Meetings
end
end
+ def update_section_header_via_turbo_stream(meeting_section: @meeting_section, state: :show)
+ update_via_turbo_stream(
+ component: MeetingSections::HeaderComponent.new(
+ meeting_section:,
+ state:
+ )
+ )
+ end
+
def update_all_via_turbo_stream
update_header_component_via_turbo_stream
update_sidebar_component_via_turbo_stream
diff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rb
new file mode 100644
index 00000000000..7cbb42db593
--- /dev/null
+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb
@@ -0,0 +1,198 @@
+#-- 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 MeetingSectionsController < ApplicationController
+ include AttachableServiceCall
+ include OpTurbo::ComponentStream
+ include Meetings::AgendaComponentStreams
+ include ApplicationComponentStreams
+
+ before_action :set_meeting
+ before_action :set_meeting_section,
+ except: %i[create]
+ before_action :authorize
+
+ # def new
+ # if @meeting.open?
+ # update_new_component_via_turbo_stream(hidden: false, type: @agenda_item_type)
+ # update_new_button_via_turbo_stream(disabled: true)
+ # else
+ # update_all_via_turbo_stream
+ # render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))
+ # end
+
+ # respond_with_turbo_streams
+ # end
+
+ # def cancel_new
+ # update_new_component_via_turbo_stream(hidden: true)
+ # update_new_button_via_turbo_stream(disabled: false)
+
+ # respond_with_turbo_streams
+ # end
+
+ def create
+ call = ::MeetingSections::CreateService
+ .new(user: current_user)
+ .call(
+ {
+ name: "Untitled", # TODO: i18n
+ meeting_id: @meeting.id
+ }
+ )
+
+ @meeting_section = call.result
+
+ if call.success?
+ update_all_via_turbo_stream # TODO: more specific UI update
+ else
+ render_base_error_in_flash_message_via_turbo_stream(call.errors)
+ end
+
+ respond_with_turbo_streams
+ end
+
+ def edit
+ if @meeting_section.editable?
+ update_section_header_via_turbo_stream(state: :edit)
+ else
+ update_all_via_turbo_stream
+ render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))
+ end
+
+ respond_with_turbo_streams
+ end
+
+ def cancel_edit
+ update_section_header_via_turbo_stream(state: :show)
+
+ respond_with_turbo_streams
+ end
+
+ def update
+ call = ::MeetingSections::UpdateService
+ .new(user: current_user, model: @meeting_section)
+ .call(meeting_section_params)
+
+ if call.success?
+ update_section_header_via_turbo_stream(state: :show)
+ update_header_component_via_turbo_stream
+ update_sidebar_details_component_via_turbo_stream
+ else
+ # show errors
+ update_section_header_via_turbo_stream(state: :edit)
+ render_base_error_in_flash_message_via_turbo_stream(call.errors)
+ end
+
+ respond_with_turbo_streams
+ end
+
+ def destroy
+ call = ::MeetingSections::DeleteService
+ .new(user: current_user, model: @meeting_section)
+ .call
+
+ if call.success?
+ update_all_via_turbo_stream # TODO: more specific UI update
+ else
+ generic_call_failure_response(call)
+ end
+
+ respond_with_turbo_streams
+ end
+
+ def drop
+ call = ::MeetingAgendaItems::UpdateService
+ .new(user: current_user, model: @meeting_section)
+ .call(position: params[:position].to_i)
+
+ if call.success?
+ update_show_items_via_turbo_stream
+ update_header_component_via_turbo_stream
+ else
+ generic_call_failure_response(call)
+ end
+
+ respond_with_turbo_streams
+ end
+
+ def move
+ call = ::MeetingAgendaItems::UpdateService
+ .new(user: current_user, model: @meeting_section)
+ .call(move_to: params[:move_to]&.to_sym)
+
+ if call.success?
+ move_item_via_turbo_stream
+ update_header_component_via_turbo_stream
+ else
+ generic_call_failure_response(call)
+ end
+
+ respond_with_turbo_streams
+ end
+
+ # Primer's autocomplete displays the ID of a user when selected instead of the name
+ # this cannot be changed at the moment as the component uses a simple text field which
+ # can't differentiate between a display and submit value
+ # thus, we can't use it
+ # leaving the code here for future reference
+ # def author_autocomplete_index
+ # @users = User.active.like(params[:q]).limit(10)
+
+ # render(Authors::AutocompleteItemComponent.with_collection(@users), layout: false)
+ # end
+
+ private
+
+ def set_meeting
+ @meeting = Meeting.find(params[:meeting_id])
+ @project = @meeting.project # required for authorization via before_action
+ end
+
+ def set_agenda_item_type
+ @agenda_item_type = params[:type]&.to_sym
+ end
+
+ def set_meeting_section
+ @meeting_section = MeetingSection.find(params[:id])
+ end
+
+ def meeting_section_params
+ params
+ .require(:meeting_section)
+ .permit(:name)
+ end
+
+ def generic_call_failure_response(call)
+ # A failure might imply that the meeting was already closed and the action was triggered from a stale browser window
+ # updating all components resolves the stale state of that window
+ update_all_via_turbo_stream
+ # show additional base error message
+ render_base_error_in_flash_message_via_turbo_stream(call.errors)
+ end
+end
diff --git a/modules/meeting/app/forms/meeting_section/name.rb b/modules/meeting/app/forms/meeting_section/name.rb
new file mode 100644
index 00000000000..41a69a094a4
--- /dev/null
+++ b/modules/meeting/app/forms/meeting_section/name.rb
@@ -0,0 +1,40 @@
+#-- 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 MeetingSection::Name < ApplicationForm
+ form do |meeting_section_form|
+ meeting_section_form.text_field(
+ name: :name,
+ placeholder: Meeting.human_attribute_name(:title),
+ label: Meeting.human_attribute_name(:title),
+ visually_hide_label: true,
+ required: true,
+ autofocus: true
+ )
+ end
+end
diff --git a/modules/meeting/app/forms/meeting_section/submit.rb b/modules/meeting/app/forms/meeting_section/submit.rb
new file mode 100644
index 00000000000..94279486aed
--- /dev/null
+++ b/modules/meeting/app/forms/meeting_section/submit.rb
@@ -0,0 +1,33 @@
+#-- 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 MeetingSection::Submit < ApplicationForm
+ form do |meeting_section_form|
+ meeting_section_form.submit(name: :submit, label: I18n.t("button_save"), scheme: :primary)
+ end
+end
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index c777a551651..73e0fbadb0c 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -30,26 +30,27 @@ class Meeting < ApplicationRecord
include VirtualAttribute
include OpenProject::Journal::AttachmentHelper
- self.table_name = 'meetings'
+ self.table_name = "meetings"
belongs_to :project
- belongs_to :author, class_name: 'User'
- has_one :agenda, dependent: :destroy, class_name: 'MeetingAgenda'
- has_one :minutes, dependent: :destroy, class_name: 'MeetingMinutes'
- has_many :contents, -> { readonly }, class_name: 'MeetingContent'
+ belongs_to :author, class_name: "User"
+ has_one :agenda, dependent: :destroy, class_name: "MeetingAgenda"
+ has_one :minutes, dependent: :destroy, class_name: "MeetingMinutes"
+ has_many :contents, -> { readonly }, class_name: "MeetingContent"
has_many :participants,
dependent: :destroy,
- class_name: 'MeetingParticipant',
+ class_name: "MeetingParticipant",
after_add: :send_participant_added_mail
- has_many :agenda_items, dependent: :destroy, class_name: 'MeetingAgendaItem'
+ has_many :sections, dependent: :destroy, class_name: "MeetingSection"
+ has_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem"
default_scope do
order("#{Meeting.table_name}.start_time DESC")
end
- scope :from_tomorrow, -> { where(['start_time >= ?', Date.tomorrow.beginning_of_day]) }
- scope :from_today, -> { where(['start_time >= ?', Time.zone.today.beginning_of_day]) }
+ scope :from_tomorrow, -> { where(["start_time >= ?", Date.tomorrow.beginning_of_day]) }
+ scope :from_today, -> { where(["start_time >= ?", Time.zone.today.beginning_of_day]) }
scope :with_users_by_date, -> {
order("#{Meeting.table_name}.title ASC")
.includes({ participants: :user }, :author)
@@ -111,18 +112,18 @@ class Meeting < ApplicationRecord
# => {"agenda_items_7"=>{"title"=>["New agenda item edited", "New agenda item edited again"], "duration_in_minutes"=>["5", "3"], "notes"=>["Notes added as well", "Notes edited"]}}
-# => {"project_id"=>[nil, 14],
-# "user_id"=>[nil, 9],
-# "work_package_id"=>[nil, 48211],
-# "hours"=>[nil, 1.0],
-# "comments"=>[nil, "Alex"],
-# "activity_id"=>[nil, 8],
-# "spent_on"=>[nil, Mon, 31 Jul 2023],
-# "tyear"=>[nil, 2023],
-# "tmonth"=>[nil, 7],
-# "tweek"=>[nil, 31],
-# "costs"=>[nil, 0.0],
-# "logged_by_id"=>[nil, 9]}
+ # => {"project_id"=>[nil, 14],
+ # "user_id"=>[nil, 9],
+ # "work_package_id"=>[nil, 48211],
+ # "hours"=>[nil, 1.0],
+ # "comments"=>[nil, "Alex"],
+ # "activity_id"=>[nil, 8],
+ # "spent_on"=>[nil, Mon, 31 Jul 2023],
+ # "tyear"=>[nil, 2023],
+ # "tmonth"=>[nil, 7],
+ # "tweek"=>[nil, 31],
+ # "costs"=>[nil, 0.0],
+ # "logged_by_id"=>[nil, 9]}
##
# Return the computed start_time when changed
@@ -214,7 +215,7 @@ class Meeting < ApplicationRecord
attachments = agenda.attachments.map { |a| [a, a.copy] }
original_text = String(agenda.text)
minutes = create_minutes(text: original_text,
- journal_notes: I18n.t('events.meeting_minutes_created'),
+ journal_notes: I18n.t("events.meeting_minutes_created"),
attachments: attachments.map(&:last))
# substitute attachment references in text to use the respective copied attachments
@@ -233,7 +234,7 @@ class Meeting < ApplicationRecord
def participants_attributes=(attrs)
attrs.each do |participant|
- participant['_destroy'] = true if !(participant[:attended] || participant[:invited])
+ participant["_destroy"] = true if !(participant[:attended] || participant[:invited])
end
self.original_participants_attributes = attrs
end
@@ -260,7 +261,7 @@ class Meeting < ApplicationRecord
def update_derived_fields
@start_date = start_time.to_date.iso8601
- @start_time_hour = start_time.strftime('%H:%M')
+ @start_time_hour = start_time.strftime("%H:%M")
end
private
@@ -319,7 +320,7 @@ class Meeting < ApplicationRecord
##
# Enforce HH::MM time parsing for the given input string
def parsed_start_time_hour
- Time.strptime(@start_time_hour, '%H:%M')
+ Time.strptime(@start_time_hour, "%H:%M")
rescue ArgumentError
nil
end
diff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rb
index 3babdc799c9..b81d870c92b 100644
--- a/modules/meeting/app/models/meeting_agenda_item.rb
+++ b/modules/meeting/app/models/meeting_agenda_item.rb
@@ -36,12 +36,13 @@ class MeetingAgendaItem < ApplicationRecord
enum item_type: ITEM_TYPES
belongs_to :meeting, class_name: "StructuredMeeting"
+ belongs_to :meeting_section, optional: false
belongs_to :work_package, class_name: "::WorkPackage"
has_one :project, through: :meeting
belongs_to :author, class_name: "User", optional: false
belongs_to :presenter, class_name: "User", optional: true
- acts_as_list scope: :meeting
+ acts_as_list scope: :meeting_section
default_scope { order(:position) }
scope :with_includes_to_render, -> { includes(:author, :meeting) }
@@ -61,12 +62,26 @@ class MeetingAgendaItem < ApplicationRecord
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1440 },
allow_nil: true
+ before_validation :add_to_latest_meeting_section
+
after_create :trigger_meeting_agenda_item_time_slots_calculation
after_save :trigger_meeting_agenda_item_time_slots_calculation, if: Proc.new { |item|
item.duration_in_minutes_previously_changed? || item.position_previously_changed?
}
after_destroy :trigger_meeting_agenda_item_time_slots_calculation
+ def add_to_latest_meeting_section
+ if meeting_section_id.nil?
+ meeting_section = meeting.sections.order(position: :asc).last
+
+ if meeting_section.nil?
+ meeting_section = meeting.sections.create!(name: "Untitled")
+ end
+
+ self.meeting_section_id = meeting_section.id
+ end
+ end
+
def trigger_meeting_agenda_item_time_slots_calculation
meeting.calculate_agenda_item_time_slots
end
diff --git a/modules/meeting/app/models/meeting_section.rb b/modules/meeting/app/models/meeting_section.rb
new file mode 100644
index 00000000000..8198483b675
--- /dev/null
+++ b/modules/meeting/app/models/meeting_section.rb
@@ -0,0 +1,50 @@
+#-- 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 MeetingSection < ApplicationRecord
+ self.table_name = "meeting_sections"
+
+ belongs_to :meeting
+
+ has_many :agenda_items, dependent: :destroy, class_name: "MeetingAgendaItem"
+ has_one :project, through: :meeting
+
+ validates :name, presence: true
+
+ acts_as_list scope: :meeting
+
+ default_scope { order(:position) }
+
+ def editable?
+ !meeting&.closed?
+ end
+
+ def modifiable?
+ !meeting&.closed?
+ end
+end
diff --git a/modules/meeting/app/services/meeting_sections/create_service.rb b/modules/meeting/app/services/meeting_sections/create_service.rb
new file mode 100644
index 00000000000..2024669c06b
--- /dev/null
+++ b/modules/meeting/app/services/meeting_sections/create_service.rb
@@ -0,0 +1,32 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class CreateService < ::BaseServices::Create
+ end
+end
diff --git a/modules/meeting/app/services/meeting_sections/delete_service.rb b/modules/meeting/app/services/meeting_sections/delete_service.rb
new file mode 100644
index 00000000000..160d428c99d
--- /dev/null
+++ b/modules/meeting/app/services/meeting_sections/delete_service.rb
@@ -0,0 +1,32 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class DeleteService < ::BaseServices::Delete
+ end
+end
diff --git a/modules/meeting/app/services/meeting_sections/set_attributes_service.rb b/modules/meeting/app/services/meeting_sections/set_attributes_service.rb
new file mode 100644
index 00000000000..cbfbd588014
--- /dev/null
+++ b/modules/meeting/app/services/meeting_sections/set_attributes_service.rb
@@ -0,0 +1,32 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class SetAttributesService < ::BaseServices::SetAttributes
+ end
+end
diff --git a/modules/meeting/app/services/meeting_sections/update_service.rb b/modules/meeting/app/services/meeting_sections/update_service.rb
new file mode 100644
index 00000000000..025eafc8cf6
--- /dev/null
+++ b/modules/meeting/app/services/meeting_sections/update_service.rb
@@ -0,0 +1,32 @@
+#-- 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.
+#++
+
+module MeetingSections
+ class UpdateService < ::BaseServices::Update
+ end
+end
diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rb
index f9e015eb11e..3828b4fbdac 100644
--- a/modules/meeting/config/routes.rb
+++ b/modules/meeting/config/routes.rb
@@ -34,15 +34,15 @@ Rails.application.routes.draw do
resources :work_packages, only: %i[] do
resources :meetings, only: %i[] do
collection do
- resources :tab, only: %i[index], controller: 'work_package_meetings_tab', as: 'meetings_tab' do
+ resources :tab, only: %i[index], controller: "work_package_meetings_tab", as: "meetings_tab" do
get :count, on: :collection
end
end
end
resources :meeting_agenda_items, only: %i[] do
collection do
- get :dialog, controller: 'work_package_meetings_tab', action: :add_work_package_to_meeting_dialog
- post :create, controller: 'work_package_meetings_tab', action: :add_work_package_to_meeting
+ get :dialog, controller: "work_package_meetings_tab", action: :add_work_package_to_meeting_dialog
+ post :create, controller: "work_package_meetings_tab", action: :add_work_package_to_meeting
end
end
end
@@ -59,11 +59,21 @@ Rails.application.routes.draw do
post :notify
get :history
end
- resources :agenda_items, controller: 'meeting_agenda_items' do
+ resources :agenda_items, controller: "meeting_agenda_items" do
+ collection do
+ get :new, action: :new, as: :new
+ get :cancel_new
+ end
+ member do
+ get :cancel_edit
+ put :drop
+ put :move
+ end
+ end
+ resources :sections, controller: "meeting_sections" do
collection do
get :new, action: :new, as: :new
get :cancel_new
- # get :author_autocomplete_index
end
member do
get :cancel_edit
@@ -72,7 +82,7 @@ Rails.application.routes.draw do
end
end
- resource :agenda, controller: 'meeting_agendas', only: [:update] do
+ resource :agenda, controller: "meeting_agendas", only: [:update] do
member do
get :history
get :diff
@@ -82,17 +92,17 @@ Rails.application.routes.draw do
end
resources :versions, only: [:show],
- controller: 'meeting_agendas'
+ controller: "meeting_agendas"
end
- resource :contents, controller: 'meeting_contents', only: %i[show update] do
+ resource :contents, controller: "meeting_contents", only: %i[show update] do
member do
get :history
get :diff
end
end
- resource :minutes, controller: 'meeting_minutes', only: [:update] do
+ resource :minutes, controller: "meeting_minutes", only: [:update] do
member do
get :history
get :diff
@@ -100,14 +110,14 @@ Rails.application.routes.draw do
end
resources :versions, only: [:show],
- controller: 'meeting_minutes'
+ controller: "meeting_minutes"
end
member do
get :copy
- match '/:tab' => 'meetings#show', :constraints => { tab: /(agenda|minutes)/ },
+ match "/:tab" => "meetings#show", :constraints => { tab: /(agenda|minutes)/ },
:via => :get,
- :as => 'tab'
+ :as => "tab"
end
end
end
diff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rb
index b7faee8275b..5a25b75db5f 100644
--- a/modules/meeting/lib/open_project/meeting/engine.rb
+++ b/modules/meeting/lib/open_project/meeting/engine.rb
@@ -26,8 +26,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'open_project/plugins'
-require_relative 'patches/api/work_package_representer'
+require "open_project/plugins"
+require_relative "patches/api/work_package_representer"
module OpenProject::Meeting
class Engine < ::Rails::Engine
@@ -35,8 +35,8 @@ module OpenProject::Meeting
include OpenProject::Plugins::ActsAsOpEngine
- register 'openproject-meeting',
- author_url: 'https://www.openproject.org',
+ register "openproject-meeting",
+ author_url: "https://www.openproject.org",
bundled: true do
project_module :meetings do
permission :view_meetings,
@@ -73,7 +73,8 @@ module OpenProject::Meeting
require: :member
permission :manage_agendas,
{
- meeting_agenda_items: %i[new cancel_new create edit cancel_edit update destroy drop move]
+ meeting_agenda_items: %i[new cancel_new create edit cancel_edit update destroy drop move],
+ meeting_sections: %i[new cancel_new create edit cancel_edit update destroy drop move]
},
permissible_on: :project, # TODO: Change this to :meeting when MeetingRoles are available
require: :member
@@ -110,16 +111,16 @@ module OpenProject::Meeting
end
menu :project_menu,
- :meetings, { controller: '/meetings', action: 'index' },
+ :meetings, { controller: "/meetings", action: "index" },
caption: :project_module_meetings,
after: :wiki,
before: :members,
- icon: 'meetings'
+ icon: "meetings"
menu :project_menu,
- :meetings_query_select, { controller: '/meetings', action: 'index' },
+ :meetings_query_select, { controller: "/meetings", action: "index" },
parent: :meetings,
- partial: 'meetings/menu_query_select'
+ partial: "meetings/menu_query_select"
should_render_global_menu_item = Proc.new do
(User.current.logged? || !Setting.login_required?) &&
@@ -127,32 +128,32 @@ module OpenProject::Meeting
end
menu :top_menu,
- :meetings, { controller: '/meetings', action: 'index', project_id: nil },
+ :meetings, { controller: "/meetings", action: "index", project_id: nil },
context: :modules,
caption: :label_meeting_plural,
last: true,
- icon: 'meetings',
+ icon: "meetings",
if: should_render_global_menu_item
menu :global_menu,
- :meetings, { controller: '/meetings', action: 'index', project_id: nil },
+ :meetings, { controller: "/meetings", action: "index", project_id: nil },
caption: :label_meeting_plural,
last: true,
- icon: 'meetings',
+ icon: "meetings",
if: should_render_global_menu_item
menu :global_menu,
- :meetings_query_select, { controller: '/meetings', action: 'index', project_id: nil },
+ :meetings_query_select, { controller: "/meetings", action: "index", project_id: nil },
parent: :meetings,
- partial: 'meetings/menu_query_select',
+ partial: "meetings/menu_query_select",
if: should_render_global_menu_item
ActiveSupport::Inflector.inflections do |inflect|
- inflect.uncountable 'meeting_minutes'
+ inflect.uncountable "meeting_minutes"
end
end
- activity_provider :meetings, class_name: 'Activities::MeetingActivityProvider', default: false
+ activity_provider :meetings, class_name: "Activities::MeetingActivityProvider", default: false
patches [:Project]
patch_with_namespace :BasicData, :SettingSeeder
@@ -160,13 +161,13 @@ module OpenProject::Meeting
extend_api_response(:v3, :work_packages, :work_package,
&::OpenProject::Meeting::Patches::API::WorkPackageRepresenter.extension)
- add_api_endpoint 'API::V3::Root' do
+ add_api_endpoint "API::V3::Root" do
mount ::API::V3::Meetings::MeetingsAPI
mount ::API::V3::Meetings::MeetingContentsAPI
end
config.to_prepare do
- OpenProject::ProjectLatestActivity.register on: 'Meeting'
+ OpenProject::ProjectLatestActivity.register on: "Meeting"
PermittedParams.permit(:search, :meetings)
end