mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Button to add more servers
This commit is contained in:
parent
9d55eb6162
commit
957e665ff2
@ -6,24 +6,14 @@ define(function (require) {
|
||||
_ = require('underscore'),
|
||||
Backbone = require('backbone'),
|
||||
Marionette = require('marionette'),
|
||||
AddServerView = require('app/views/servers/add'),
|
||||
tpl = require('text!tpl/servers/empty.html');
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: _.template(tpl),
|
||||
|
||||
events: {
|
||||
"click #add-server": "addServer"
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.servers = options.servers;
|
||||
},
|
||||
|
||||
addServer: function () {
|
||||
var view = new AddServerView({servers: this.servers});
|
||||
new Backbone.BootstrapModal({ content: view, servers: this.servers }).open()
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ define(function (require) {
|
||||
_ = require('underscore'),
|
||||
Backbone = require('backbone'),
|
||||
Marionette = require('marionette'),
|
||||
AddServerView = require('app/views/servers/add'),
|
||||
EmptyView = require('app/views/servers/empty'),
|
||||
ListItemView = require('app/views/servers/list_item'),
|
||||
tpl = require('text!tpl/servers/list.html'),
|
||||
@ -19,6 +20,10 @@ define(function (require) {
|
||||
|
||||
emptyView: EmptyView,
|
||||
|
||||
events: {
|
||||
"click #add-server": "addServer"
|
||||
},
|
||||
|
||||
buildItemView: function(item, ItemViewType, itemViewOptions){
|
||||
// build the final list of options for the item view type
|
||||
var options = _.extend({model: item}, itemViewOptions);
|
||||
@ -32,5 +37,10 @@ define(function (require) {
|
||||
// return it
|
||||
return view;
|
||||
},
|
||||
|
||||
addServer: function () {
|
||||
var view = new AddServerView({servers: this.collection});
|
||||
new Backbone.BootstrapModal({ content: view, servers: this.collection }).open()
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -8,3 +8,5 @@
|
||||
<!-- want to insert collection items, here -->
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-primary" id="add-server" href="#">Add new server</a>
|
||||
|
Loading…
Reference in New Issue
Block a user