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
Update order and labels for action menus
Mir Bhatia6afe31ec6383
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erbindex cb63ec6eced..d9bad5eb8cd 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb@@ -67,9 +67,13 @@)edit_action_item(menu) if @meeting_agenda_item.editable?- add_note_action_item(menu) if @meeting_agenda_item.editable? && @meeting_agenda_item.notes.blank?+ if !in_backlog?+ copy_action_item(menu)+ end++ menu.with_divider if note_or_outcome_action_added?- menu.with_divider if add_outcome_action?+ add_note_action_item(menu) if add_note_action?add_outcome_action_item(menu) if add_outcome_action?unless first? && last?@@ -77,22 +81,16 @@move_actions(menu)end- if !in_template? || (in_template? && in_backlog?)- menu.with_divider+ menu.with_divider if move_to_different_section_or_meeting_action_added?++ if !in_template? || in_backlog?move_to_current_meeting_action_item(menu) if in_backlog?move_to_backlog_action_item(menu) if !in_backlog?end-if move_to_next_meeting_enabled?- menu.with_dividermove_to_next_meeting_action_item(menu)end- if !in_backlog?- menu.with_divider- copy_action_item(menu)- end-menu.with_dividerdelete_action_item(menu)enddiff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rbindex e02f3904a7e..2eb799c28b9 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb@@ -67,6 +67,10 @@ module MeetingAgendaItemsUser.current.allowed_in_project?(:manage_outcomes, @meeting.project)end+ def add_note_action?+ @meeting_agenda_item.editable? && @meeting_agenda_item.notes.blank?+ end+def first?@first ||=if @first_and_last.first@@ -127,7 +131,7 @@ module MeetingAgendaItemsdef copy_action_item(menu)url = meeting_url(@meeting, anchor: "item-#{@meeting_agenda_item.id}")- menu.with_item(label: t("button_copy_link_to_clipboard"),+ menu.with_item(label: t("meeting.copy.to_clipboard"),tag: :"clipboard-copy",content_arguments: { value: url }) do |item|item.with_leading_visual_icon(icon: :copy)@@ -168,7 +172,7 @@ module MeetingAgendaItemsenddef delete_action_item(menu)- label = @meeting_agenda_item.work_package_id.present? ? t(:label_agenda_item_remove) : t(:text_destroy)+ label = @meeting_agenda_item.work_package_id.present? ? wp_agenda_item_delete_label : t(:text_destroy)menu.with_item(label:,scheme: :danger,href: meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item),@@ -179,6 +183,10 @@ module MeetingAgendaItemsendend+ def wp_agenda_item_delete_label+ @meeting_agenda_item.in_backlog? ? t(:label_agenda_item_remove_from_backlog) : t(:label_agenda_item_remove_from_agenda)+ end+def move_action_item(menu, move_to, label_text, icon)menu.with_item(label: label_text,href: move_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item,@@ -239,5 +247,13 @@ module MeetingAgendaItemsdef in_template?@meeting.templated?end++ def note_or_outcome_action_added?+ (@meeting_agenda_item.editable? && @meeting_agenda_item.notes.blank?) || add_outcome_action?+ end++ def move_to_different_section_or_meeting_action_added?+ !in_template? || in_backlog? || move_to_next_meeting_enabled?+ endendenddiff --git a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rbindex 02962c4ba83..ac180633811 100644--- a/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb+++ b/modules/meeting/app/components/meeting_sections/backlogs/header_component.rb@@ -91,7 +91,7 @@ module MeetingSectionsdef add_agenda_item_action(menu)menu.with_item(- label: t("activerecord.models.meeting_agenda_item", count: 1),+ label: t("label_agenda_item_add", count: 1),href: new_meeting_agenda_item_path(@meeting, type: "simple", meeting_section_id: @backlog.id),content_arguments: {data: { "turbo-stream": true, "test-selector": "meeting-backlog-add-agenda-item-from-menu" }@@ -103,7 +103,7 @@ module MeetingSectionsdef add_work_package_action(menu)menu.with_item(- label: t("activerecord.models.work_package", count: 1),+ label: t("label_agenda_item_work_package_add", count: 1),href: new_meeting_agenda_item_path(@meeting, type: "work_package", meeting_section_id: @backlog.id),content_arguments: {data: { "turbo-stream": true, "test-selector": "meeting-backlog-add-work-package-from-menu" }diff --git a/modules/meeting/app/components/meeting_sections/header_component.html.erb b/modules/meeting/app/components/meeting_sections/header_component.html.erbindex dacf46f6867..6117e15ff16 100644--- a/modules/meeting/app/components/meeting_sections/header_component.html.erb+++ b/modules/meeting/app/components/meeting_sections/header_component.html.erb@@ -27,14 +27,14 @@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)+ menu.with_divider+ add_agenda_item_action(menu)+ add_work_package_action(menu)unless first? && last?menu.with_dividermove_actions(menu)endmenu.with_divider- add_agenda_item_action(menu)- add_work_package_action(menu)- menu.with_dividerdelete_action_item(menu)endenddiff --git a/modules/meeting/app/components/meeting_sections/header_component.rb b/modules/meeting/app/components/meeting_sections/header_component.rbindex 35ef3da18ab..fca56a8d8f8 100644--- a/modules/meeting/app/components/meeting_sections/header_component.rb+++ b/modules/meeting/app/components/meeting_sections/header_component.rb@@ -111,7 +111,7 @@ module MeetingSectionsenddef edit_action_item(menu)- menu.with_item(label: t("label_edit"),+ menu.with_item(label: t("label_section_rename"),href: edit_meeting_section_path(@meeting_section.meeting, @meeting_section),content_arguments: {data: { "turbo-stream": true, "test-selector": "meeting-section-edit" }@@ -122,7 +122,7 @@ module MeetingSectionsdef add_agenda_item_action(menu)menu.with_item(- label: t("activerecord.models.meeting_agenda_item", count: 1),+ label: t("label_agenda_item_add"),href: new_meeting_agenda_item_path(@meeting_section.meeting, type: "simple", meeting_section_id: @meeting_section&.id),content_arguments: {data: { "turbo-stream": true, "test-selector": "meeting-section-add-agenda-item-from-menu" }@@ -134,7 +134,7 @@ module MeetingSectionsdef add_work_package_action(menu)menu.with_item(- label: t("activerecord.models.work_package", count: 1),+ label: t("label_agenda_item_work_package_add"),href: new_meeting_agenda_item_path(@meeting_section.meeting, type: "work_package",meeting_section_id: @meeting_section&.id),content_arguments: {diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex 60b45f8c332..a27d244ff32 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -201,6 +201,7 @@ en:agenda_items: "Copy agenda items"agenda_text: "Copy the agenda of the old meeting"participants: "Copy list of participants"+ to_clipboard: "Copy to clipboard"email:send_emails: "Email participants"send_invitation_emails: >@@ -264,6 +265,7 @@ en:placeholder_title: "New section"empty_text: "Drag items here or create a new one"+recurring_meeting:ended_blankslate:title: "Meeting series ended"@@ -402,7 +404,9 @@ en:label_agenda_items: "Agenda items"label_agenda_items_reordered: "reordered"- label_agenda_item_remove: "Remove from agenda"+ label_agenda_item_add: "Add agenda item"+ label_agenda_item_remove_from_agenda: "Remove from agenda"+ label_agenda_item_remove_from_backlog: "Remove from backlog"label_agenda_item_undisclosed_wp: "Work package #%{id} not visible"label_agenda_item_deleted_wp: "Deleted work package reference"label_agenda_item_actions: "Agenda items actions"@@ -416,8 +420,11 @@ en:label_agenda_item_add_notes: "Add notes"label_agenda_item_add_outcome: "Add outcome"+ label_agenda_item_work_package_add: "Add work package"label_agenda_item_work_package: "Agenda item work package"+ label_section_rename: "Rename section"+label_agenda_outcome: "Outcome"label_agenda_outcome_actions: "Agenda outcome actions"label_agenda_outcome_edit: "Edit outcome"diff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rbindex 98cf7d38b07..bd521e65b17 100644--- a/modules/meeting/spec/support/pages/meetings/show.rb+++ b/modules/meeting/spec/support/pages/meetings/show.rb@@ -131,7 +131,7 @@ module Pages::Meetingsenddef add_agenda_item_to_section(section:, type: MeetingAgendaItem, save: true, &)- select_section_action(section, type.model_name.human)+ select_section_action(section, "Add #{type.model_name.human.downcase}")within("#meeting-sections-show-component-#{section.id}") doin_agenda_form do@@ -165,7 +165,7 @@ module Pages::Meetingsdef remove_agenda_item(item)accept_confirm(I18n.t("text_are_you_sure")) do- action = item.work_package ? I18n.t(:label_agenda_item_remove) : I18n.t(:button_delete)+ action = item.work_package ? wp_agenda_item_delete_label(item) : I18n.t(:button_delete)select_action(item, action)end@@ -173,6 +173,10 @@ module Pages::Meetingsexpect_no_agenda_item(title:)end+ def wp_agenda_item_delete_label(item)+ item.in_backlog? ? I18n.t(:label_agenda_item_remove_from_backlog) : I18n.t(:label_agenda_item_remove_from_agenda)+ end+def expect_agenda_item(title:)expect(page).to have_test_selector("op-meeting-agenda-title", text: title)end@@ -352,7 +356,7 @@ module Pages::Meetingsenddef add_agenda_item_to_backlog(type: MeetingAgendaItem, &)- select_backlog_action(type.model_name.human)+ select_backlog_action("Add #{type.model_name.human.downcase}")within("#meeting-sections-backlogs-container-component") doin_agenda_form do@@ -530,7 +534,7 @@ module Pages::Meetingsenddef edit_section(section, &)- select_section_action(section, "Edit")+ select_section_action(section, "Rename section")page.within_test_selector("meeting-section-header-container-#{section.id}", &)end