diff --git a/openslides/core/static/js/core/base.js b/openslides/core/static/js/core/base.js index 05c8ef4c7..34d9efa0f 100644 --- a/openslides/core/static/js/core/base.js +++ b/openslides/core/static/js/core/base.js @@ -15,15 +15,6 @@ angular.module('OpenSlidesApp.core', [ 'OpenSlidesApp-templates', ]) -.config([ - '$httpProvider', - function($httpProvider) { - // Combine the django csrf system with the angular csrf system - $httpProvider.defaults.xsrfCookieName = 'OpenSlidesCsrfToken'; - $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; - } -]) - .config([ 'DSProvider', 'DSHttpAdapterProvider', diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index f268ce039..8774db95a 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -184,6 +184,16 @@ angular.module('OpenSlidesApp.core.site', [ } ]) +.config([ + '$httpProvider', + function($httpProvider) { + // Combine the django csrf system with the angular csrf system + $httpProvider.defaults.xsrfCookieName = 'OpenSlidesCsrfToken'; + $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'; + } +]) + + .config([ '$stateProvider', '$urlMatcherFactoryProvider', diff --git a/openslides/motions/static/js/motions/projector.js b/openslides/motions/static/js/motions/projector.js index 2b7fb6df7..81bbb1de7 100644 --- a/openslides/motions/static/js/motions/projector.js +++ b/openslides/motions/static/js/motions/projector.js @@ -18,47 +18,14 @@ angular.module('OpenSlidesApp.motions.projector', [ .controller('SlideMotionCtrl', [ '$scope', - '$rootScope', - '$http', 'Motion', 'MotionChangeRecommendation', 'User', - 'Config', - 'Projector', - '$timeout', - 'ProjectorID', - function($scope, $rootScope, $http, Motion, MotionChangeRecommendation, User, Config, Projector, $timeout, ProjectorID) { + function($scope, Motion, MotionChangeRecommendation, User) { // Attention! Each object that is used here has to be dealt on server side. // Add it to the coresponding get_requirements method of the ProjectorElement // class. var id = $scope.element.id; - var thisProjector = Projector.get(ProjectorID()); - - $scope.line = $scope.element.highlightAndScroll; - $scope.scroll = function () { - // Prevent getting in an infinite loop by updating only if the value has changed. - // (if this check is removed this happends: controller loads --> call of $scope.scroll - // --> same line but scrollRequest --> projector updates --> controller loads --> ... ) - if ($scope.line !== $rootScope.motion_projector_line) { - // The same line number can occur twice in diff view; we scroll to the first one in this case - var scrollTop = null; - $(".line-number-" + $scope.line).each(function() { - var top = $(this).offset().top; - if (top > 0 && (scrollTop === null || top < scrollTop)) { - scrollTop = top; - } - }); - if (scrollTop) { - $rootScope.motion_projector_line = $scope.line; - var pos = scrollTop + thisProjector.scroll*80; - $http.post('/rest/core/projector/' + thisProjector.id + '/set_scroll/', Math.floor(pos/80.0) - 1); - } else if ($scope.line === 0) { - $rootScope.motion_projector_line = $scope.line; - $http.post('/rest/core/projector/' + thisProjector.id + '/set_scroll/', 0); - } - } - }; - $scope.mode = $scope.element.mode || 'original'; Motion.bindOne(id, $scope, 'motion'); diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 9fa12aca8..5208282d2 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -1102,22 +1102,6 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.amendments = Motion.filter({parent_id: motion.id}); $scope.highlight = 0; - $scope.linesForProjector = false; - // Set 0 for disable highlighting on projector - var setHighlightOnProjector = function (line) { - _.forEach(Projector.getAll(), function (projector) { - var elements = _.map(projector.elements, function(element) { return element; }); - elements.forEach(function (element) { - if (element.name == 'motions/motion' && element.id == motion.id) { - var data = {}; - data[element.uuid] = { - highlightAndScroll: line, - }; - $http.post('/rest/core/projector/' + projector.id + '/update_elements/', data); - } - }); - }); - }; $scope.scrollToAndHighlight = function (line) { $scope.highlight = line; @@ -1140,12 +1124,6 @@ angular.module('OpenSlidesApp.motions.site', [ $scope.highlight = 0; }, 2000); } - // set highlight and scroll on Projector - setHighlightOnProjector($scope.linesForProjector ? line : 0); - }; - $scope.toggleLinesForProjector = function () { - $scope.linesForProjector = !$scope.linesForProjector; - setHighlightOnProjector($scope.linesForProjector ? $scope.highlight : 0); }; // open edit dialog diff --git a/openslides/motions/static/templates/motions/motion-detail/toolbar.html b/openslides/motions/static/templates/motions/motion-detail/toolbar.html index fd7dabc0b..ef927e572 100644 --- a/openslides/motions/static/templates/motions/motion-detail/toolbar.html +++ b/openslides/motions/static/templates/motions/motion-detail/toolbar.html @@ -52,19 +52,12 @@ -
- - -
+