mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Resolve dependencies server side and update mod view as needed
This commit is contained in:
parent
165f9de675
commit
eb5c43e0e5
@ -24,6 +24,10 @@ define(function (require) {
|
||||
"click .nav-tabs a" : "tabs",
|
||||
},
|
||||
|
||||
modelEvents: {
|
||||
"change": "serverUpdated",
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.mods = options.mods;
|
||||
},
|
||||
@ -33,6 +37,10 @@ define(function (require) {
|
||||
this.modsView.show(new ModsListView({collection: this.mods, server: this.model}));
|
||||
},
|
||||
|
||||
serverUpdated: function() {
|
||||
this.modsView.currentView.render();
|
||||
},
|
||||
|
||||
tabs: function(e) {
|
||||
e.preventDefault()
|
||||
$($(e.target).attr('href')).tab('show')
|
||||
|
@ -1,3 +1,4 @@
|
||||
var playwithsix = require('playwithsix');
|
||||
var slug = require('slug');
|
||||
|
||||
var Manager = require('./../manager');
|
||||
@ -27,7 +28,7 @@ exports.create = function (req, res){
|
||||
};
|
||||
|
||||
exports.show = function (req, res){
|
||||
var server = manager.getServer(req.params.server)
|
||||
var server = manager.getServer(req.params.server);
|
||||
res.send({
|
||||
id: server.id,
|
||||
title: server.title,
|
||||
@ -42,11 +43,20 @@ exports.update = function(req, res){
|
||||
|
||||
if (req.body.mods) {
|
||||
server.mods = req.body.mods;
|
||||
manager.save();
|
||||
|
||||
playwithsix.resolveDependencies(server.mods, function (err, mods) {
|
||||
if (!err && mods) {
|
||||
server.mods = mods;
|
||||
}
|
||||
|
||||
manager.save();
|
||||
|
||||
res.send(server);
|
||||
});
|
||||
} else {
|
||||
manager.save();
|
||||
res.send(server);
|
||||
}
|
||||
};
|
||||
|
||||
exports.destroy = function(req, res){
|
||||
|
Loading…
Reference in New Issue
Block a user