Merge pull request #3441 from FinnStutzenstein/CommentsFilterMove

Move comments filter behind motion block filter
This commit is contained in:
Emanuel Schütze 2017-10-13 23:38:45 +02:00 committed by GitHub
commit 721064700a
2 changed files with 46 additions and 49 deletions

View File

@ -1003,16 +1003,13 @@ angular.module('OpenSlidesApp.motions.site', [
$scope.getItemId = {
state: function (motion) {return motion.state_id;},
comment: function (motion) {
// Map all populated fields to their names
return _.map(
// Returns all fields that are populated
_.filter($scope.commentsFieldsNoSpecialComments, function (field) {
return motion['comment ' + field.name];
}),
function (field) {
return field.name;
var ids = [];
_.forEach(motion.comments, function (comment, id) {
if (comment) {
ids.push(id);
}
);
});
return ids;
},
category: function (motion) {return motion.category_id;},
motionBlock: function (motion) {return motion.motion_block_id;},

View File

@ -168,30 +168,6 @@
</li>
</ul>
</span>
<!-- Comment filter -->
<span uib-dropdown ng-if="showCommentsFilter()">
<span class="pointer" id="dropdownComment" uib-dropdown-toggle
ng-class="{'bold': filter.multiselectFilters.comment.length > 0, 'disabled': isSelectMode}"
ng-disabled="isSelectMode">
<translate>Comment</translate>
<span class="caret"></span>
</span>
<ul class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownComment">
<li ng-repeat="commentsField in noSpecialCommentsFields">
<a href ng-click="filter.operateMultiselectFilter('comment', commentsField.name, isSelectMode)">
<i class="fa fa-check" ng-if="filter.multiselectFilters.comment.indexOf(commentsField.name) > -1"></i>
{{ commentsField.name }} <translate>is set</translate>
</a>
</li>
<li class="divider"></li>
<li>
<a href ng-click="filter.operateMultiselectFilter('comment', -1, isSelectMode)">
<i class="fa fa-check" ng-if="filter.multiselectFilters.comment.indexOf(-1) > -1"></i>
<translate>No comments set</translate>
</a>
</li>
</ul>
</span>
<!-- recommendation filter -->
<span uib-dropdown ng-if="config('motions_recommendations_by') != ''">
<span class="pointer" id="dropdownRecommendation" uib-dropdown-toggle
@ -268,6 +244,30 @@
</li>
</ul>
</span>
<!-- Comment filter -->
<span uib-dropdown ng-if="showCommentsFilter()">
<span class="pointer" id="dropdownComment" uib-dropdown-toggle
ng-class="{'bold': filter.multiselectFilters.comment.length > 0, 'disabled': isSelectMode}"
ng-disabled="isSelectMode">
<translate>Comment</translate>
<span class="caret"></span>
</span>
<ul class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownComment">
<li ng-repeat="(index, commentsField) in noSpecialCommentsFields">
<a href ng-click="filter.operateMultiselectFilter('comment', index, isSelectMode)">
<i class="fa fa-check" ng-if="filter.multiselectFilters.comment.indexOf(index) > -1"></i>
{{ commentsField.name }} <translate>is set</translate>
</a>
</li>
<li class="divider"></li>
<li>
<a href ng-click="filter.operateMultiselectFilter('comment', -1, isSelectMode)">
<i class="fa fa-check" ng-if="filter.multiselectFilters.comment.indexOf(-1) > -1"></i>
<translate>No comments set</translate>
</a>
</li>
</ul>
</span>
<!-- Tag filter -->
<span uib-dropdown ng-if="tags.length > 0">
<span class="pointer" id="dropdownTag" uib-dropdown-toggle
@ -390,22 +390,6 @@
<i class="fa fa-times-circle"></i>
<translate>done</translate>
</span>
<!-- comment -->
<span ng-repeat="commentsField in commentsFields" class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.comment.indexOf(commentsField.name) > -1"
ng-click="filter.operateMultiselectFilter('comment', commentsField.name, isSelectMode)"
ng-class="{'disabled': isSelectMode}">
<span class="nobr">
<i class="fa fa-times-circle"></i>
{{ commentsField.name | translate }}
</span>
</span>
<span ng-if="filter.multiselectFilters.comment.indexOf(-1) > -1" class="pointer spacer-left-lg"
ng-click="filter.operateMultiselectFilter('comment', -1, isSelectMode)"
ng-class="{'disabled': isSelectMode}">
<i class="fa fa-times-circle"></i>
<translate>No comments set</translate>
</span>
<!-- category -->
<span ng-repeat="category in categories" class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1"
@ -432,6 +416,22 @@
{{ motionBlock.title }}
</span>
</span>
<!-- comment -->
<span ng-repeat="(index, commentsField) in noSpecialCommentsFields" class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.comment.indexOf(index) > -1"
ng-click="filter.operateMultiselectFilter('comment', index, isSelectMode)"
ng-class="{'disabled': isSelectMode}">
<span class="nobr">
<i class="fa fa-times-circle"></i>
{{ commentsField.name }}
</span>
</span>
<span ng-if="filter.multiselectFilters.comment.indexOf(-1) > -1" class="pointer spacer-left-lg"
ng-click="filter.operateMultiselectFilter('comment', -1, isSelectMode)"
ng-class="{'disabled': isSelectMode}">
<i class="fa fa-times-circle"></i>
<translate>No comments set</translate>
</span>
<!-- recommendation -->
<span ng-repeat="recommendation in recommendations" class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.recommendation.indexOf(recommendation.id) > -1"