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 backlog actions
Mir Bhatia13226b414aea
diff --git a/modules/meeting/app/components/_index.sass b/modules/meeting/app/components/_index.sassindex 4a6c5017df5..223d00e8ff4 100644--- a/modules/meeting/app/components/_index.sass+++ b/modules/meeting/app/components/_index.sass@@ -6,3 +6,4 @@@import "./recurring_meetings/table_header_component.sass"@import "./meeting_agenda_items/outcomes/show_notes_component.sass"@import "./meetings/header_infoline_component.sass"+@import "./meeting_sections/backlogs/header_component.sass"diff --git a/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.html.erb b/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.html.erbnew file mode 100644index 00000000000..29a2502af4a--- /dev/null+++ b/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.html.erb@@ -0,0 +1,20 @@+<%=+ render(+ Primer::OpenProject::DangerDialog.new(+ id: "meetings-clear-backlog-dialog",+ confirm_button_text: I18n.t(:label_recurring_meeting_series_end_now),+ title: I18n.t("recurring_meeting.end_series_dialog.title"),+ form_arguments: {+ action: clear_backlog_meeting_sections_path(@meeting),+ method: :post+ }+ )+ ) do |dialog|+ dialog.with_confirmation_message do |message|+ message.with_heading(tag: :h2) { I18n.t(:text_meeting_series_end_early_heading) }+ message.with_description_content(I18n.t(:text_meeting_series_end_early))+ end++ dialog.with_confirmation_check_box_content(I18n.t("text_permanent_delete_confirmation_checkbox_label"))+ end+%>diff --git a/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rbnew file mode 100644index 00000000000..d4c98edf6f7--- /dev/null+++ b/modules/meeting/app/components/meeting_sections/backlogs/clear_backlog_dialog_component.rb@@ -0,0 +1,43 @@+# frozen_string_literal: true++#-- 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 MeetingSections+ class Backlogs::ClearBacklogDialogComponent < ApplicationComponent+ include ApplicationHelper+ include OpTurbo::Streamable++ def initialize(meeting)+ super++ @meeting = meeting+ # @project = series.project+ end+ end+enddiff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb b/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erbindex 8ad819e39be..048bb18b87c 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.html.erb@@ -1,7 +1,19 @@<%=component_wrapper doif show?- render(Primer::OpenProject::BorderBox::CollapsibleHeader.new(title: I18n.t("label_agenda_backlog"), box: @box, description: I18n.t("text_agenda_backlog"), count: @backlog.agenda_items.count, collapsed: @collapsed))+ flex_layout(align_items: :center, justify_content: :space_between) do |flex|+ flex.with_column(classes: "backlog--collapsible-header") do+ render(Primer::OpenProject::BorderBox::CollapsibleHeader.new(title: I18n.t("label_agenda_backlog"), box: @box, description: I18n.t("text_agenda_backlog"), count: @backlog.agenda_items.count, collapsed: @collapsed))+ end++ flex.with_column(classes: "hide-when-print") 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)+ clear_action_item(menu)+ end+ end+ end+endend%>diff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rbindex b2ed8fccb2b..c7cfbc0e172 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb@@ -57,6 +57,20 @@ module MeetingSectionsendend+ def clear_action_item(menu)+ menu.with_item(+ label: I18n.t(:label_recurring_meeting_series_delete),+ href: clear_backlog_dialog_meeting_sections_path(@meeting),+ scheme: :danger,+ tag: :a,+ content_arguments: {+ data: { controller: "async-dialog" }+ }+ ) do |item|+ item.with_leading_visual_icon(icon: :trash)+ end+ end+# def wrapper_data_attributes# {# controller: "generic-drag-and-drop",diff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.sass b/modules/meeting/app/components/meeting_sections/backlogs/header_component.sassnew file mode 100644index 00000000000..ce1fc1839d8--- /dev/null+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.sass@@ -0,0 +1,4 @@+@import 'helpers'++.backlog--collapsible-header+ flex-grow: 1diff --git a/modules/meeting/app/controllers/meeting_sections_controller.rb b/modules/meeting/app/controllers/meeting_sections_controller.rbindex c2e827c2ed8..96ea1fe2fe4 100644--- a/modules/meeting/app/controllers/meeting_sections_controller.rb+++ b/modules/meeting/app/controllers/meeting_sections_controller.rb@@ -30,11 +30,12 @@class MeetingSectionsController < ApplicationControllerinclude AttachableServiceCallinclude OpTurbo::ComponentStream+ include OpTurbo::DialogStreamHelperinclude Meetings::AgendaComponentStreamsbefore_action :set_meetingbefore_action :set_meeting_section,- except: %i[create]+ except: %i[create clear_backlog clear_backlog_dialog]before_action :authorizedef create # rubocop:disable Metrics/AbcSize@@ -170,6 +171,27 @@ class MeetingSectionsController < ApplicationControllerrespond_with_turbo_streamsend+ def clear_backlog+ errors = []++ @meeting.backlog.agenda_items.each do |item|+ call = ::MeetingAgendaItems::DeleteService+ .new(user: current_user, model: item)+ .call++ errors << call.errors unless call.success?+ end++ update_backlog_via_turbo_stream+ render_error_flash_message_via_turbo_stream(message: t("text_backlog_clear_error")) if errors.any?++ respond_with_turbo_streams+ end++ def clear_backlog_dialog+ respond_with_dialog MeetingSections::Backlogs::ClearBacklogDialogComponent.new(@meeting)+ end+privatedef set_meetingdiff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 6f7f76e8dae..fc12601cfbc 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -429,9 +429,16 @@ en:label_agenda_outcome_edit: "Edit outcome"label_agenda_outcome_delete: "Remove outcome"text_outcome_not_editable_anymore: "This outcome is not editable anymore."+ text_outcome_cannot_be_added: "An outcome can no longer be added."++ label_backlog_clear: "Clear backlog"+ label_backlog_clear_button: "Clear all"+ text_backlog_clear_error: "One or more errors occurred while trying to clear the backlog."label_agenda_backlog: "Agenda backlog"text_agenda_backlog: "This backlog is unique to this one-time meeting. You can drag items in and out to add or remove them from the meeting agenda."+ label_agenda_backlog_clear_title: "Clear agenda backlog?"+ text_agenda_backlog_clear_description: "Are you sure you want to remove all items currently in the agenda items? This action is not reversible."text_agenda_item_title: 'Agenda item "%{title}"'diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rbindex f2ff0936874..31bd28590a6 100644--- a/modules/meeting/config/routes.rb+++ b/modules/meeting/config/routes.rb@@ -112,8 +112,10 @@ Rails.application.routes.draw doendresources :sections, controller: "meeting_sections" docollection do- get :new, action: :new, as: :new- get :cancel_new+ # get :new, action: :new, as: :new+ # get :cancel_new+ post :clear_backlog+ get :clear_backlog_dialogendmember doget :cancel_editdiff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rbindex a522fb332c7..fcb265f3ff8 100644--- a/modules/meeting/lib/open_project/meeting/engine.rb+++ b/modules/meeting/lib/open_project/meeting/engine.rb@@ -91,7 +91,8 @@ module OpenProject::Meeting{meeting_agenda_items: %i[new cancel_new create edit cancel_edit update destroy drop movemove_to_next_meeting],- meeting_sections: %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+ clear_backlog clear_backlog_dialog]},permissible_on: :project, # TODO: Change this to :meeting when MeetingRoles are availablerequire: :member