Merge pull request #1803 from ostcar/os_filter
Add osFilter that filters for an explicit text
This commit is contained in:
commit
193d318bc9
@ -267,6 +267,20 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
.filter('osFilter', [
|
||||||
|
'$filter',
|
||||||
|
function ($filter) {
|
||||||
|
return function (array, string, getFilterString) {
|
||||||
|
if (!string) {
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
return Array.prototype.filter.call(array, function (item) {
|
||||||
|
return getFilterString(item).toLowerCase().indexOf(string.toLowerCase()) > -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
/* Options for CKEditor used in various create and edit views. */
|
/* Options for CKEditor used in various create and edit views. */
|
||||||
.value('CKEditorOptions', {
|
.value('CKEditorOptions', {
|
||||||
allowedContent:
|
allowedContent:
|
||||||
|
@ -290,6 +290,18 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
|
|||||||
}
|
}
|
||||||
$scope.sortColumn = column;
|
$scope.sortColumn = column;
|
||||||
};
|
};
|
||||||
|
$scope.getFilterString = function (motion) {
|
||||||
|
if (motion.category) {
|
||||||
|
var category = motion.category.name;
|
||||||
|
} else {
|
||||||
|
var category = ''
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
motion.getTitle(),
|
||||||
|
motion.getText(),
|
||||||
|
_.map(motion.submitters, function (submitter) {return submitter.get_short_name()}).join(" "),
|
||||||
|
category].join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
// collect all states of all workflows
|
// collect all states of all workflows
|
||||||
// TODO: regard workflows only which are used by motions
|
// TODO: regard workflows only which are used by motions
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
ng-class="reverse ? 'fa-sort-desc' : 'fa-sort-asc'">
|
||||||
</i>
|
</i>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="motion in motions | filter: filter.search | filter: {state_id: stateFilter} |
|
<tr ng-repeat="motion in motions | osFilter: filter.search : getFilterString | filter: {state_id: stateFilter} |
|
||||||
orderBy: sortColumn:reverse"
|
orderBy: sortColumn:reverse"
|
||||||
class="animate-item"
|
class="animate-item"
|
||||||
ng-class="{ 'activeline': motion.isProjected(), 'selected': motion.selected }">
|
ng-class="{ 'activeline': motion.isProjected(), 'selected': motion.selected }">
|
||||||
|
Loading…
Reference in New Issue
Block a user