2014-02-09 03:19:48 +00:00
|
|
|
define(function (require) {
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
"use strict";
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
var $ = require('jquery'),
|
|
|
|
Backbone = require('backbone'),
|
|
|
|
LayoutView = require('app/views/layout'),
|
|
|
|
NavigationView = require('app/views/navigation'),
|
|
|
|
HomeView = require('app/views/home'),
|
2014-04-04 09:28:33 +00:00
|
|
|
MissionsListView= require('app/views/missions/list'),
|
2014-02-09 03:19:48 +00:00
|
|
|
ModsListView = require('app/views/mods/list'),
|
|
|
|
ServerView = require('app/views/servers/view'),
|
2014-04-04 09:28:33 +00:00
|
|
|
Missions = require('app/collections/missions'),
|
2014-02-09 03:19:48 +00:00
|
|
|
Mods = require('app/collections/mods'),
|
|
|
|
Servers = require('app/collections/servers'),
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
$body = $('body'),
|
2014-04-04 09:28:33 +00:00
|
|
|
missions = new Missions(),
|
2014-02-09 03:19:48 +00:00
|
|
|
mods = new Mods(),
|
|
|
|
servers = new Servers(),
|
|
|
|
layoutView = new LayoutView({el: $body}).render(),
|
|
|
|
navigationView = new NavigationView({servers: servers}),
|
|
|
|
homeView = new HomeView({servers: servers}),
|
2014-04-04 09:28:33 +00:00
|
|
|
missionsListView = new MissionsListView({collection: missions}),
|
2014-02-09 03:19:48 +00:00
|
|
|
modsListView = new ModsListView({collection: mods});
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
return Backbone.Router.extend({
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
routes: {
|
2014-04-04 09:28:33 +00:00
|
|
|
"missions": "missions",
|
2014-02-09 03:19:48 +00:00
|
|
|
"mods": "mods",
|
|
|
|
"servers/:id": "server",
|
|
|
|
"": "home",
|
|
|
|
},
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
initialize: function () {
|
|
|
|
layoutView.navigation.show(navigationView);
|
2014-04-04 09:28:33 +00:00
|
|
|
missions.fetch();
|
2014-02-09 03:19:48 +00:00
|
|
|
mods.fetch();
|
|
|
|
servers.fetch();
|
|
|
|
},
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
home: function () {
|
|
|
|
layoutView.content.show(homeView);
|
|
|
|
homeView.delegateEvents();
|
|
|
|
},
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-04-04 09:28:33 +00:00
|
|
|
missions: function () {
|
|
|
|
layoutView.content.show(missionsListView);
|
|
|
|
missionsListView.delegateEvents();
|
|
|
|
},
|
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
mods: function () {
|
|
|
|
layoutView.content.show(modsListView);
|
|
|
|
modsListView.delegateEvents();
|
|
|
|
},
|
2014-04-06 21:09:52 +00:00
|
|
|
|
|
|
|
server: function (id) {
|
|
|
|
layoutView.content.show(new ServerView({model: servers.get(id)}));
|
2014-02-09 03:19:48 +00:00
|
|
|
}
|
2014-04-06 21:09:52 +00:00
|
|
|
|
2014-02-09 03:19:48 +00:00
|
|
|
});
|
2014-04-06 21:09:52 +00:00
|
|
|
|
|
|
|
});
|