Add searching ACL's by token

This commit is contained in:
John Cowen 2018-06-13 14:39:43 +01:00
parent 853a40b256
commit bf30902812
2 changed files with 7 additions and 3 deletions

View file

@ -28,10 +28,14 @@ export default Controller.extend(WithFiltering, {
});
}),
filter: function(item, { s = '', type = '' }) {
const sLower = s.toLowerCase();
return (
get(item, 'Name')
(get(item, 'Name')
.toLowerCase()
.indexOf(s.toLowerCase()) !== -1 &&
.indexOf(sLower) !== -1 ||
get(item, 'ID')
.toLowerCase()
.indexOf(sLower) !== -1) &&
(type === '' || get(item, 'Type') === type)
);
},

View file

@ -1,4 +1,4 @@
{{!<form>}}
{{freetext-filter onchange=(action onchange) value=search placeholder="Search by name"}}
{{freetext-filter onchange=(action onchange) value=search placeholder="Search by name/token"}}
{{radio-group name="type" value=type items=filters onchange=(action onchange)}}
{{!</form>}}