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 wp#shares controller stub

ulferts66e1d0496556
diff --git a/app/controllers/work_packages/shares_controller.rb b/app/controllers/work_packages/shares_controller.rb
new file mode 100644
index 00000000000..7a313cda4e6
--- /dev/null
+++ b/app/controllers/work_packages/shares_controller.rb
@@ -0,0 +1,32 @@
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2023 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 WorkPackages::SharesController < ApplicationController
+ def index
+ end
+end
diff --git a/config/routes.rb b/config/routes.rb
index 65ccdb1f7a4..514a481ec14 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -457,6 +457,9 @@ OpenProject::Application.routes.draw do
# states managed by client-side routing on work_package#index
get 'details/*state' => 'work_packages#index', on: :collection, as: :details
+ # Rails managed sharing route
+ get '/share' => 'work_packages/shares#index', on: :member
+
# states managed by client-side (angular) routing on work_package#show
get '/' => 'work_packages#index', on: :collection, as: 'index'
get '/create_new' => 'work_packages#index', on: :collection, as: 'new_split'
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-share-button/wp-share-button.component.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-share-button/wp-share-button.component.ts
index 639a5a42004..72fc50379a2 100644
--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-share-button/wp-share-button.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-share-button/wp-share-button.component.ts
@@ -59,6 +59,6 @@ export class WorkPackageShareButtonComponent extends UntilDestroyedMixin {
}
openModal():void {
- this.opModalService.show(WorkPackageShareModalComponent, 'global', {});
+ this.opModalService.show(WorkPackageShareModalComponent, 'global', { workPackage: this.workPackage });
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.html b/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.html
index 11047b6edc4..2ce06769f65 100644
--- a/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.html
+++ b/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.html
@@ -6,7 +6,8 @@
>TODO</div>
<div class="spot-modal--body spot-container">
- DO SOME TURBO Stuff
+ <turbo-frame src="{{this.frameSrc}}">
+ </turbo-frame>
</div>
<div class="spot-action-bar hidden-for-mobile">
<div class="spot-action-bar--right">
diff --git a/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.ts b/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.ts
index 8e48dde6fe2..88cfdf14860 100644
--- a/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.ts
+++ b/frontend/src/app/features/work-packages/components/wp-share-modal/wp-share.modal.ts
@@ -10,12 +10,16 @@ import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';
import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';
import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
@Component({
templateUrl: './wp-share.modal.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WorkPackageShareModalComponent extends OpModalComponent implements OnInit {
+ private workPackage:WorkPackageResource;
+ public frameSrc:string;
+
constructor(
@Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
readonly cdRef:ChangeDetectorRef,
@@ -23,6 +27,10 @@ export class WorkPackageShareModalComponent extends OpModalComponent implements
readonly elementRef:ElementRef,
) {
super(locals, cdRef, elementRef);
+
+ this.workPackage = this.locals.workPackage as WorkPackageResource;
+ // TODO: put into path helper
+ this.frameSrc = `/work_packages/${this.workPackage.id as string}/share`;
}
ngOnInit() {
diff --git a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
index 1441ef0dba7..9a220d73244 100644
--- a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
+++ b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
@@ -29,6 +29,7 @@
import {
Injector,
NgModule,
+ CUSTOM_ELEMENTS_SCHEMA,
} from '@angular/core';
import { OpSharedModule } from 'core-app/shared/shared.module';
import { OpenprojectFieldsModule } from 'core-app/shared/components/fields/openproject-fields.module';
@@ -190,6 +191,7 @@ import { WorkPackageTimerButtonComponent } from 'core-app/features/work-packages
import { OpenprojectTimeEntriesModule } from 'core-app/shared/components/time_entries/openproject-time-entries.module';
import { RecentItemsService } from 'core-app/core/recent-items.service';
import { WorkPackageShareButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-share-button/wp-share-button.component';
+import { WorkPackageShareModalComponent } from 'core-app/features/work-packages/components/wp-share-modal/wp-share.modal';
@NgModule({
imports: [
@@ -407,6 +409,7 @@ import { WorkPackageShareButtonComponent } from 'core-app/features/work-packages
QuerySharingModalComponent,
SaveQueryModalComponent,
WpDestroyModalComponent,
+ WorkPackageShareModalComponent,
// CustomActions
WpCustomActionComponent,
@@ -465,6 +468,7 @@ import { WorkPackageShareButtonComponent } from 'core-app/features/work-packages
WorkPackageSplitViewComponent,
BackButtonComponent,
],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class OpenprojectWorkPackagesModule {
static bootstrapAttributeGroupsCalled = false;
diff --git a/spec/routing/work_packages_spec.rb b/spec/routing/work_packages_spec.rb
index 7230374f549..4dd1f203c53 100644
--- a/spec/routing/work_packages_spec.rb
+++ b/spec/routing/work_packages_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe WorkPackagesController do
state: '5/overview')
end
- it 'should connect GET /projects/:project_id/work_packages/details/:id/:state' +
+ it 'connects GET /projects/:project_id/work_packages/details/:id/:state' +
' to work_packages#index' do
expect(get('/projects/1/work_packages/details/2/overview'))
.to route_to(controller: 'work_packages',
@@ -91,6 +91,12 @@ RSpec.describe WorkPackagesController do
id: '1')
end
+ it 'connects GET /work_packages/:id/share to work_packages/shares#index' do
+ expect(get('/work_packages/1/shares')).to route_to(controller: 'work_packages/shares',
+ action: 'index',
+ id: '1')
+ end
+
it 'connects GET /work_packages/:work_package_id/moves/new to work_packages/moves#new' do
expect(get('/work_packages/1/move/new')).to route_to(controller: 'work_packages/moves',
action: 'new',