Send assignments OPTION request for phases once only.
This commit is contained in:
parent
7843cc2ec0
commit
4faf3dd2c0
@ -67,17 +67,26 @@ angular.module('OpenSlidesApp.assignments', [])
|
||||
])
|
||||
|
||||
.factory('Assignment', [
|
||||
'$http',
|
||||
'DS',
|
||||
'AssignmentRelatedUser',
|
||||
'AssignmentPoll',
|
||||
'jsDataModel',
|
||||
'gettext',
|
||||
function (DS, AssignmentRelatedUser, AssignmentPoll, jsDataModel, gettext) {
|
||||
function ($http, DS, AssignmentRelatedUser, AssignmentPoll, jsDataModel, gettext) {
|
||||
var name = 'assignments/assignment';
|
||||
var phases;
|
||||
return DS.defineResource({
|
||||
name: name,
|
||||
useClass: jsDataModel,
|
||||
agendaSupplement: gettext('Election'),
|
||||
phases: phases,
|
||||
getPhases: function () {
|
||||
if (!this.phases) {
|
||||
this.phases = $http({ 'method': 'OPTIONS', 'url': '/rest/assignments/assignment/' });
|
||||
}
|
||||
return phases;
|
||||
},
|
||||
methods: {
|
||||
getResourceName: function () {
|
||||
return name;
|
||||
|
@ -34,8 +34,8 @@ angular.module('OpenSlidesApp.assignments.site', ['OpenSlidesApp.assignments'])
|
||||
assignments: function(Assignment) {
|
||||
return Assignment.findAll();
|
||||
},
|
||||
phases: function($http) {
|
||||
return $http({ 'method': 'OPTIONS', 'url': '/rest/assignments/assignment/' });
|
||||
phases: function(Assignment) {
|
||||
return Assignment.getPhases();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user