mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Dashboard with servers
This commit is contained in:
parent
12a9435e17
commit
77026aa4bc
@ -6,7 +6,7 @@ define(function (require) {
|
|||||||
Backbone = require('backbone'),
|
Backbone = require('backbone'),
|
||||||
LayoutView = require('app/views/layout'),
|
LayoutView = require('app/views/layout'),
|
||||||
NavigationView = require('app/views/navigation'),
|
NavigationView = require('app/views/navigation'),
|
||||||
HomeView = require('app/views/home'),
|
ServersView = require('app/views/servers/list'),
|
||||||
MissionsListView= require('app/views/missions/list'),
|
MissionsListView= require('app/views/missions/list'),
|
||||||
ModsListView = require('app/views/mods/list'),
|
ModsListView = require('app/views/mods/list'),
|
||||||
ServerView = require('app/views/servers/view'),
|
ServerView = require('app/views/servers/view'),
|
||||||
@ -20,7 +20,7 @@ define(function (require) {
|
|||||||
servers = new Servers(),
|
servers = new Servers(),
|
||||||
layoutView = new LayoutView({el: $body}).render(),
|
layoutView = new LayoutView({el: $body}).render(),
|
||||||
navigationView = new NavigationView({servers: servers}),
|
navigationView = new NavigationView({servers: servers}),
|
||||||
homeView = new HomeView({servers: servers}),
|
serversView = new ServersView({collection: servers}),
|
||||||
missionsListView = new MissionsListView({collection: missions}),
|
missionsListView = new MissionsListView({collection: missions}),
|
||||||
modsListView = new ModsListView({collection: mods});
|
modsListView = new ModsListView({collection: mods});
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ define(function (require) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
home: function () {
|
home: function () {
|
||||||
layoutView.content.show(homeView);
|
layoutView.content.show(serversView);
|
||||||
homeView.delegateEvents();
|
serversView.delegateEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
missions: function () {
|
missions: function () {
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
define(function (require) {
|
define(function (require) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var $ = require('jquery'),
|
var $ = require('jquery'),
|
||||||
_ = require('underscore'),
|
_ = require('underscore'),
|
||||||
Backbone = require('backbone'),
|
Backbone = require('backbone'),
|
||||||
Marionette = require('marionette'),
|
Marionette = require('marionette'),
|
||||||
AddServerView = require('app/views/servers/add'),
|
AddServerView = require('app/views/servers/add'),
|
||||||
tpl = require('text!tpl/home.html');
|
tpl = require('text!tpl/servers/empty.html');
|
||||||
|
|
||||||
return Marionette.ItemView.extend({
|
return Marionette.ItemView.extend({
|
||||||
template: _.template(tpl),
|
template: _.template(tpl),
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
"click #add-server": "addServer"
|
"click #add-server": "addServer"
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
this.servers = options.servers;
|
this.servers = options.servers;
|
||||||
},
|
},
|
||||||
|
|
||||||
addServer: function () {
|
addServer: function () {
|
||||||
var view = new AddServerView({servers: this.servers});
|
var view = new AddServerView({servers: this.servers});
|
||||||
new Backbone.BootstrapModal({ content: view, servers: this.servers }).open()
|
new Backbone.BootstrapModal({ content: view, servers: this.servers }).open()
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
36
public/js/app/views/servers/list.js
Normal file
36
public/js/app/views/servers/list.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
define(function (require) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var $ = require('jquery'),
|
||||||
|
_ = require('underscore'),
|
||||||
|
Backbone = require('backbone'),
|
||||||
|
Marionette = require('marionette'),
|
||||||
|
EmptyView = require('app/views/servers/empty'),
|
||||||
|
ListItemView = require('app/views/servers/list_item'),
|
||||||
|
tpl = require('text!tpl/servers/list.html'),
|
||||||
|
|
||||||
|
template = _.template(tpl);
|
||||||
|
|
||||||
|
return Marionette.CompositeView.extend({
|
||||||
|
itemView: ListItemView,
|
||||||
|
itemViewContainer: "tbody",
|
||||||
|
template: template,
|
||||||
|
|
||||||
|
emptyView: EmptyView,
|
||||||
|
|
||||||
|
buildItemView: function(item, ItemViewType, itemViewOptions){
|
||||||
|
// build the final list of options for the item view type
|
||||||
|
var options = _.extend({model: item}, itemViewOptions);
|
||||||
|
|
||||||
|
if (ItemViewType == EmptyView) {
|
||||||
|
options = _.extend({servers: this.collection}, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the item view instance
|
||||||
|
var view = new ItemViewType(options);
|
||||||
|
// return it
|
||||||
|
return view;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
17
public/js/app/views/servers/list_item.js
Normal file
17
public/js/app/views/servers/list_item.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
define(function (require) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var $ = require('jquery'),
|
||||||
|
_ = require('underscore'),
|
||||||
|
Backbone = require('backbone'),
|
||||||
|
Marionette = require('marionette'),
|
||||||
|
tpl = require('text!tpl/servers/list_item.html'),
|
||||||
|
|
||||||
|
template = _.template(tpl);
|
||||||
|
|
||||||
|
return Marionette.ItemView.extend({
|
||||||
|
tagName: "tr",
|
||||||
|
template: template
|
||||||
|
});
|
||||||
|
});
|
10
public/js/tpl/servers/list.html
Normal file
10
public/js/tpl/servers/list.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Server</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<!-- want to insert collection items, here -->
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
3
public/js/tpl/servers/list_item.html
Normal file
3
public/js/tpl/servers/list_item.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<td>
|
||||||
|
<a href='#servers/<%-id%>'><%-title%></a>
|
||||||
|
</td>
|
Loading…
Reference in New Issue
Block a user