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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add meeting dialog forms
Mir Bhatiae4ba003a182f
diff --git a/modules/meeting/app/components/meetings/header_component.html.erb b/modules/meeting/app/components/meetings/header_component.html.erbindex 1d327152d6a..f6e8da38ec5 100644--- a/modules/meeting/app/components/meetings/header_component.html.erb+++ b/modules/meeting/app/components/meetings/header_component.html.erb@@ -39,7 +39,7 @@menu.with_item(label: t(:button_copy),href: copy_meeting_path(@meeting),content_arguments: {- data: { turbo: false }+ data: { turbo_stream: true }}) do |item|item.with_leading_visual_icon(icon: :copy)enddiff --git a/modules/meeting/app/components/meetings/index/dialog_component.html.erb b/modules/meeting/app/components/meetings/index/dialog_component.html.erbnew file mode 100644index 00000000000..d66c3ab90b5--- /dev/null+++ b/modules/meeting/app/components/meetings/index/dialog_component.html.erb@@ -0,0 +1,10 @@+<%=+ render(Primer::Alpha::Dialog.new(+ id: "new-meeting-dialog", title: title,+ size: :medium_portrait,+ data: { 'keep-open-on-submit': true }+ )) do |dialog|+ dialog.with_header(variant: :large)+ render(Meetings::Index::FormComponent.new(meeting: @meeting, project: @project, type: @type))+ end+%>diff --git a/modules/meeting/app/components/meetings/index/dialog_component.rb b/modules/meeting/app/components/meetings/index/dialog_component.rbnew file mode 100644index 00000000000..1b8edb02810--- /dev/null+++ b/modules/meeting/app/components/meetings/index/dialog_component.rb@@ -0,0 +1,58 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meetings+ class Index::DialogComponent < ApplicationComponent+ include ApplicationHelper+ include OpenProject::FormTagHelper+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers++ def initialize(meeting:, project:, type:)+ super++ @meeting = meeting+ @project = project+ @type = type+ end++ private++ def render?+ if @project+ User.current.allowed_in_project?(:create_meetings, @project)+ else+ User.current.allowed_in_any_project?(:create_meetings)+ end+ end++ def title+ @type == :new ? I18n.t("label_meeting_new_one_time") : "Copy meeting"+ end+ end+enddiff --git a/modules/meeting/app/components/meetings/index/form_component.html.erb b/modules/meeting/app/components/meetings/index/form_component.html.erbnew file mode 100644index 00000000000..c0c6f358811--- /dev/null+++ b/modules/meeting/app/components/meetings/index/form_component.html.erb@@ -0,0 +1,82 @@+<%=+ component_wrapper do+ primer_form_with(+ scope: :meeting,+ model: @meeting,+ method: :post,+ data: { turbo: true },+ html: { :id => 'meeting-form' },+ url: {:controller => '/meetings', :action => 'create', :project_id => @project}+ ) do |f|+ component_collection do |collection|+ collection.with_component(Primer::Alpha::Dialog::Body.new) do+ flex_layout(mb: 3) do |modal_body|+ if @project.nil?+ modal_body.with_row(mt: 3) do+ render(Meeting::ProjectAutocompleter.new(f))+ end+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::Title.new(f))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::StartDate.new(f, initial_value: start_date_initial_value))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::StartTime.new(f, initial_value: start_time_initial_value))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::Duration.new(f))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::Location.new(f))+ end++ modal_body.with_row do+ render(Meeting::Type.new(f))+ end++ unless @type == :new+ modal_body.with_row do+ render(Meeting::CopiedFrom.new(f, id: @type.id))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::CopyItems.new(f))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::CopyParticipants.new(f))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::CopyAttachments.new(f))+ end++ modal_body.with_row(mt: 3) do+ render(Meeting::EmailParticipants.new(f))+ end+ end+ end+ end++ collection.with_component(Primer::Alpha::Dialog::Footer.new) do+ component_collection do |modal_footer|+ modal_footer.with_component(Primer::ButtonComponent.new(data: { 'close-dialog-id': "new-meeting-dialog" })) do+ I18n.t("button_cancel")+ end++ modal_footer.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) do+ I18n.t("label_meeting_create")+ end+ end+ end+ end+ end+ end+%>diff --git a/modules/meeting/app/components/meetings/index/form_component.rb b/modules/meeting/app/components/meetings/index/form_component.rbnew file mode 100644index 00000000000..8f277a1024f--- /dev/null+++ b/modules/meeting/app/components/meetings/index/form_component.rb@@ -0,0 +1,53 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meetings+ class Index::FormComponent < ApplicationComponent+ include ApplicationHelper+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers++ def initialize(meeting:, project:, type:)+ super++ @meeting = meeting+ @project = project+ @type = type+ end++ private++ def start_date_initial_value+ format_time_as_date(@meeting.start_time, format: "%Y-%m-%d")+ end++ def start_time_initial_value+ format_time(@meeting.start_time, include_date: false, format: "%H:%M")+ end+ end+enddiff --git a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb b/modules/meeting/app/components/meetings/index_sub_header_component.html.erbindex a27c25c6690..30d5ea1f23e 100644--- a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb+++ b/modules/meeting/app/components/meetings/index_sub_header_component.html.erb@@ -7,42 +7,36 @@render(Meetings::MeetingFilterButtonComponent.new(query: @query, project: @project))end- # subheader.with_action_button(tag: :a,- # href: dynamic_path,- # scheme: :primary,- # mobile_icon: :plus,- # mobile_label: label_text,- # aria: { label: accessibility_label_text },- # title: accessibility_label_text,- # id: id,- # test_selector: "add-meeting-button") do |button|- # button.with_leading_visual_icon(icon: :plus)- # label_text- # end if render_create_button?-if render_create_button?subheader.with_action_component dorender Primer::Alpha::ActionMenu.new(anchor_align: :end) do |menu|menu.with_show_button(scheme: :primary,- test_selector: "op-admin-synchronized-groups--button-new",- aria: { label: I18n.t(:button_add) }) do |button|+ test_selector: "add-meeting-button",+ mobile_icon: :plus,+ mobile_label: label_text,+ id: id,+ title: accessibility_label_text,+ aria: { label: accessibility_label_text }) do |button|button.with_leading_visual_icon(icon: :plus)button.with_trailing_action_icon(icon: :"triangle-down")I18n.t(:label_meeting)end- menu.with_item(label: I18n.t("meeting.types.structured")) do |item|- end+ menu.with_item(label: I18n.t("meeting.types.classic"),+ tag: :a,+ href: dynamic_path+ )- menu.with_item(label: I18n.t("meeting.types.classic")) do |item|- end+ menu.with_item(label: I18n.t("meeting.types.structured"),+ tag: :a,+ href: new_dialog_meetings_path(project_id: @project&.id),+ content_arguments: { data: { controller: "async-dialog" }}+ )end-endend-subheader.with_bottom_pane_component(mt: 0) dorender(Meetings::MeetingFiltersComponent.new(query: @query, project: @project))enddiff --git a/modules/meeting/app/components/meetings/row_component.rb b/modules/meeting/app/components/meetings/row_component.rbindex bf0495710d3..f89a75d6a7a 100644--- a/modules/meeting/app/components/meetings/row_component.rb+++ b/modules/meeting/app/components/meetings/row_component.rb@@ -70,19 +70,34 @@ module Meetingsrender(Primer::Alpha::ActionMenu.new) do |menu|menu.with_show_button(icon: "kebab-horizontal", "aria-label": "More", scheme: :invisible)- menu.with_item(label: I18n.t(:label_meeting_open_this_meeting),- href: project_meeting_path(model.project, model),+ menu.with_item(label: I18n.t(:label_meeting_copy),+ href: copy_meeting_path(model), # ???+ content_arguments: {+ data: {+ turbo: model.is_a?(StructuredMeeting),+ turbo_stream: true+ }+ }) do |item|+ item.with_leading_visual_icon(icon: :copy)+ end++ menu.with_item(label: I18n.t(:label_icalendar_download),+ href: download_ics_meeting_path(model),content_arguments: {data: { turbo: false }- })+ }) do |item|+ item.with_leading_visual_icon(icon: :download)+ endif delete_allowed?- menu.with_item(label: t("label_meeting_index_delete"),+ menu.with_item(label: I18n.t(:label_meeting_delete),scheme: :danger,href: meeting_path(model),form_arguments: {- method: :delete, data: { confirm: t("text_are_you_sure"), turbo: "false" }- })+ method: :delete, data: { confirm: I18n.t("text_are_you_sure"), turbo: false }+ }) do |item|+ item.with_leading_visual_icon(icon: :trash)+ endendendenddiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 5fb9334eb5c..24215c776cf 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -27,17 +27,18 @@#++class MeetingsController < ApplicationController- before_action :load_and_authorize_in_optional_project, only: %i[index new show create history]+ before_action :load_and_authorize_in_optional_project, only: %i[index new new_dialog show create history]before_action :verify_activities_module_activated, only: %i[history]before_action :determine_date_range, only: %i[history]before_action :determine_author, only: %i[history]- before_action :build_meeting, only: %i[new]- before_action :find_meeting, except: %i[index new create]+ before_action :build_meeting, only: %i[new new_dialog]+ before_action :find_meeting, except: %i[index new create new_dialog]before_action :set_activity, only: %i[history]before_action :find_copy_from_meeting, only: %i[create]before_action :convert_params, only: %i[create update update_participants]- before_action :authorize, except: %i[index new create update_title update_details update_participants change_state]- before_action :authorize_global, only: %i[index new create update_title update_details update_participants change_state]+ before_action :authorize, except: %i[index new create update_title update_details update_participants change_state new_dialog]+ before_action :authorize_global,+ only: %i[index new create update_title update_details update_participants change_state new_dialog]helper :watchershelper :meeting_contents@@ -49,6 +50,7 @@ class MeetingsController < ApplicationControllerinclude OpTurbo::ComponentStreaminclude OpTurbo::FlashStreamHelper+ include OpTurbo::DialogStreamHelperinclude Meetings::AgendaComponentStreamsinclude MetaTagsHelper@@ -65,11 +67,15 @@ class MeetingsController < ApplicationControllerenddef show- html_title "#{t(:label_meeting)}: #{@meeting.title}"- if @meeting.is_a?(StructuredMeeting)- render(Meetings::ShowComponent.new(meeting: @meeting, project: @project))- elsif @meeting.agenda.present? && @meeting.agenda.locked?- params[:tab] ||= "minutes"+ respond_to do |format|+ format.html do+ html_title "#{t(:label_meeting)}: #{@meeting.title}"+ if @meeting.is_a?(StructuredMeeting)+ render(Meetings::ShowComponent.new(meeting: @meeting, project: @project), layout: true)+ elsif @meeting.agenda.present? && @meeting.agenda.locked?+ params[:tab] ||= "minutes"+ end+ endendend@@ -93,6 +99,8 @@ class MeetingsController < ApplicationController.call(@converted_params)end+ @meeting = call.result+if call.success?text = I18n.t(:notice_successful_create)unless User.current.pref.time_zone?@@ -102,13 +110,31 @@ class MeetingsController < ApplicationControllerendflash[:notice] = text.html_safe # rubocop:disable Rails/OutputSafety- redirect_to action: "show", id: call.result+ respond_to do |format|+ format.html do+ redirect_to status: :see_other, action: "show", id: @meeting+ end+ endelse- @meeting = call.result- render template: "meetings/new", project_id: @project, locals: { copy_from: @copy_from }+ respond_to do |format|+ format.html do+ render template: "meetings/new", project_id: @project, locals: { copy_from: @copy_from }+ end++ format.turbo_stream do+ update_via_turbo_stream(component: Meetings::Index::FormComponent.new(meeting: @meeting, project: @project, type:),+ status: :bad_request)++ respond_with_turbo_streams+ end+ endendend+ def new_dialog+ respond_with_dialog Meetings::Index::DialogComponent.new(meeting: @meeting, project: @project, type: :new)+ end+def new; endcurrent_menu_item :new do@@ -122,7 +148,15 @@ class MeetingsController < ApplicationController.call(save: false)@meeting = call.result- render action: "new", project_id: @project, locals: { copy_from: }+ respond_to do |format|+ format.html do+ render action: "new", project_id: @project, locals: { copy_from: }+ end++ format.turbo_stream do+ respond_with_dialog Meetings::Index::DialogComponent.new(meeting: @meeting, project: @project, type: copy_from)+ end+ endenddef destroy@@ -388,18 +422,20 @@ class MeetingsController < ApplicationControllerenddef find_copy_from_meeting- return unless params[:copied_from_meeting_id]+ copied_from_meeting_id = params[:copied_from_meeting_id] || params[:meeting][:copied_from_meeting_id]+ return unless copied_from_meeting_id- @copy_from = Meeting.visible.find(params[:copied_from_meeting_id])+ @copy_from = Meeting.visible.find(copied_from_meeting_id)rescue ActiveRecord::RecordNotFoundrender_404enddef copy_attributes{- copy_agenda: params[:copy_agenda] == "1",- copy_attachments: params[:copy_attachments] == "1",- send_notifications: params[:send_notifications] == "1"+ copy_agenda: params[:copy_agenda] == "1" || params[:meeting][:copy_agenda] == "1",+ copy_attachments: params[:copy_attachments] == "1" || params[:meeting][:copy_attachments] == "1",+ send_notifications: params[:send_notifications] == "1" || params[:meeting][:send_notifications] == "1",+ copy_participants: params[:meeting][:copy_participants] == "1"}endenddiff --git a/modules/meeting/app/forms/meeting/copied_from.rb b/modules/meeting/app/forms/meeting/copied_from.rbnew file mode 100644index 00000000000..a0f278dbf0b--- /dev/null+++ b/modules/meeting/app/forms/meeting/copied_from.rb@@ -0,0 +1,39 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::CopiedFrom < ApplicationForm+ form do |meeting_form|+ meeting_form.hidden(name: "copied_from_meeting_id", value: @id)+ end++ # rubocop:disable Lint/MissingSuper+ def initialize(id:)+ @id = id+ end+ # rubocop:enable Lint/MissingSuper+enddiff --git a/modules/meeting/app/forms/meeting/copy_attachments.rb b/modules/meeting/app/forms/meeting/copy_attachments.rbnew file mode 100644index 00000000000..72d41a96c18--- /dev/null+++ b/modules/meeting/app/forms/meeting/copy_attachments.rb@@ -0,0 +1,37 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::CopyAttachments < ApplicationForm+ form do |meeting_form|+ meeting_form.check_box(+ name: "copy_attachments",+ label: "Copy attachments",+ checked: false+ )+ end+enddiff --git a/modules/meeting/app/forms/meeting/copy_items.rb b/modules/meeting/app/forms/meeting/copy_items.rbnew file mode 100644index 00000000000..56b5186ddd0--- /dev/null+++ b/modules/meeting/app/forms/meeting/copy_items.rb@@ -0,0 +1,37 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::CopyItems < ApplicationForm+ form do |meeting_form|+ meeting_form.check_box(+ name: "copy_agenda",+ label: "Copy agenda items",+ checked: true+ )+ end+enddiff --git a/modules/meeting/app/forms/meeting/copy_participants.rb b/modules/meeting/app/forms/meeting/copy_participants.rbnew file mode 100644index 00000000000..72bfedb339d--- /dev/null+++ b/modules/meeting/app/forms/meeting/copy_participants.rb@@ -0,0 +1,37 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::CopyParticipants < ApplicationForm+ form do |meeting_form|+ meeting_form.check_box(+ name: "copy_participants",+ label: "Copy list of participants",+ checked: true+ )+ end+enddiff --git a/modules/meeting/app/forms/meeting/email_participants.rb b/modules/meeting/app/forms/meeting/email_participants.rbnew file mode 100644index 00000000000..7d20692af9b--- /dev/null+++ b/modules/meeting/app/forms/meeting/email_participants.rb@@ -0,0 +1,38 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::EmailParticipants < ApplicationForm+ form do |meeting_form|+ meeting_form.check_box(+ name: "send_notificationss",+ label: "Email participants",+ checked: false,+ caption: I18n.t("meeting.email.send_invitation_emails")+ )+ end+enddiff --git a/modules/meeting/app/forms/meeting/location.rb b/modules/meeting/app/forms/meeting/location.rbindex b18d1ed6243..40d9f3e882b 100644--- a/modules/meeting/app/forms/meeting/location.rb+++ b/modules/meeting/app/forms/meeting/location.rb@@ -33,7 +33,7 @@ class Meeting::Location < ApplicationFormplaceholder: Meeting.human_attribute_name(:location),label: Meeting.human_attribute_name(:location),visually_hide_label: false,- leading_visual: { icon: :link }+ leading_visual: { icon: :location })endenddiff --git a/modules/meeting/app/forms/meeting/project_autocompleter.rb b/modules/meeting/app/forms/meeting/project_autocompleter.rbnew file mode 100644index 00000000000..37e62534d3c--- /dev/null+++ b/modules/meeting/app/forms/meeting/project_autocompleter.rb@@ -0,0 +1,46 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::ProjectAutocompleter < ApplicationForm+ form do |f|+ f.project_autocompleter(+ name: "project_id",+ id: "project_id",+ label: Project.model_name.human,+ autocomplete_options: {+ with_search_icon: true,+ openDirectly: false,+ focusDirectly: false,+ dropdownPosition: "bottom",+ inputName: "project_id",+ inputValue: @project&.id,+ filters: [{ name: "user_action", operator: "=", values: ["meetings/create"] }]+ }+ )+ end+enddiff --git a/modules/meeting/app/forms/meeting/title.rb b/modules/meeting/app/forms/meeting/title.rbnew file mode 100644index 00000000000..9cb02e7b6e2--- /dev/null+++ b/modules/meeting/app/forms/meeting/title.rb@@ -0,0 +1,39 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::Title < ApplicationForm+ form do |meeting_form|+ meeting_form.text_field(+ name: :title,+ required: true,+ label: Meeting.human_attribute_name(:title),+ placeholder: Meeting.human_attribute_name(:title),+ visually_hide_label: false+ )+ end+enddiff --git a/modules/meeting/app/forms/meeting/type.rb b/modules/meeting/app/forms/meeting/type.rbnew file mode 100644index 00000000000..bc8135b7dd3--- /dev/null+++ b/modules/meeting/app/forms/meeting/type.rb@@ -0,0 +1,33 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 Meeting::Type < ApplicationForm+ form do |meeting_form|+ meeting_form.hidden(name: :type, value: "StructuredMeeting")+ end+enddiff --git a/modules/meeting/app/services/meetings/copy_service.rb b/modules/meeting/app/services/meetings/copy_service.rbindex be7abdc88ea..7fd0ba27e7e 100644--- a/modules/meeting/app/services/meetings/copy_service.rb+++ b/modules/meeting/app/services/meetings/copy_service.rb@@ -42,9 +42,10 @@ module Meetingsself.contract_class = contract_classend- def call(send_notifications: nil, save: true, copy_agenda: true, copy_attachments: false, attributes: {})+ def call(send_notifications: nil, save: true, copy_agenda: true, copy_attachments: false, copy_participants: true,+ attributes: {})if save- create(meeting, attributes, send_notifications:, copy_agenda:, copy_attachments:)+ create(meeting, attributes, send_notifications:, copy_agenda:, copy_attachments:, copy_participants:)elsebuild(meeting, attributes)end@@ -52,13 +53,14 @@ module Meetingsprotected- def create(meeting, attribute_overrides, send_notifications:, copy_agenda:, copy_attachments:)+ def create(meeting, attribute_overrides, send_notifications:, copy_agenda:, copy_attachments:, copy_participants:)Meetings::CreateService.new(user:, contract_class:).call(**copied_attributes(meeting, attribute_overrides).merge(send_notifications:).symbolize_keys).on_success do |call|copy_meeting_agenda(call.result) if copy_agendacopy_meeting_attachment(call.result) if copy_attachments+ copy_structured_meeting_participants(call.result) if meeting.is_a?(StructuredMeeting) && copy_participantsendend@@ -74,7 +76,7 @@ module Meetingsmeeting.attributes.slice(*writable_meeting_attributes(meeting))- .merge("start_time" => meeting.start_time + 1.week)+ .merge("start_time" => meeting.start_time + 1.day).merge("author" => user).merge("state" => "open").merge("participants_attributes" => copied_participants)@@ -129,5 +131,13 @@ module Meetings)endend++ def copy_structured_meeting_participants(copy)+ meeting.participants.each do |participant|+ copied_participant = participant.dup+ copied_participant.meeting_id = copy.id+ copy.participants << copied_participant+ end+ endendenddiff --git a/modules/meeting/app/views/meetings/_form.html.erb b/modules/meeting/app/views/meetings/_form.html.erbindex abf981a7d72..13aa02ca5a5 100644--- a/modules/meeting/app/views/meetings/_form.html.erb+++ b/modules/meeting/app/views/meetings/_form.html.erb@@ -66,55 +66,7 @@ See COPYRIGHT and LICENSE files for more details.</div></div><% elsif @meeting.new_record? %>- <div class="form--field -required -align-start">- <label class="form--label" for="meeting_type"><%= Meeting.human_attribute_name(:type) %></label>- <div class="form--field-container">- <div class="op-tile-block">- <label class="op-tile-block--tile form--radio-button-container -wide"- for="meeting_type_StructuredMeeting"- data-test-selector="op-tile-block">- <div class="op-tile-block--content">- <%= styled_radio_button_tag 'meeting[type]',- 'StructuredMeeting',- true,- no_label: true,- class: 'radio-button' %>- <div>- <span data-test-selector="op-tile-block-title" class="op-tile-block--title">- <%= t('meeting.types.structured') %>- </span>- <p class="op-tile-block--description">- <%= t('meeting.types.structured_text') %>- <% if local_assigns[:copy] %>- <br/>- <strong><%= t('meeting.types.structured_text_copy') %></strong>- <% end %>- </p>- </div>- </div>- </label>- <label class="op-tile-block--tile form--radio-button-container -wide"- for="meeting_type_Meeting"- data-test-selector="op-tile-block">- <div class="op-tile-block--content">- <%= styled_radio_button_tag 'meeting[type]',- 'Meeting',- false,- no_label: true,- class: 'radio-button' %>- <div>- <span data-test-selector="op-tile-block-title" class="op-tile-block--title">- <%= t('meeting.types.classic') %>- </span>- <p class="op-tile-block--description">- <%= t('meeting.types.classic_text') %>- </p>- </div>- </div>- </label>- </div>- </div>- </div>+ <%= f.hidden_field :type, value: "Meeting" %><% end %><% if global_meeting_create_context? %>diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 7ff3afe8f64..65a1a717de7 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -104,6 +104,9 @@ en:label_meeting: "Meeting"label_meeting_plural: "Meetings"label_meeting_new: "New Meeting"+ label_meeting_new_one_time: "New one-time meeting"+ label_meeting_create: "Create meeting"+ label_meeting_copy: "Copy meeting"label_meeting_edit: "Edit Meeting"label_meeting_agenda: "Agenda"label_meeting_minutes: "Minutes"@@ -156,7 +159,7 @@ en:new_date_time: "New date/time"label_mail_all_participants: "Send email to all participants"types:- classic: "Classic (deprecated)"+ classic: "Classic"classic_text: "Organize your meeting in a formattable text agenda and protocol."structured: "One-time"structured_text: "Organize your meeting as a list of agenda items, optionally linking them to a work package."diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rbindex 0bf45d5545b..a22ef0828d5 100644--- a/modules/meeting/config/routes.rb+++ b/modules/meeting/config/routes.rb@@ -56,6 +56,7 @@ Rails.application.routes.draw doendresources :meetings do+ get :new_dialog, on: :collectionmember doget :check_for_updatesget :cancel_editdiff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rbindex 41ee9664403..4c60ed2fede 100644--- a/modules/meeting/lib/open_project/meeting/engine.rb+++ b/modules/meeting/lib/open_project/meeting/engine.rb@@ -47,7 +47,7 @@ module OpenProject::Meetingwork_package_meetings_tab: %i[index count] },permissible_on: :projectpermission :create_meetings,- { meetings: %i[new create copy],+ { meetings: %i[new create copy new_dialog],"meetings/menus": %i[show] },permissible_on: :project,require: :member,