2019-09-22 21:02:31 +00:00
|
|
|
var _ = require('underscore')
|
|
|
|
var Marionette = require('marionette')
|
|
|
|
|
|
|
|
var ListItemView = require('app/views/mods/list_item')
|
|
|
|
var tpl = require('tpl/mods/list.html')
|
|
|
|
|
|
|
|
var template = _.template(tpl)
|
|
|
|
|
|
|
|
module.exports = Marionette.CompositeView.extend({
|
|
|
|
childView: ListItemView,
|
|
|
|
childViewContainer: 'tbody',
|
|
|
|
template: template,
|
|
|
|
|
2021-10-07 09:45:03 +00:00
|
|
|
initialize: function (options) {
|
|
|
|
this.filterValue = options.filterValue
|
2019-09-22 21:02:31 +00:00
|
|
|
},
|
|
|
|
|
2021-10-07 09:45:03 +00:00
|
|
|
filter: function (child, index, collection) {
|
|
|
|
var name = child.get('name').toLowerCase()
|
2019-09-22 21:02:31 +00:00
|
|
|
|
2021-10-07 09:45:03 +00:00
|
|
|
if (name.indexOf(this.filterValue.toLowerCase()) >= 0) {
|
|
|
|
return true
|
|
|
|
}
|
2019-09-22 21:02:31 +00:00
|
|
|
|
2021-10-07 09:45:03 +00:00
|
|
|
var modFile = child.get('modFile')
|
|
|
|
if (modFile && modFile.name && modFile.name.toLowerCase().indexOf(this.filterValue.toLowerCase()) >= 0) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
var steamMeta = child.get('steamMeta')
|
|
|
|
if (steamMeta && steamMeta.name && steamMeta.name.toLowerCase().indexOf(this.filterValue.toLowerCase()) >= 0) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
2019-09-22 21:02:31 +00:00
|
|
|
}
|
|
|
|
})
|