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