Move comments filter behind motion block filter

This commit is contained in:
FinnStutzenstein 2017-10-13 07:44:00 +02:00
parent 3c9ae628e8
commit 5b9933e930
2 changed files with 46 additions and 49 deletions

View File

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

View File

@ -168,30 +168,6 @@
</li> </li>
</ul> </ul>
</span> </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 --> <!-- recommendation filter -->
<span uib-dropdown ng-if="config('motions_recommendations_by') != ''"> <span uib-dropdown ng-if="config('motions_recommendations_by') != ''">
<span class="pointer" id="dropdownRecommendation" uib-dropdown-toggle <span class="pointer" id="dropdownRecommendation" uib-dropdown-toggle
@ -268,6 +244,30 @@
</li> </li>
</ul> </ul>
</span> </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 --> <!-- Tag filter -->
<span uib-dropdown ng-if="tags.length > 0"> <span uib-dropdown ng-if="tags.length > 0">
<span class="pointer" id="dropdownTag" uib-dropdown-toggle <span class="pointer" id="dropdownTag" uib-dropdown-toggle
@ -390,22 +390,6 @@
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
<translate>done</translate> <translate>done</translate>
</span> </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 --> <!-- category -->
<span ng-repeat="category in categories" class="pointer spacer-left-lg" <span ng-repeat="category in categories" class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1" ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1"
@ -432,6 +416,22 @@
{{ motionBlock.title }} {{ motionBlock.title }}
</span> </span>
</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 --> <!-- recommendation -->
<span ng-repeat="recommendation in recommendations" class="pointer spacer-left-lg" <span ng-repeat="recommendation in recommendations" class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.recommendation.indexOf(recommendation.id) > -1" ng-if="filter.multiselectFilters.recommendation.indexOf(recommendation.id) > -1"