Fixes for the item projection (fixes #3733)

This commit is contained in:
FinnStutzenstein 2018-05-04 10:07:53 +02:00 committed by Emanuel Schütze
parent 7b9d8d11a6
commit 0a141adbd1
5 changed files with 22 additions and 16 deletions

View File

@ -159,7 +159,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
}, },
}; };
} }
ProjectHelper.project(requestData); return ProjectHelper.project(requestData);
} else { // Project the content object } else { // Project the content object
var contentObject = DS.get(this.content_object.collection, this.content_object.id); var contentObject = DS.get(this.content_object.collection, this.content_object.id);
return contentObject.project(projectorId); return contentObject.project(projectorId);
@ -214,7 +214,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
}, },
}; };
} }
ProjectHelper.project(requestData); return ProjectHelper.project(requestData);
}, },
// check if list of speakers is projected // check if list of speakers is projected
isListOfSpeakersProjected: function () { isListOfSpeakersProjected: function () {

View File

@ -381,13 +381,15 @@ angular.module('OpenSlidesApp.agenda.site', [
}; };
// change whether one item or all subitems should be projected // change whether one item or all subitems should be projected
$scope.changeItemTree = function (item) { $scope.changeItemTree = function (item) {
var isProjected = item.isProjected(item.tree); var tree = item.tree;
if (isProjected > 0) {
// Deactivate and reactivate
item.project(isProjected, item.tree);
item.project(isProjected, !item.tree);
}
item.tree = !item.tree; item.tree = !item.tree;
var isProjected = item.isProjected(tree);
_.forEach(isProjected, function (projectorId) {
// Deactivate and reactivate
item.project(projectorId, tree).then(function (s) {
item.project(projectorId, !tree);
});
});
}; };
// check if agenda is projected // check if agenda is projected
$scope.isAgendaProjected = function (tree) { $scope.isAgendaProjected = function (tree) {

View File

@ -371,7 +371,7 @@ angular.module('OpenSlidesApp.assignments', [])
}, },
}; };
} }
ProjectHelper.project(requestData); return ProjectHelper.project(requestData);
}, },
// override isProjected function of jsDataModel factory // override isProjected function of jsDataModel factory
isProjected: function (poll_id, anyPoll) { isProjected: function (poll_id, anyPoll) {

View File

@ -744,7 +744,7 @@ angular.module('OpenSlidesApp.core', [
element: {name: this.getResourceName(), id: this.id}, element: {name: this.getResourceName(), id: this.id},
}; };
} }
ProjectHelper.project(requestData); return ProjectHelper.project(requestData);
}; };
BaseModel.prototype.isProjected = function() { BaseModel.prototype.isProjected = function() {
// Returns the ids of all projectors if there is a projector element // Returns the ids of all projectors if there is a projector element
@ -1265,9 +1265,10 @@ angular.module('OpenSlidesApp.core', [
// with the given data. Also it does the changes done by the server // with the given data. Also it does the changes done by the server
// locally and may reverts them, if something went wrong. // locally and may reverts them, if something went wrong.
.factory('ProjectHelper', [ .factory('ProjectHelper', [
'$q',
'$http', '$http',
'Projector', 'Projector',
function ($http, Projector) { function ($q, $http, Projector) {
var uuid4 = function () { var uuid4 = function () {
function s8() { function s8() {
return Math.floor((1 + Math.random()) * 0x100000000) return Math.floor((1 + Math.random()) * 0x100000000)
@ -1336,12 +1337,15 @@ angular.module('OpenSlidesApp.core', [
Projector.inject(projectorsChanged); Projector.inject(projectorsChanged);
$http.post('/rest/core/projector/project/', data).then(null, return $q(function (resolve, reject) {
function (error) { $http.post('/rest/core/projector/project/', data).then(function (success) {
resolve(success);
}, function (error) {
// revert the changed made earlier // revert the changed made earlier
Projector.inject(originalProjectors); Projector.inject(originalProjectors);
} reject(error);
); });
});
}, },
}; };
} }

View File

@ -685,7 +685,7 @@ angular.module('OpenSlidesApp.motions', [
}, },
}; };
} }
ProjectHelper.project(requestData); return ProjectHelper.project(requestData);
}, },
isProjected: function (mode) { isProjected: function (mode) {
var self = this; var self = this;