Merge pull request #3008 from FinnStutzenstein/Issue2636
Remove scrolling to a line on projector (closes #2636)
This commit is contained in:
commit
045c65de49
@ -15,15 +15,6 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
'OpenSlidesApp-templates',
|
'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([
|
.config([
|
||||||
'DSProvider',
|
'DSProvider',
|
||||||
'DSHttpAdapterProvider',
|
'DSHttpAdapterProvider',
|
||||||
|
@ -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([
|
.config([
|
||||||
'$stateProvider',
|
'$stateProvider',
|
||||||
'$urlMatcherFactoryProvider',
|
'$urlMatcherFactoryProvider',
|
||||||
|
@ -18,47 +18,14 @@ angular.module('OpenSlidesApp.motions.projector', [
|
|||||||
|
|
||||||
.controller('SlideMotionCtrl', [
|
.controller('SlideMotionCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'$rootScope',
|
|
||||||
'$http',
|
|
||||||
'Motion',
|
'Motion',
|
||||||
'MotionChangeRecommendation',
|
'MotionChangeRecommendation',
|
||||||
'User',
|
'User',
|
||||||
'Config',
|
function($scope, Motion, MotionChangeRecommendation, User) {
|
||||||
'Projector',
|
|
||||||
'$timeout',
|
|
||||||
'ProjectorID',
|
|
||||||
function($scope, $rootScope, $http, Motion, MotionChangeRecommendation, User, Config, Projector, $timeout, ProjectorID) {
|
|
||||||
// Attention! Each object that is used here has to be dealt on server side.
|
// 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
|
// Add it to the coresponding get_requirements method of the ProjectorElement
|
||||||
// class.
|
// class.
|
||||||
var id = $scope.element.id;
|
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';
|
$scope.mode = $scope.element.mode || 'original';
|
||||||
|
|
||||||
Motion.bindOne(id, $scope, 'motion');
|
Motion.bindOne(id, $scope, 'motion');
|
||||||
|
@ -1102,22 +1102,6 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
$scope.amendments = Motion.filter({parent_id: motion.id});
|
$scope.amendments = Motion.filter({parent_id: motion.id});
|
||||||
|
|
||||||
$scope.highlight = 0;
|
$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.scrollToAndHighlight = function (line) {
|
||||||
$scope.highlight = line;
|
$scope.highlight = line;
|
||||||
|
|
||||||
@ -1140,12 +1124,6 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
$scope.highlight = 0;
|
$scope.highlight = 0;
|
||||||
}, 2000);
|
}, 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
|
// open edit dialog
|
||||||
|
@ -52,19 +52,12 @@
|
|||||||
<span editable-text="gotoLinenumber" e-form="lineNumberForm"
|
<span editable-text="gotoLinenumber" e-form="lineNumberForm"
|
||||||
onaftersave="scrollToAndHighlight(gotoLinenumber)">
|
onaftersave="scrollToAndHighlight(gotoLinenumber)">
|
||||||
</span>
|
</span>
|
||||||
<div class="btn-group" ng-if="lineNumberMode != 'none'">
|
<button type="button" class="btn btn-sm btn-default"
|
||||||
<button type="button" class="btn btn-sm btn-default" ng-click="lineNumberForm.$show()">
|
ng-click="lineNumberForm.$show()"
|
||||||
<i class="fa fa-share"></i>
|
ng-if="lineNumberMode != 'none'">
|
||||||
<translate>go</translate>
|
<i class="fa fa-share"></i>
|
||||||
</button>
|
<translate>go</translate>
|
||||||
<button type="button" class="btn btn-sm btn-default" os-perms="core.can_manage_projector"
|
</button>
|
||||||
ng-if="lineNumberMode != 'none' && motion.isProjected().length"
|
|
||||||
ng-click="toggleLinesForProjector()"
|
|
||||||
uib-tooltip="{{ 'Show highlighted line also on projector.' | translate }}">
|
|
||||||
<i class="fa" ng-class="linesForProjector ? 'fa-check-square-o' : 'fa-square-o'"></i>
|
|
||||||
<i class="fa fa-video-camera"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user