Merge pull request #3700 from FinnStutzenstein/titleInMotionBlockSlide

Added a short title in the motion block slide
This commit is contained in:
Emanuel Schütze 2018-04-13 14:20:31 +02:00 committed by GitHub
commit 4a2410a596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 1 deletions

View File

@ -68,6 +68,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() }}