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">
<ul class="dropdown-menu">
<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}}
</a>
</li>

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

@ -40,6 +40,7 @@ module.exports = function($scope,
UsersHelper,
ConfigurationService,
WorkPackageService,
ProjectService,
CommonRelationsHandler,
ChildrenRelationsHandler,
ParentRelationsHandler,
@ -65,10 +66,20 @@ module.exports = function($scope,
$scope.maxDescriptionLength = 800;
$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) {
WorkPackageService.getWorkPackage($scope.workPackage.props.id)
.then(function(workPackage) {
setWorkPackageScopeProperties(workPackage);
fetchProjectTypes();
$scope.$broadcast('workPackageRefreshed');
if (callback) {
callback(workPackage);

Loading…
Cancel
Save