Make creating work packages from show view work.

pull/3563/head
Tim Habermaas 9 years ago committed by Stefan Botzenhart
parent 4b810e40e7
commit b1c754b1e6
  1. 2
      frontend/app/templates/work_packages/menus/tasks_dropdown_menu.html
  2. 1
      frontend/app/work_packages/controllers/index.js
  3. 11
      frontend/app/work_packages/controllers/work-package-show-controller.js

@ -1,7 +1,7 @@
<div class="dropdown action-menu dropdown-relative dropdown-anchor-right" id="tasksDropdown" role="menu"> <div class="dropdown action-menu dropdown-relative dropdown-anchor-right" id="tasksDropdown" role="menu">
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li ng-repeat="type in availableTypes"> <li ng-repeat="type in availableTypes">
<a role="menuitem" focus="{{ !$index }}" ui-sref="work-packages.list.new({type: type.id})"> <a role="menuitem" focus="{{ !$index }}" ui-sref="work-packages.list.new({projectPath: PathHelper.staticBase + '/projects/' + projectIdentifier, type: type.id})">
{{type.name}} {{type.name}}
</a> </a>
</li> </li>

@ -124,6 +124,7 @@ angular.module('openproject.workPackages.controllers')
'UsersHelper', 'UsersHelper',
'ConfigurationService', 'ConfigurationService',
'WorkPackageService', 'WorkPackageService',
'ProjectService',
'CommonRelationsHandler', 'CommonRelationsHandler',
'ChildrenRelationsHandler', 'ChildrenRelationsHandler',
'ParentRelationsHandler', 'ParentRelationsHandler',

@ -40,6 +40,7 @@ module.exports = function($scope,
UsersHelper, UsersHelper,
ConfigurationService, ConfigurationService,
WorkPackageService, WorkPackageService,
ProjectService,
CommonRelationsHandler, CommonRelationsHandler,
ChildrenRelationsHandler, ChildrenRelationsHandler,
ParentRelationsHandler, ParentRelationsHandler,
@ -65,10 +66,20 @@ module.exports = function($scope,
$scope.maxDescriptionLength = 800; $scope.maxDescriptionLength = 800;
$scope.projectIdentifier = $scope.workPackage.embedded.project.props.identifier; $scope.projectIdentifier = $scope.workPackage.embedded.project.props.identifier;
function fetchProjectTypes() {
ProjectService.getProject($scope.projectIdentifier)
.then(function(project) {
$scope.availableTypes = project.embedded.types;
});
}
fetchProjectTypes();
function refreshWorkPackage(callback) { function refreshWorkPackage(callback) {
WorkPackageService.getWorkPackage($scope.workPackage.props.id) WorkPackageService.getWorkPackage($scope.workPackage.props.id)
.then(function(workPackage) { .then(function(workPackage) {
setWorkPackageScopeProperties(workPackage); setWorkPackageScopeProperties(workPackage);
fetchProjectTypes();
$scope.$broadcast('workPackageRefreshed'); $scope.$broadcast('workPackageRefreshed');
if (callback) { if (callback) {
callback(workPackage); callback(workPackage);

Loading…
Cancel
Save