2014-02-09 03:19:48 +00:00
|
|
|
define(function (require) {
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
"use strict";
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
var $ = require('jquery'),
|
|
|
|
_ = require('underscore'),
|
|
|
|
Backbone = require('backbone'),
|
|
|
|
Marionette = require('marionette'),
|
|
|
|
BootstrapModal = require('backbone.bootstrap-modal'),
|
2014-04-08 21:06:35 +00:00
|
|
|
ServersListView = require('app/views/navigation/servers/list'),
|
2017-10-05 22:01:55 +00:00
|
|
|
SettingsView = require('app/views/settings'),
|
2014-02-09 03:19:48 +00:00
|
|
|
tpl = require('text!tpl/navigation.html');
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
return Marionette.ItemView.extend({
|
|
|
|
template: _.template(tpl),
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2019-07-29 15:10:46 +00:00
|
|
|
templateHelpers: function() {
|
|
|
|
return {
|
|
|
|
isActiveRoute: function (route) {
|
|
|
|
return Backbone.history.fragment === route ? 'active' : ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
events: {
|
|
|
|
"click #settings": "settings"
|
|
|
|
},
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
initialize: function (options) {
|
2017-10-05 20:55:57 +00:00
|
|
|
this.settings = options.settings;
|
2014-02-09 03:19:48 +00:00
|
|
|
this.servers = options.servers;
|
|
|
|
this.serversListView = new ServersListView({ collection: this.servers })
|
2019-07-29 15:10:46 +00:00
|
|
|
Backbone.history.on('route', this.render);
|
2014-02-09 03:19:48 +00:00
|
|
|
},
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
onDomRefresh: function () {
|
|
|
|
this.serversListView.setElement('#servers-list');
|
|
|
|
this.serversListView.render();
|
|
|
|
},
|
2014-04-08 21:06:35 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
settings: function (event) {
|
|
|
|
event.preventDefault();
|
2017-10-05 20:55:57 +00:00
|
|
|
var view = new SettingsView({ model: this.settings });
|
2015-04-03 10:16:19 +00:00
|
|
|
new Backbone.BootstrapModal({ content: view, animate: true, cancelText: false }).open();
|
2014-02-09 03:19:48 +00:00
|
|
|
}
|
|
|
|
});
|
2014-04-08 21:06:35 +00:00
|
|
|
|
|
|
|
});
|