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]. - Save pagination sate to session storage [#3569].
- Split up 'can_see_and_manage_comments' permission in two seperate - Split up 'can_see_and_manage_comments' permission in two seperate
ones [#3565]. ones [#3565].
- Added (shortened) motion title to motion block slide [#3700].
Elections: Elections:
- Added pagination for list view [#3393]. - Added pagination for list view [#3393].

View File

@ -26,6 +26,33 @@ angular.module('OpenSlidesApp.motions.motionBlockProjector', [])
// class. // class.
var id = $scope.element.id; var id = $scope.element.id;
MotionBlock.bindOne(id, $scope, 'motionBlock'); 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 --> <!-- motion list -->
<div class="motion-block zoomcontent"> <div class="motion-block zoomcontent">
<div ng-repeat="motion in motionBlock.motions"> <div ng-repeat="motion in motionBlock.motions">
{{ motion.identifier }} {{ motion.identifier }}:
{{ getShortTitle(motion) }}
<br> <br>
<span class="label" ng-class="'label-'+motion.recommendation.css_class"> <span class="label" ng-class="'label-'+motion.recommendation.css_class">
{{ motion.getRecommendationName() }} {{ motion.getRecommendationName() }}