Merge pull request #2752 from FinnStutzenstein/MotionState
Adding 'done' option in motion state filter
This commit is contained in:
commit
43cdfd3836
@ -827,6 +827,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
|
// Filtering
|
||||||
$scope.filter = osTableFilter.createInstance('MotionTableFilter');
|
$scope.filter = osTableFilter.createInstance('MotionTableFilter');
|
||||||
|
|
||||||
@ -839,6 +857,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
recommendation: [],
|
recommendation: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
updateStateFilter();
|
||||||
$scope.filter.propertyList = ['identifier', 'origin'];
|
$scope.filter.propertyList = ['identifier', 'origin'];
|
||||||
$scope.filter.propertyFunctionList = [
|
$scope.filter.propertyFunctionList = [
|
||||||
function (motion) {return motion.getTitle();},
|
function (motion) {return motion.getTitle();},
|
||||||
@ -866,6 +885,14 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
tag: function (motion) {return motion.tags_id;},
|
tag: function (motion) {return motion.tags_id;},
|
||||||
recommendation: function (motion) {return motion.recommendation_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
|
// Sorting
|
||||||
$scope.sort = osTableSort.createInstance();
|
$scope.sort = osTableSort.createInstance();
|
||||||
$scope.sort.column = 'identifier';
|
$scope.sort.column = 'identifier';
|
||||||
|
@ -104,7 +104,7 @@
|
|||||||
<div class="col-xs-11 main-header">
|
<div class="col-xs-11 main-header">
|
||||||
<span class="form-inline text-right pull-right">
|
<span class="form-inline text-right pull-right">
|
||||||
<!-- clear all filters -->
|
<!-- clear all filters -->
|
||||||
<span class="sort-spacer pointer" ng-click="filter.reset()"
|
<span class="sort-spacer pointer" ng-click="resetFilters()"
|
||||||
ng-if="filter.areFiltersSet()" ng-disabled="isSelectMode"
|
ng-if="filter.areFiltersSet()" ng-disabled="isSelectMode"
|
||||||
ng-class="{'disabled': isSelectMode}">
|
ng-class="{'disabled': isSelectMode}">
|
||||||
<i class="fa fa-times-circle"></i>
|
<i class="fa fa-times-circle"></i>
|
||||||
@ -124,11 +124,18 @@
|
|||||||
{{ state.headername | translate }}
|
{{ state.headername | translate }}
|
||||||
</a>
|
</a>
|
||||||
<a href ng-if="!state.workflowHeader"
|
<a href ng-if="!state.workflowHeader"
|
||||||
ng-click="filter.operateMultiselectFilter('state', state.id, isSelectMode)">
|
ng-click="operateStateFilter(state.id, isSelectMode)">
|
||||||
<i class="fa fa-check" ng-if="filter.multiselectFilters.state.indexOf(state.id) > -1"></i>
|
<i class="fa fa-check" ng-if="filter.multiselectFilters.state.indexOf(state.id) > -1"></i>
|
||||||
{{ state.name | translate }}
|
{{ state.name | translate }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li>
|
||||||
|
<a href ng-click="operateStateFilter(-1, isSelectMode)">
|
||||||
|
<i class="fa fa-check" ng-if="filter.multiselectFilters.category.indexOf(-1) > -1"></i>
|
||||||
|
<translate>Done</translate>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</span>
|
||||||
<!-- Category filter -->
|
<!-- Category filter -->
|
||||||
@ -279,13 +286,19 @@
|
|||||||
<!-- state -->
|
<!-- state -->
|
||||||
<span ng-repeat="state in states" class="pointer spacer-left-lg"
|
<span ng-repeat="state in states" class="pointer spacer-left-lg"
|
||||||
ng-if="!state.workflowHeader && filter.multiselectFilters.state.indexOf(state.id) > -1"
|
ng-if="!state.workflowHeader && filter.multiselectFilters.state.indexOf(state.id) > -1"
|
||||||
ng-click="filter.operateMultiselectFilter('state', state.id, isSelectMode)"
|
ng-click="operateStateFilter(state.id, isSelectMode)"
|
||||||
ng-class="{'disabled': isSelectMode}">
|
ng-class="{'disabled': isSelectMode}">
|
||||||
<span class="nobr">
|
<span class="nobr">
|
||||||
<i class="fa fa-times-circle"></i>
|
<i class="fa fa-times-circle"></i>
|
||||||
{{ state.name | translate }}
|
{{ state.name | translate }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<span ng-if="filter.multiselectFilters.state.indexOf(-1) > -1" class="pointer spacer-left-lg"
|
||||||
|
ng-click="operateStateFilter(-1, isSelectMode)"
|
||||||
|
ng-class="{'disabled': isSelectMode}">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
<translate>Done</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"
|
||||||
@ -354,7 +367,7 @@
|
|||||||
ng-class="{'projected': motion.isProjected().length}"
|
ng-class="{'projected': motion.isProjected().length}"
|
||||||
ng-repeat="motion in motionsFiltered = (motions
|
ng-repeat="motion in motionsFiltered = (motions
|
||||||
| osFilter: filter.filterString : filter.getObjectQueryString
|
| osFilter: filter.filterString : filter.getObjectQueryString
|
||||||
| MultiselectFilter: filter.multiselectFilters.state : getItemId.state
|
| MultiselectFilter: stateFilter : getItemId.state
|
||||||
| MultiselectFilter: filter.multiselectFilters.category : getItemId.category
|
| MultiselectFilter: filter.multiselectFilters.category : getItemId.category
|
||||||
| MultiselectFilter: filter.multiselectFilters.motionBlock : getItemId.motionBlock
|
| MultiselectFilter: filter.multiselectFilters.motionBlock : getItemId.motionBlock
|
||||||
| MultiselectFilter: filter.multiselectFilters.recommendation : getItemId.recommendation
|
| MultiselectFilter: filter.multiselectFilters.recommendation : getItemId.recommendation
|
||||||
|
Loading…
Reference in New Issue
Block a user