Merge pull request #3372 from FinnStutzenstein/Issue3365
Multiselect filter for motion comments, filter and sorting fixes (fixes #3365, fixes #3367)
This commit is contained in:
commit
97a1431c32
@ -37,6 +37,7 @@ Motions:
|
||||
- Bugfix: Several bugfixes regarding splitting list items in
|
||||
change recommendations [#3288]
|
||||
- Added inline Editing for motion reason [#3361].
|
||||
- Added multiselect filter for motion comments [#3372].
|
||||
|
||||
Users:
|
||||
- User without permission to see users can now see agenda item speakers,
|
||||
|
@ -898,13 +898,24 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
// always order by identifier (after custom ordering)
|
||||
$scope.motions = _.orderBy(Motion.getAll(), ['identifier']);
|
||||
_.forEach($scope.motions, function (motion) {
|
||||
MotionComment.populateFields(motion);
|
||||
motion.personalNote = PersonalNoteManager.getNote(motion);
|
||||
// For filtering, we cannot filter for .personalNote.star
|
||||
motion.star = motion.personalNote ? motion.personalNote.star : false;
|
||||
if (motion.star === undefined) {
|
||||
motion.star = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
$scope.alert = {};
|
||||
|
||||
// Motion comments
|
||||
$scope.commentsFields = Config.get('motions_comments').value;
|
||||
$scope.commentsFieldsNoSpecialComments = _.filter($scope.commentsFields, function (field) {
|
||||
var specialComment = field.forState || field.forRecommendation;
|
||||
return !specialComment;
|
||||
});
|
||||
|
||||
// collect all states and all recommendations of all workflows
|
||||
$scope.states = [];
|
||||
$scope.recommendations = [];
|
||||
@ -952,6 +963,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
motionBlock: [],
|
||||
tag: [],
|
||||
recommendation: [],
|
||||
comment: [],
|
||||
};
|
||||
$scope.filter.booleanFilters = {
|
||||
isFavorite: {
|
||||
@ -971,6 +983,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
function (motion) {return motion.category ? motion.category.name : '';},
|
||||
function (motion) {return motion.motionBlock ? motion.motionBlock.name : '';},
|
||||
function (motion) {return motion.recommendation ? motion.getRecommendationName() : '';},
|
||||
function (motion) {return motion.comments.join(' ');},
|
||||
];
|
||||
$scope.filter.propertyDict = {
|
||||
'submitters': function (submitter) {
|
||||
@ -985,6 +998,18 @@ 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;
|
||||
}
|
||||
);
|
||||
},
|
||||
category: function (motion) {return motion.category_id;},
|
||||
motionBlock: function (motion) {return motion.motion_block_id;},
|
||||
tag: function (motion) {return motion.tags_id;},
|
||||
@ -1006,7 +1031,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
display_name: gettext('Identifier')},
|
||||
{name: 'getTitle()',
|
||||
display_name: gettext('Title')},
|
||||
{name: 'submitters',
|
||||
{name: 'submitters[0].get_short_name()',
|
||||
display_name: gettext('Submitters')},
|
||||
{name: 'category.name',
|
||||
display_name: gettext('Category')},
|
||||
@ -1095,9 +1120,6 @@ angular.module('OpenSlidesApp.motions.site', [
|
||||
|
||||
// open new/edit dialog
|
||||
$scope.openDialog = function (motion) {
|
||||
if (motion) {
|
||||
MotionComment.populateFields(motion);
|
||||
}
|
||||
ngDialog.open(MotionForm.getDialog(motion));
|
||||
};
|
||||
// Export dialog
|
||||
|
@ -168,6 +168,32 @@
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
<!-- Comment filter -->
|
||||
<span os-perms="motions.can_see_and_manage_comments">
|
||||
<span uib-dropdown ng-if="commentsFieldsNoSpecialComments.length > 0">
|
||||
<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 commentsFieldsNoSpecialComments">
|
||||
<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>
|
||||
</span>
|
||||
<!-- recommendation filter -->
|
||||
<span uib-dropdown ng-if="config('motions_recommendations_by') != ''">
|
||||
<span class="pointer" id="dropdownRecommendation" uib-dropdown-toggle
|
||||
@ -353,6 +379,22 @@
|
||||
<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"
|
||||
@ -434,6 +476,7 @@
|
||||
ng-repeat="motion in motionsFiltered = (motions
|
||||
| osFilter: filter.filterString : filter.getObjectQueryString
|
||||
| MultiselectFilter: stateFilter : getItemId.state
|
||||
| MultiselectFilter: filter.multiselectFilters.comment : getItemId.comment
|
||||
| MultiselectFilter: filter.multiselectFilters.category : getItemId.category
|
||||
| MultiselectFilter: filter.multiselectFilters.motionBlock : getItemId.motionBlock
|
||||
| MultiselectFilter: filter.multiselectFilters.recommendation : getItemId.recommendation
|
||||
|
Loading…
Reference in New Issue
Block a user