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
Allow copying work packages to other projects
Oliver Günthera3b862d5a674
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex d6aa73e0622..84ba517218e 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -78,6 +78,7 @@ en:button_confirm: "Confirm"button_continue: "Continue"button_copy: "Copy"+ button_copy_to_other_project: "Copy to other project"button_custom-fields: "Custom fields"button_delete: "Delete"button_delete_watcher: "Delete watcher"diff --git a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-static-context-menu-actions.ts b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-static-context-menu-actions.tsindex 41d5e2c7f29..8ca7d5ef3a1 100644--- a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-static-context-menu-actions.ts+++ b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-static-context-menu-actions.ts@@ -15,6 +15,12 @@ export const PERMITTED_CONTEXT_MENU_ACTIONS = [link: 'copy',resource: 'workPackage',},+ {+ key: 'copy_to_other_project',+ link: 'copy',+ icon: 'icon-project-types',+ resource: 'workPackage',+ },{key: 'delete',link: 'delete',diff --git a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.tsindex c7437ca3e82..6f1797f2c83 100644--- a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts+++ b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts@@ -21,6 +21,7 @@ import { TimeEntryCreateService } from 'core-app/shared/components/time_entries/import { splitViewRoute } from 'core-app/features/work-packages/routing/split-view-routes.helper';import { WpDestroyModalComponent } from 'core-app/shared/components/modals/wp-destroy-modal/wp-destroy.modal';import isNewResource from 'core-app/features/hal/helpers/is-new-resource';+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';export class WorkPackageViewContextMenu extends OpContextMenuHandler {@InjectField() protected states!:States;@@ -37,6 +38,8 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {@InjectField() protected timeEntryCreateService:TimeEntryCreateService;+ @InjectField() protected pathHelper:PathHelperService;+protected workPackage = this.states.workPackages.get(this.workPackageId).value!;protected selectedWorkPackages = this.getSelectedWorkPackages();@@ -73,6 +76,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {public triggerContextMenuAction(action:WorkPackageAction) {const { link } = action;+ const id = this.workPackage.id as string;switch (action.key) {case 'delete':@@ -87,6 +91,10 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {this.copySelectedWorkPackages(link!);break;+ case 'copy_to_other_project':+ window.location.href = `${this.pathHelper.staticBase}/work_packages/move/new?copy=true&ids[]=${id}`;+ break;+case 'relation-new-child':this.wpRelationsHierarchyService.addNewChildWp(this.baseRoute, this.workPackage);break;diff --git a/spec/features/work_packages/copy_spec.rb b/spec/features/work_packages/copy_spec.rbindex 24b72a9a0e3..24e93adf676 100644--- a/spec/features/work_packages/copy_spec.rb+++ b/spec/features/work_packages/copy_spec.rb@@ -138,7 +138,7 @@ RSpec.feature 'Work package copy', js: true, selenium: true do# Go to add cost entry pagefind('#action-show-more-dropdown-menu .button').click- find('.menu-item', text: 'Copy').click+ find('.menu-item', text: 'Copy', exact_text: true).clickto_copy_work_package_page = Pages::FullWorkPackageCreate.new original_work_package: original_work_packageto_copy_work_package_page.update_attributes Description: 'Copied WP Description'diff --git a/spec/features/work_packages/table/context_menu_spec.rb b/spec/features/work_packages/table/context_menu_spec.rbindex 637876fc3e2..cedebb56c4f 100644--- a/spec/features/work_packages/table/context_menu_spec.rb+++ b/spec/features/work_packages/table/context_menu_spec.rb@@ -84,6 +84,12 @@ describe 'Work package table context menu', js: true dogoto_context_menu list_viewmenu.expect_no_options 'Add predecessor', 'Add follower'++ # Copy to other project+ goto_context_menu list_view+ menu.choose('Copy to other project')+ expect(page).to have_selector('h2', text: I18n.t(:button_copy))+ expect(page).to have_selector('a.work_package', text: "##{work_package.id}")endenddiff --git a/spec/support/components/work_packages/context_menu.rb b/spec/support/components/work_packages/context_menu.rbindex ef746c31598..d53f56172f9 100644--- a/spec/support/components/work_packages/context_menu.rb+++ b/spec/support/components/work_packages/context_menu.rb@@ -55,7 +55,7 @@ module Componentsenddef choose(target)- find("#{selector} .menu-item", text: target).click+ find("#{selector} .menu-item", text: target, exact_text: true).clickenddef expect_no_options(*options)