From efaa00483cc6179115d51683cb7eb9f40c46c95c Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Fri, 9 Dec 2016 13:10:09 +0100 Subject: [PATCH] Adding 'done' option in motion state filter --- openslides/motions/static/js/motions/site.js | 27 +++++++++++++++++++ .../static/templates/motions/motion-list.html | 21 ++++++++++++--- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index e62356258..d6dfe4374 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -825,6 +825,24 @@ angular.module('OpenSlidesApp.motions.site', [ }); }); + $scope.stateFilter = []; + var updateStateFilter = function () { + if (_.indexOf($scope.filter.multiselectFilters.state, -1) > -1) { // contains -1 + $scope.stateFilter = _.filter($scope.filter.multiselectFilters.state, function (id) { + return id >= 0; + }); // remove -1 + _.forEach($scope.states, function (state) { + if (!state.workflowHeader) { + if (state.getNextStates().length === 0) { // done state + $scope.stateFilter.push(state.id); + } + } + }); + } else { + $scope.stateFilter = _.clone($scope.filter.multiselectFilters.state); + } + }; + // Filtering $scope.filter = osTableFilter.createInstance('MotionTableFilter'); @@ -837,6 +855,7 @@ angular.module('OpenSlidesApp.motions.site', [ recommendation: [], }; } + updateStateFilter(); $scope.filter.propertyList = ['identifier', 'origin']; $scope.filter.propertyFunctionList = [ function (motion) {return motion.getTitle();}, @@ -864,6 +883,14 @@ angular.module('OpenSlidesApp.motions.site', [ tag: function (motion) {return motion.tags_id;}, recommendation: function (motion) {return motion.recommendation_id;}, }; + $scope.operateStateFilter = function (id, danger) { + $scope.filter.operateMultiselectFilter('state', id, danger); + updateStateFilter(); + }; + $scope.resetFilters = function () { + $scope.filter.reset(); + updateStateFilter(); + }; // Sorting $scope.sort = osTableSort.createInstance(); $scope.sort.column = 'identifier'; diff --git a/openslides/motions/static/templates/motions/motion-list.html b/openslides/motions/static/templates/motions/motion-list.html index 4bda569b7..5e1b407d8 100644 --- a/openslides/motions/static/templates/motions/motion-list.html +++ b/openslides/motions/static/templates/motions/motion-list.html @@ -104,7 +104,7 @@
- @@ -124,11 +124,18 @@ {{ state.headername | translate }} + ng-click="operateStateFilter(state.id, isSelectMode)"> {{ state.name | translate }} +
  • +
  • + + + Done + +
  • @@ -279,13 +286,19 @@ {{ state.name | translate }} + + + Done +