arma-server-web-admin/public/js/app/views/mods/list.js

38 lines
978 B
JavaScript
Raw Normal View History

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
},
2021-10-07 09:45:03 +00:00
filter: function (child, index, collection) {
var name = child.get('name').toLowerCase()
2021-10-07 09:45:03 +00:00
if (name.indexOf(this.filterValue.toLowerCase()) >= 0) {
return true
}
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
}
})