simplify work pacakge creation method

Signed-off-by: Florian Kraft <f.kraft@finn.de>
pull/3204/head
Florian Kraft 9 years ago
parent c4a27100c3
commit 73b58e2d32
  1. 1
      frontend/app/api/hal-api-resource.js
  2. 7
      frontend/app/services/work-package-service.js
  3. 6
      frontend/app/work_packages/controllers/work-package-new-controller.js

@ -56,7 +56,6 @@ module.exports = function HALAPIResource($timeout, $q, PathHelper) {
Hyperagent.configure('_', _);
};
return {
setup: function(uri, params) {
if (!params) {
params = {};

@ -78,13 +78,6 @@ module.exports = function($http,
var WorkPackageService = {
initializeWorkPackage: function(projectIdentifier, initialData) {
var changes = _.clone(initialData);
if (initialData.type) {
changes._links = changes.links || {};
changes._links.type = {
href: initialData.type
};
delete changes.type;
}
var wp = {
embedded: {},
props: {},

@ -67,7 +67,11 @@ module.exports = function(
function activate() {
EditableFieldsState.forcedEditState = true;
vm.loaderPromise = WorkPackageService.initializeWorkPackage($scope.projectIdentifier, {
type: PathHelper.apiV3TypePath($stateParams.type)
_links: {
type: {
href: PathHelper.apiV3TypePath($stateParams.type)
}
}
}).then(function(wp) {
vm.workPackage = wp;
WorkPackageDisplayHelper.setFocus();

Loading…
Cancel
Save