2016-04-18 10:33:30 +02:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular
|
2016-04-19 11:58:07 +02:00
|
|
|
.module('harbor.details')
|
2016-05-12 12:30:01 +02:00
|
|
|
.filter('name', nameFilter);
|
|
|
|
|
2016-04-26 12:23:34 +02:00
|
|
|
function nameFilter() {
|
|
|
|
|
|
|
|
return filter;
|
|
|
|
|
|
|
|
function filter(input, filterInput, key) {
|
2016-05-03 12:29:58 +02:00
|
|
|
input = input || [];
|
2016-04-26 12:23:34 +02:00
|
|
|
var filteredResults = [];
|
|
|
|
|
2016-05-23 12:29:17 +02:00
|
|
|
if (filterInput !== '') {
|
2016-04-26 12:23:34 +02:00
|
|
|
for(var i = 0; i < input.length; i++) {
|
|
|
|
var item = input[i];
|
2016-05-23 12:29:17 +02:00
|
|
|
if((key === "" && item.indexOf(filterInput) >= 0) || (key !== "" && item[key].indexOf(filterInput) >= 0)) {
|
2016-04-26 12:23:34 +02:00
|
|
|
filteredResults.push(item);
|
|
|
|
continue;
|
2016-05-03 12:29:58 +02:00
|
|
|
}
|
2016-04-26 12:23:34 +02:00
|
|
|
}
|
|
|
|
input = filteredResults;
|
|
|
|
}
|
|
|
|
return input;
|
|
|
|
}
|
|
|
|
}
|
2016-05-12 12:30:01 +02:00
|
|
|
|
2016-04-28 19:36:39 +02:00
|
|
|
|
2016-04-18 10:33:30 +02:00
|
|
|
})();
|