From 924eda1912641c50c57d127d07ee1fd559f18952 Mon Sep 17 00:00:00 2001 From: Alex Dik Date: Mon, 14 Dec 2015 14:34:10 +0100 Subject: [PATCH] Isolate the directive scope --- .../wp-list-view-button.directive.html | 9 +++++---- .../wp-list-view-button.directive.js | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.html b/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.html index 3929384e84..28c0090331 100644 --- a/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.html +++ b/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.html @@ -1,14 +1,15 @@ diff --git a/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.js b/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.js index 0da446cbeb..c790889acc 100644 --- a/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.js +++ b/frontend/app/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.js @@ -35,11 +35,13 @@ function wpListViewButton() { restrict: 'E', templateUrl: '/components/wp-buttons/wp-list-view-button/wp-list-view-button.directive.html', + scope: {}, + controller: WorkPackageListViewButtonController }; } -function WorkPackageListViewButtonController($scope, $state) { +function WorkPackageListViewButtonController($scope, $state, inplaceEditAll) { $scope.isActive = function () { return $state.is('work-packages.list'); }; @@ -51,4 +53,15 @@ function WorkPackageListViewButtonController($scope, $state) { }); }; + $scope.isDisabled = function () { + return inplaceEditAll.state; + }; + + $scope.text = { + get label() { + var activate = !$scope.isActive() ? I18n.t('js.label_activate') + ' ' : ''; + return activate + I18n.t('js.button_list_view'); + } + }; + }