Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add copy to clipboard action for agenda menu (#15195)

Oliver Günther64a9b92ddcd3
diff --git a/frontend/src/app/core/setup/globals/global-listeners.ts b/frontend/src/app/core/setup/globals/global-listeners.ts
index b21e778ebd9..33ed70aee73 100644
--- a/frontend/src/app/core/setup/globals/global-listeners.ts
+++ b/frontend/src/app/core/setup/globals/global-listeners.ts
@@ -36,10 +36,7 @@ import { dangerZoneValidation } from 'core-app/core/setup/globals/global-listene
import { setupServerResponse } from 'core-app/core/setup/globals/global-listeners/setup-server-response';
import { listenToSettingChanges } from 'core-app/core/setup/globals/global-listeners/settings';
import { detectOnboardingTour } from 'core-app/core/setup/globals/onboarding/onboarding_tour_trigger';
-import {
- openExternalLinksInNewTab,
- performAnchorHijacking,
-} from './global-listeners/link-hijacking';
+import { openExternalLinksInNewTab, performAnchorHijacking } from './global-listeners/link-hijacking';
import { fixFragmentAnchors } from 'core-app/core/setup/globals/global-listeners/fix-fragment-anchors';
/**
@@ -92,7 +89,7 @@ export function initializeGlobalListeners():void {
if (hash && hash.startsWith('#')) {
try {
const el = document.querySelector(hash);
- el && el.scrollIntoView();
+ el && el.scrollIntoView({ behavior: 'smooth', block: 'start' });
} catch (e) {
// This is very likely an invalid selector such as a Google Analytics tag.
// We can safely ignore this and just not scroll in this case.
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.html.erb
index 94b104b82f4..701053c2626 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
@@ -1,6 +1,6 @@
<%=
component_wrapper do
- grid_layout('op-meeting-agenda-item', tag: :div) do |grid|
+ grid_layout('op-meeting-agenda-item', tag: :div, id: "item-#{@meeting_agenda_item.id}") do |grid|
if drag_and_drop_enabled?
grid.with_area(:'drag-handle', tag: :div) do
render(Primer::OpenProject::DragHandle.new(classes: 'handle'))
@@ -71,6 +71,7 @@
test_selector: 'op-meeting-agenda-actions')
edit_action_item(menu) if @meeting_agenda_item.editable?
add_note_action_item(menu) if @meeting_agenda_item.editable? && @meeting_agenda_item.notes.blank?
+ copy_action_item(menu)
move_actions(menu)
delete_action_item(menu)
end
diff --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.rb
index 0c3affb47a7..23bfed84fef 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
@@ -98,6 +98,15 @@ module MeetingAgendaItems
end
end
+ def copy_action_item(menu)
+ url = url_for(anchor: "item-#{@meeting_agenda_item.id}", only_path: false)
+ menu.with_item(label: t("button_copy_link_to_clipboard"),
+ tag: :"clipboard-copy",
+ content_arguments: { value: url }) do |item|
+ item.with_leading_visual_icon(icon: :copy)
+ end
+ end
+
def move_actions(menu)
move_action_item(menu, :highest, t("label_agenda_item_move_to_top"), "move-to-top") unless first?
move_action_item(menu, :higher, t("label_agenda_item_move_up"), "chevron-up") unless first?
diff --git a/modules/meeting/spec/features/structured_meetings/history_spec.rb b/modules/meeting/spec/features/structured_meetings/history_spec.rb
index cb772df335b..fc299a546ab 100644
--- a/modules/meeting/spec/features/structured_meetings/history_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/history_spec.rb
@@ -316,9 +316,9 @@ RSpec.describe "history",
click_on "Notes"
end
- show_page.cancel_add_form
show_page.expect_agenda_item(title: "My agenda item")
item = MeetingAgendaItem.find_by(title: "My agenda item")
+ show_page.cancel_add_form
show_page.select_action(item, "Add notes")
editor.set_markdown "# Hello there"