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 new time entry modal to the context menu within a work package
Klaus Zandersf697fbd94e31
diff --git a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.tsindex 89a8259fc5f..2405eb91b6f 100644--- a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts+++ b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts@@ -14,11 +14,8 @@ import { PERMITTED_CONTEXT_MENU_ACTIONS } from 'core-app/shared/components/op-coimport { OpModalService } from 'core-app/shared/components/modal/modal.service';import { CopyToClipboardService } from 'core-app/shared/components/copy-to-clipboard/copy-to-clipboard.service';import { WorkPackageAction } from 'core-app/features/work-packages/components/wp-table/context-menu-helper/wp-context-menu-helper.service';-import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';-import { TimeEntryCreateService } from 'core-app/shared/components/time_entries/create/create.service';import { WpDestroyModalComponent } from 'core-app/shared/components/modals/wp-destroy-modal/wp-destroy.modal';import { WorkPackageAuthorization } from 'core-app/features/work-packages/services/work-package-authorization.service';-import * as moment from 'moment-timezone';import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';@Directive({@@ -27,9 +24,8 @@ import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.serviceexport class WorkPackageSingleContextMenuDirective extends OpContextMenuTrigger {@Input('wpSingleContextMenu-workPackage') public workPackage:WorkPackageResource;- @InjectField() public timeEntryCreateService:TimeEntryCreateService;-- constructor(readonly HookService:HookService,+ constructor(+ readonly HookService:HookService,readonly $state:StateService,readonly injector:Injector,readonly PathHelper:PathHelperService,@@ -70,11 +66,7 @@ export class WorkPackageSingleContextMenuDirective extends OpContextMenuTriggerthis.opModalService.show(WpDestroyModalComponent, this.injector, { workPackages: [this.workPackage] });break;case 'log_time':- this.timeEntryCreateService- .create(moment(new Date()), this.workPackage, { showWorkPackageField: false })- .catch(() => {- // do nothing, the user closed without changes- });+ void this.turboRequests.request(this.PathHelper.timeEntryWorkPackageDialog(this.workPackage.id as string), { method: 'GET' });break;case 'generate_pdf':void this.turboRequests.requestStream(link as string);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 51357461b0c..88a02f3050c 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@@ -23,7 +23,7 @@ import { splitViewRoute } from 'core-app/features/work-packages/routing/split-viimport { 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';-import * as moment from 'moment-timezone';+import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';export class WorkPackageViewContextMenu extends OpContextMenuHandler {@InjectField() protected states!:States;@@ -42,6 +42,8 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {@InjectField() protected pathHelper:PathHelperService;+ @InjectField() protected turboRequests:TurboRequestsService;+protected workPackage = this.states.workPackages.get(this.workPackageId).value!;protected selectedWorkPackages = this.getSelectedWorkPackages();@@ -160,11 +162,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {}private logTimeForSelectedWorkPackage() {- this.timeEntryCreateService- .create(moment(new Date()), this.workPackage)- .catch(() => {- // do nothing, the user closed without changes- });+ void this.turboRequests.request(this.pathHelper.timeEntryWorkPackageDialog(this.workPackage.id as string), { method: 'GET' });}private getSelectedWorkPackages() {@@ -183,7 +181,7 @@ export class WorkPackageViewContextMenu extends OpContextMenuHandler {protected buildItems():OpContextMenuItem[] {const items = this.permittedActions.map((action:WorkPackageAction) => ({- class: undefined as string|undefined,+ class: undefined as string | undefined,disabled: false,linkText: action.text,href: action.href,diff --git a/modules/costs/app/controllers/time_entries_controller.rb b/modules/costs/app/controllers/time_entries_controller.rbindex 36e539c0b44..9dbfdb6fdbc 100644--- a/modules/costs/app/controllers/time_entries_controller.rb+++ b/modules/costs/app/controllers/time_entries_controller.rb@@ -42,7 +42,11 @@ class TimeEntriesController < ApplicationControllernilendend- @work_package = WorkPackage.visible.find_by(id: params[:work_package_id]) if params[:work_package_id].present?++ if params[:work_package_id].present?+ @work_package = WorkPackage.visible.find_by(id: params[:work_package_id])+ @project = @work_package.project+ end@time_entry = if params[:time_entry_id]# TODO: Properly handle authorization