Using $q in stead of q so now details are actually displayed.

pull/1535/head
Richard 10 years ago
parent 12a2a78c76
commit 4c623532d7
  1. 12
      app/assets/javascripts/angular/hal/api-resource.js
  2. 3
      app/assets/javascripts/angular/services/work-package-service.js
  3. 8
      app/assets/javascripts/angular/work_packages/controllers/work-package-details-controller.js
  4. 1
      app/assets/javascripts/application.js.erb
  5. 2
      public/templates/work_packages.list.details.html

@ -1,25 +1,21 @@
angular.module('openproject.hal')
.factory('HALAPIResource', function HALAPIResource() {
.factory('HALAPIResource', ['$q', function HALAPIResource($q) {
'use strict';
var HALAPIResource = {
configure: function() {
Hyperagent.configure('ajax', function ajax(options) {
// options.dataType = "json";
return jQuery.ajax(options);
});
Hyperagent.configure('defer', $q.defer);
},
setup: function(uri) {
HALAPIResource.configure();
return new Hyperagent.Resource({
url: 'http://opapi.apiary-mock.com/' + uri,
});
});
}
}
return HALAPIResource;
});
}]);

@ -45,9 +45,6 @@ angular.module('openproject.services')
return resource.fetch().then(function (wp) {
workPackage = wp;
return workPackage;
}).fail(function(error){
var err = error;
// Do something sensible
});
},

@ -35,8 +35,12 @@ angular.module('openproject.workPackages.controllers')
function($scope, $stateParams, WorkPackageService) {
$scope.workPackageId = $stateParams.workPackageId;
WorkPackageService.getWorkPackage($scope.workPackageId).then(function(workPackage) {
$scope.workPackage = workPackage;
$scope.$watch('rows', function(rows) {
if (rows && rows.length > 0) {
WorkPackageService.getWorkPackage($scope.workPackageId).then(function(workPackage) {
$scope.workPackage = workPackage;
});
}
});
}
]);

@ -53,7 +53,6 @@
//= require warn_leaving_unsaved
//= require openproject_plugins
//= require versions
//= require q/q
//= require uri.js/src/URI
//= require uri.js/src/URITemplate
//= require hyperagent/dist/hyperagent

@ -1,4 +1,4 @@
<div ng-if="workPackage.props.subject">
<div>
<h2>
<span>{{ workPackage.props.type }}</span>
{{ workPackage.props.subject }}

Loading…
Cancel
Save