From ee6ce82d39aa709af5e9dbf801d1e7aeafa23371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 11 May 2016 16:42:46 +0200 Subject: [PATCH] Require wpEditForm in wp-list-view-button --- .../wp-list-view-button/wp-list-view-button.directive.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.ts b/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.ts index 185486388f..0d8bb22c98 100644 --- a/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.ts +++ b/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.ts @@ -28,10 +28,11 @@ import {wpButtonsModule} from '../../../angular-modules'; import {WorkPackageNavigationButtonController, wpButtonDirective} from '../wp-buttons.module'; +import {WorkPackageEditFormController} from "../../wp-edit/wp-edit-form.directive"; export class WorkPackageListViewButtonController extends WorkPackageNavigationButtonController { public projectIdentifier:number; - public editAll:any; + public formCtrl:WorkPackageEditFormController; public accessKey:number = 8; public activeState:string = 'work-packages.list'; @@ -50,7 +51,7 @@ export class WorkPackageListViewButtonController extends WorkPackageNavigationBu } public get disabled() { - return !!this.editAll.state; + return this.formCtrl.inEditMode; } public performAction() { @@ -73,6 +74,10 @@ function wpListViewButton():ng.IDirective { projectIdentifier: '=', editAll: '=' }, + require: '^wpEditForm', + link: function(scope, element, attrs, wpEditForm) { + scope.vm.formCtrl = wpEditForm; + }, controller: WorkPackageListViewButtonController, });