diff --git a/public/js/app/views/mods/index.js b/public/js/app/views/mods/index.js index b90e46f..ba7b338 100644 --- a/public/js/app/views/mods/index.js +++ b/public/js/app/views/mods/index.js @@ -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) { diff --git a/public/js/app/views/servers/mods/index.js b/public/js/app/views/servers/mods/index.js index 31c9571..6b4482d 100644 --- a/public/js/app/views/servers/mods/index.js +++ b/public/js/app/views/servers/mods/index.js @@ -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() } }) diff --git a/public/js/app/views/servers/view.js b/public/js/app/views/servers/view.js index ae6adb3..785a5e5 100644 --- a/public/js/app/views/servers/view.js +++ b/public/js/app/views/servers/view.js @@ -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()