mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Wait until servers are reloaded
This commit is contained in:
parent
7d11af4633
commit
8ed68c0a4d
@ -1,36 +1,37 @@
|
||||
define(function (require) {
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
var $ = require('jquery'),
|
||||
_ = require('underscore'),
|
||||
Backbone = require('backbone'),
|
||||
Marionette = require('marionette'),
|
||||
FormView = require('marionette-formview'),
|
||||
Server = require('app/models/server'),
|
||||
tpl = require('text!tpl/servers/add.html');
|
||||
|
||||
tpl = require('text!tpl/servers/add.html');
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
template: _.template(tpl),
|
||||
|
||||
|
||||
initialize: function (options) {
|
||||
this.servers = options.servers;
|
||||
this.model = new Server();
|
||||
this.bind("ok", this.submit);
|
||||
},
|
||||
|
||||
|
||||
submit: function (modal) {
|
||||
modal.preventClose();
|
||||
|
||||
|
||||
this.model.set('title', $("form #title").val());
|
||||
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
this.model.save({}, {
|
||||
success: function() {
|
||||
modal.close();
|
||||
self.servers.fetch();
|
||||
Backbone.history.navigate('#servers/' + self.model.get('id'), true);
|
||||
self.servers.fetch({success : function () {
|
||||
Backbone.history.navigate('#servers/' + self.model.get('id'), true);
|
||||
}});
|
||||
},
|
||||
error: function() {
|
||||
alert("Error :(");
|
||||
@ -38,5 +39,5 @@ define(function (require) {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user