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
var contentObject = DS.get(this.content_object.collection, this.content_object.id);
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
isListOfSpeakersProjected: function () {

View File

@ -381,13 +381,15 @@ angular.module('OpenSlidesApp.agenda.site', [
};
// change whether one item or all subitems should be projected
$scope.changeItemTree = function (item) {
var isProjected = item.isProjected(item.tree);
if (isProjected > 0) {
// Deactivate and reactivate
item.project(isProjected, item.tree);
item.project(isProjected, !item.tree);
}
var 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
$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
isProjected: function (poll_id, anyPoll) {

View File

@ -744,7 +744,7 @@ angular.module('OpenSlidesApp.core', [
element: {name: this.getResourceName(), id: this.id},
};
}
ProjectHelper.project(requestData);
return ProjectHelper.project(requestData);
};
BaseModel.prototype.isProjected = function() {
// 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
// locally and may reverts them, if something went wrong.
.factory('ProjectHelper', [
'$q',
'$http',
'Projector',
function ($http, Projector) {
function ($q, $http, Projector) {
var uuid4 = function () {
function s8() {
return Math.floor((1 + Math.random()) * 0x100000000)
@ -1336,12 +1337,15 @@ angular.module('OpenSlidesApp.core', [
Projector.inject(projectorsChanged);
$http.post('/rest/core/projector/project/', data).then(null,
function (error) {
return $q(function (resolve, reject) {
$http.post('/rest/core/projector/project/', data).then(function (success) {
resolve(success);
}, function (error) {
// revert the changed made earlier
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) {
var self = this;