Merge pull request #229 from Dahlgren/bugfix/save-server-mods

Fix save server mods
This commit is contained in:
Björn Dahlgren 2022-09-05 00:09:36 +02:00 committed by GitHub
commit 27df1c9713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 8 deletions

View File

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

View File

@ -9,11 +9,24 @@ var template = _.template(tpl)
module.exports = ModsView.extend({ module.exports = ModsView.extend({
template: template, template: template,
onRender: function () { modelEvents: {
this.listView.show(new ListView({ change: 'serverUpdated'
},
initialize: function (options) {
ModsView.prototype.initialize.call(this, options)
this.modsListView = new ListView({
collection: this.options.mods, collection: this.options.mods,
server: this.options.server, server: this.options.server,
filterValue: this.filterValue 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 () { onRender: function () {
this.infoView.show(new InfoView({ model: this.model })) this.infoView.show(new InfoView({ model: this.model }))
this.missionsView.show(new MissionsView({ missions: this.missions, 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.parametersView.show(new ParametersListView({ model: this.model }))
this.playersView.show(new PlayersView({ model: this.model })) this.playersView.show(new PlayersView({ model: this.model }))
this.settingsView.show(new FormView({ model: this.model })) this.settingsView.show(new FormView({ model: this.model }))
@ -49,7 +49,6 @@ module.exports = Marionette.LayoutView.extend({
serverUpdated: function () { serverUpdated: function () {
this.infoView.currentView.render() this.infoView.currentView.render()
this.modsView.currentView.render()
this.parametersView.currentView.render() this.parametersView.currentView.render()
this.playersView.currentView.render() this.playersView.currentView.render()
this.settingsView.currentView.render() this.settingsView.currentView.render()