diff --git a/CHANGELOG b/CHANGELOG index d4ba68a52..d6a1ec7e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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, diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index dfe3af164..010408702 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -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,20 +983,33 @@ 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) { + 'submitters': function (submitter) { return submitter.get_short_name(); }, - 'supporters' : function (supporter) { + 'supporters': function (supporter) { return supporter.get_short_name(); }, - 'tags' : function (tag) { + 'tags': function (tag) { return tag.name; }, }; $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 diff --git a/openslides/motions/static/templates/motions/motion-list.html b/openslides/motions/static/templates/motions/motion-list.html index 386f4c0e6..ebcf7dd16 100644 --- a/openslides/motions/static/templates/motions/motion-list.html +++ b/openslides/motions/static/templates/motions/motion-list.html @@ -168,6 +168,32 @@ + + + + + Comment + + + + + done + + + + + {{ commentsField.name | translate }} + + + + + No comments set +