Merge pull request #1711 from ostcar/fix_assignment_autoupdate
Angular: Eject assignment related users before a assignment is updated
This commit is contained in:
commit
6dee05328d
@ -80,6 +80,9 @@ angular.module('OpenSlidesApp.assignments', [])
|
|||||||
foreignKey: 'assignment_id',
|
foreignKey: 'assignment_id',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
beforeInject: function (resource, instance) {
|
||||||
|
AssignmentRelatedUser.ejectAll({where: {assignment_id: {'==': instance.id}}});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -130,29 +130,33 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
.factory('jsDataModel', ['$http', 'Projector', function($http, Projector) {
|
.factory('jsDataModel', [
|
||||||
var BaseModel = function() {};
|
'$http',
|
||||||
BaseModel.prototype.project = function() {
|
'Projector',
|
||||||
return $http.post(
|
function($http, Projector) {
|
||||||
'/rest/core/projector/1/prune_elements/',
|
var BaseModel = function() {};
|
||||||
[{name: this.getResourceName(), id: this.id}]
|
BaseModel.prototype.project = function() {
|
||||||
);
|
return $http.post(
|
||||||
};
|
'/rest/core/projector/1/prune_elements/',
|
||||||
BaseModel.prototype.isProjected = function() {
|
[{name: this.getResourceName(), id: this.id}]
|
||||||
// Returns true if there is a projector element with the same
|
);
|
||||||
// name and the same id.
|
|
||||||
var projector = Projector.get(1);
|
|
||||||
if (typeof projector === 'undefined') return false;
|
|
||||||
var self = this;
|
|
||||||
var predicate = function (element) {
|
|
||||||
return element.name == self.getResourceName() &&
|
|
||||||
typeof element.id !== 'undefined' &&
|
|
||||||
element.id == self.id;
|
|
||||||
};
|
};
|
||||||
return typeof _.findKey(projector.elements, predicate) === 'string';
|
BaseModel.prototype.isProjected = function() {
|
||||||
};
|
// Returns true if there is a projector element with the same
|
||||||
return BaseModel;
|
// name and the same id.
|
||||||
}])
|
var projector = Projector.get(1);
|
||||||
|
if (typeof projector === 'undefined') return false;
|
||||||
|
var self = this;
|
||||||
|
var predicate = function (element) {
|
||||||
|
return element.name == self.getResourceName() &&
|
||||||
|
typeof element.id !== 'undefined' &&
|
||||||
|
element.id == self.id;
|
||||||
|
};
|
||||||
|
return typeof _.findKey(projector.elements, predicate) === 'string';
|
||||||
|
};
|
||||||
|
return BaseModel;
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
.factory('Customslide', [
|
.factory('Customslide', [
|
||||||
'DS',
|
'DS',
|
||||||
|
Loading…
Reference in New Issue
Block a user