Fix save server mods

This commit is contained in:
Björn Dahlgren 2022-09-04 23:49:04 +02:00
parent ec0a0319f0
commit b7ce00f096
3 changed files with 21 additions and 8 deletions

View File

@ -26,16 +26,17 @@ module.exports = Marionette.LayoutView.extend({
initialize: function () {
this.filterValue = ''
this.modsListView = new ListView({ collection: this.options.mods, filterValue: this.filterValue })
},
updateFilter: function (event) {
this.filterValue = event.target.value
this.listView.currentView.filterValue = this.filterValue
this.listView.currentView.render()
this.modsListView.filterValue = this.filterValue
this.modsListView.render()
},
onRender: function () {
this.listView.show(new ListView({ collection: this.options.mods, filterValue: this.filterValue }))
this.listView.show(this.modsListView)
},
refresh: function (event) {

View File

@ -9,11 +9,24 @@ var template = _.template(tpl)
module.exports = ModsView.extend({
template: template,
onRender: function () {
this.listView.show(new ListView({
modelEvents: {
change: 'serverUpdated'
},
initialize: function (options) {
ModsView.prototype.initialize.call(this, options)
this.modsListView = new ListView({
collection: this.options.mods,
server: this.options.server,
filterValue: this.filterValue
}))
})
},
serverUpdated: function () {
this.modsListView.render()
},
serialize: function () {
return this.modsListView.serialize()
}
})

View File

@ -41,7 +41,7 @@ module.exports = Marionette.LayoutView.extend({
onRender: function () {
this.infoView.show(new InfoView({ model: this.model }))
this.missionsView.show(new MissionsView({ missions: this.missions, model: this.model }))
this.modsView.show(new ModsView({ mods: this.mods, server: this.model }))
this.modsView.show(new ModsView({ model: this.model, mods: this.mods, server: this.model }))
this.parametersView.show(new ParametersListView({ model: this.model }))
this.playersView.show(new PlayersView({ model: this.model }))
this.settingsView.show(new FormView({ model: this.model }))
@ -49,7 +49,6 @@ module.exports = Marionette.LayoutView.extend({
serverUpdated: function () {
this.infoView.currentView.render()
this.modsView.currentView.render()
this.parametersView.currentView.render()
this.playersView.currentView.render()
this.settingsView.currentView.render()