Added shortened motion title to motion block slide.

This commit is contained in:
FinnStutzenstein 2018-04-11 13:09:11 +02:00 committed by Emanuel Schütze
parent 2497969864
commit 595bcab845
3 changed files with 30 additions and 1 deletions

View File

@ -66,6 +66,7 @@ Motions:
- Save pagination sate to session storage [#3569].
- Split up 'can_see_and_manage_comments' permission in two seperate
ones [#3565].
- Added (shortened) motion title to motion block slide [#3700].
Elections:
- Added pagination for list view [#3393].

View File

@ -26,6 +26,33 @@ angular.module('OpenSlidesApp.motions.motionBlockProjector', [])
// class.
var id = $scope.element.id;
MotionBlock.bindOne(id, $scope, 'motionBlock');
// Returns a shortened motion title. If the title is longer then maxLength, it is
// split at the last whitespace that is in maxLength. Three dots are added then.
$scope.getShortTitle = function (motion) {
var maxLength = 40;
var title = motion.getTitle();
if (title.length <= maxLength) {
return title;
}
// Find last whitespace that is before maxLength. Split the title
// there and append dots.
var whitespaceIndex = -1;
for (var i = 0; i < maxLength+1; i++) {
if (title[i] === ' ') {
whitespaceIndex = i;
}
}
if (whitespaceIndex === -1) {
// just one long word.. split it :/
return title.substr(0, maxLength) + '...';
} else {
return title.substr(0, whitespaceIndex) + '...';
}
};
}
]);

View File

@ -8,7 +8,8 @@
<!-- motion list -->
<div class="motion-block zoomcontent">
<div ng-repeat="motion in motionBlock.motions">
{{ motion.identifier }}
{{ motion.identifier }}:
{{ getShortTitle(motion) }}
<br>
<span class="label" ng-class="'label-'+motion.recommendation.css_class">
{{ motion.getRecommendationName() }}