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

56 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-10-07 09:45:03 +00:00
var $ = require('jquery')
var _ = require('underscore')
var Marionette = require('marionette')
var ListView = require('app/views/mods/list')
var tpl = require('tpl/mods/index.html')
var template = _.template(tpl)
module.exports = Marionette.LayoutView.extend({
template: template,
templateHelpers: function () {
return {
filterValue: this.filterValue
}
},
regions: {
listView: '#list'
},
events: {
'click #refresh': 'refresh',
'keyup #filterMods': 'updateFilter'
},
initialize: function () {
this.filterValue = ''
2022-09-04 21:49:04 +00:00
this.modsListView = new ListView({ collection: this.options.mods, filterValue: this.filterValue })
2021-10-07 09:45:03 +00:00
},
updateFilter: function (event) {
this.filterValue = event.target.value
2022-09-04 21:49:04 +00:00
this.modsListView.filterValue = this.filterValue
this.modsListView.render()
2021-10-07 09:45:03 +00:00
},
onRender: function () {
2022-09-04 21:49:04 +00:00
this.listView.show(this.modsListView)
2021-10-07 09:45:03 +00:00
},
refresh: function (event) {
event.preventDefault()
$.ajax({
url: '/api/mods/refresh',
type: 'POST',
success: function (resp) {
},
error: function (resp) {
}
})
}
})