diff --git a/frontend/app/components/wp-buttons/create-button/create-button.directive.js b/frontend/app/components/wp-buttons/create-button/create-button.directive.js index c96230d6fe..d4088a06ea 100644 --- a/frontend/app/components/wp-buttons/create-button/create-button.directive.js +++ b/frontend/app/components/wp-buttons/create-button/create-button.directive.js @@ -52,10 +52,18 @@ function WorkPackageCreateButtonController($state, ProjectService) { canCreate= false; vm.text = I18n.t('js.toolbar.unselected_title'); + vm.isDisabled = function () { return !inProjectContext || !canCreate || $state.includes('**.new') || !vm.types; }; + vm.createWorkPackage = function (type) { + $state.go(vm.stateName, { + projectPath: vm.projectIdentifier, + type: type + }) + }; + if (inProjectContext) { ProjectService.fetchProjectResource(vm.projectIdentifier).then(function(project) { canCreate = !!project.links.createWorkPackage; diff --git a/frontend/app/components/wp-buttons/create-button/types-drop-down-menu.template.html b/frontend/app/components/wp-buttons/create-button/types-drop-down-menu.template.html index d9d94c93b0..952f89267b 100644 --- a/frontend/app/components/wp-buttons/create-button/types-drop-down-menu.template.html +++ b/frontend/app/components/wp-buttons/create-button/types-drop-down-menu.template.html @@ -3,9 +3,7 @@