2014-02-09 03:19:48 +00:00
|
|
|
define(function (require) {
|
2014-04-06 22:28:23 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
"use strict";
|
2014-04-06 22:28:23 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
var $ = require('jquery'),
|
|
|
|
_ = require('underscore'),
|
|
|
|
Backbone = require('backbone'),
|
|
|
|
Marionette = require('marionette'),
|
2014-04-04 08:20:13 +00:00
|
|
|
Mods = require('app/collections/mods'),
|
|
|
|
InfoView = require('app/views/servers/info'),
|
2014-04-08 20:59:59 +00:00
|
|
|
ModsListView = require('app/views/servers/mods/list'),
|
2014-04-06 22:28:23 +00:00
|
|
|
tpl = require('text!tpl/servers/view.html');
|
|
|
|
|
2014-04-04 08:20:13 +00:00
|
|
|
return Marionette.Layout.extend({
|
2014-02-09 03:19:48 +00:00
|
|
|
template: _.template(tpl),
|
2014-04-06 22:28:23 +00:00
|
|
|
|
2014-04-04 08:20:13 +00:00
|
|
|
regions: {
|
2014-04-08 20:59:59 +00:00
|
|
|
infoView: "#tab-info",
|
|
|
|
modsView: "#tab-mods",
|
2014-04-06 22:28:23 +00:00
|
|
|
settings: "#tab-settings"
|
2014-04-04 08:20:13 +00:00
|
|
|
},
|
2014-04-06 22:28:23 +00:00
|
|
|
|
|
|
|
events: {
|
|
|
|
"click .nav-tabs a" : "tabs",
|
|
|
|
},
|
|
|
|
|
2014-05-21 23:44:39 +00:00
|
|
|
modelEvents: {
|
|
|
|
"change": "serverUpdated",
|
|
|
|
},
|
|
|
|
|
2014-04-08 20:59:59 +00:00
|
|
|
initialize: function (options) {
|
|
|
|
this.mods = options.mods;
|
|
|
|
},
|
|
|
|
|
2014-04-04 08:20:13 +00:00
|
|
|
onRender: function() {
|
2014-04-08 20:59:59 +00:00
|
|
|
this.infoView.show(new InfoView({model: this.model}));
|
|
|
|
this.modsView.show(new ModsListView({collection: this.mods, server: this.model}));
|
2014-04-04 08:20:13 +00:00
|
|
|
},
|
2014-04-06 22:28:23 +00:00
|
|
|
|
2014-05-21 23:44:39 +00:00
|
|
|
serverUpdated: function() {
|
2014-06-04 22:19:54 +00:00
|
|
|
this.infoView.currentView.render();
|
2014-05-21 23:44:39 +00:00
|
|
|
this.modsView.currentView.render();
|
|
|
|
},
|
|
|
|
|
2014-04-06 22:28:23 +00:00
|
|
|
tabs: function(e) {
|
|
|
|
e.preventDefault()
|
|
|
|
$($(e.target).attr('href')).tab('show')
|
|
|
|
},
|
2014-02-09 03:19:48 +00:00
|
|
|
});
|
2014-04-06 22:28:23 +00:00
|
|
|
|
|
|
|
});
|