From 58dd2f2b30d83321872ccc66b206f36907f7c70a Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Mon, 31 Oct 2016 17:10:21 +0100 Subject: [PATCH 1/4] change all isProjected functions (closes #2462) --- openslides/agenda/static/js/agenda/base.js | 26 +++++++++---------- openslides/agenda/static/js/agenda/site.js | 20 +++++++------- .../agenda/current-list-of-speakers.html | 12 ++++----- .../static/templates/agenda/item-detail.html | 12 ++++----- .../static/templates/agenda/item-list.html | 26 +++++++++---------- .../assignments/static/js/assignments/base.js | 10 +++---- .../assignments/assignment-list.html | 2 +- openslides/core/static/js/core/base.js | 22 +++++++++++----- .../static/templates/projector-button.html | 12 ++++----- .../templates/mediafiles/mediafile-list.html | 14 +++++----- .../motions/motion-detail/toolbar.html | 2 +- .../static/templates/motions/motion-list.html | 2 +- .../static/templates/users/user-list.html | 2 +- 13 files changed, 85 insertions(+), 77 deletions(-) diff --git a/openslides/agenda/static/js/agenda/base.js b/openslides/agenda/static/js/agenda/base.js index 132f01b7a..941241c21 100644 --- a/openslides/agenda/static/js/agenda/base.js +++ b/openslides/agenda/static/js/agenda/base.js @@ -130,7 +130,7 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) }, // override isProjected function of jsDataModel factory isProjected: function (tree) { - // Returns the id of the last projector with an agenda-item element. Else return 0. + // Returns all ids of all projectors with an agenda-item element. Otherwise an empty list. if (typeof tree === 'undefined') { tree = false; } @@ -150,13 +150,13 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) } return value; }; - var isProjected = 0; + var isProjectedIds = []; Projector.getAll().forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - isProjected = projector.id; + isProjectedIds.push(projector.id); } }); - return isProjected; + return isProjectedIds; }, // project list of speakers projectListOfSpeakers: function(projectorId) { @@ -175,21 +175,21 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) }, // check if list of speakers is projected isListOfSpeakersProjected: function () { - // Returns the id of the last projector with an element with the - // name 'agenda/list-of-speakers' and the same id. + // Returns all ids of all projectors with an element with the + // name 'agenda/list-of-speakers' and the same id. Else returns an empty list. var self = this; var predicate = function (element) { return element.name == 'agenda/list-of-speakers' && typeof element.id !== 'undefined' && element.id == self.id; }; - var isProjected = 0; + var isProjecteds = []; Projector.getAll().forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - isProjected = projector.id; + isProjecteds.push(projector.id); } }); - return isProjected; + return isProjecteds; }, hasSubitems: function(items) { var self = this; @@ -378,19 +378,19 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users']) } }, isProjected: function () { - // Returns the id of the last projector with an agenda-item element. Else return 0. - var isProjected = 0; + // Returns the ids of all projectors with an agenda-item element. Else return an empty list. var predicate = function (element) { var value; value = element.name == 'agenda/current-list-of-speakers-overlay'; return value; }; + var isProjectedIds = []; Projector.getAll().forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - isProjected = projector.id; + isProjectedIds.push(projector.id); } }); - return isProjected; + return isProjectedIds; } }; } diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 49efc3f78..4526f4850 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -285,8 +285,8 @@ angular.module('OpenSlidesApp.agenda.site', [ }; // check if agenda is projected $scope.isAgendaProjected = function (tree) { - // Returns true if there is a projector element with the name - // 'agenda/item-list'. + // Returns the ids of all projectors with an element with + // the name 'agenda/item-list'. Else returns an empty list. var predicate = function (element) { var value; if (tree) { @@ -302,13 +302,13 @@ angular.module('OpenSlidesApp.agenda.site', [ } return value; }; - var projectorId = 0; + var projectorIds = []; $scope.projectors.forEach(function (projector) { if (typeof _.findKey(projector.elements, predicate) === 'string') { - projectorId = projector.id; + projectorIds.push(projector.id); } }); - return projectorId; + return projectorIds; }; // auto numbering of agenda items $scope.autoNumbering = function() { @@ -580,18 +580,18 @@ angular.module('OpenSlidesApp.agenda.site', [ }; // same logic as in core/base.js $scope.isCurrentLoSProjected = function () { - // Returns the projector id if there is a projector element with the name - // 'agenda/current-list-of-speakers'. Elsewise returns 0. - var projectorId = 0; + // Returns the ids of all projectors with an element with the name + // 'agenda/current-list-of-speakers'. Elsewise returns an empty list. + var projectorIds = []; $scope.projectors.forEach(function (projector) { var key = _.findKey(projector.elements, function (element) { return element.name == 'agenda/current-list-of-speakers'; }); if (typeof key === 'string') { - projectorId = projector.id; + projectorIds.push(projector.id); } }); - return projectorId; + return projectorIds; }; // go to the list of speakers (management) of the currently diff --git a/openslides/agenda/static/templates/agenda/current-list-of-speakers.html b/openslides/agenda/static/templates/agenda/current-list-of-speakers.html index cd0473467..9fc81d3f4 100644 --- a/openslides/agenda/static/templates/agenda/current-list-of-speakers.html +++ b/openslides/agenda/static/templates/agenda/current-list-of-speakers.html @@ -15,24 +15,24 @@
+ uib-tooltip="{{ 'Projector' | translate }} {{ isCurrentLoSProjected()[0] || '' }}" + tooltip-enable="isCurrentLoSProjected().length">