diff --git a/public/dashboard/js/model/schema-model.js b/public/dashboard/js/model/schema-model.js
index 0f424d8..c25ce99 100644
--- a/public/dashboard/js/model/schema-model.js
+++ b/public/dashboard/js/model/schema-model.js
@@ -3,11 +3,12 @@ window.SchemaModel = Backbone.Model.extend({
return "/settings/"+this.get("_id")+'?method=put';
},
sync: function (method, model) {
+ var _self = this;
if (model.get('groups')) model.unset('groups', {silent: true});
d(this.url(), model, function onSync(response) {
console.log('onSync in SchemaModel');
+ _self.trigger('change', response);
});
},
idAttribute: '_id'
-
});
\ No newline at end of file
diff --git a/public/dashboard/js/router.js b/public/dashboard/js/router.js
index 8359aa4..c1d49fb 100644
--- a/public/dashboard/js/router.js
+++ b/public/dashboard/js/router.js
@@ -1,4 +1,5 @@
var Router = Backbone.Router.extend({
+ currentView: '',
initialize: function() {
// prevent caching
$.ajaxSetup({ cache: false });
@@ -31,7 +32,7 @@ var Router = Backbone.Router.extend({
},
plugin: function(name, tabId) {
var model = app.get("plugins").getByPluginName(name);
- var view = new PluginView({
+ this.currentView = new PluginView({
model: model
});
var _breadcrumbHTML = ''+app.get('name')+'';
@@ -39,8 +40,8 @@ var Router = Backbone.Router.extend({
if (tabId) _breadcrumbHTML += ' » '+model.getObjectById(tabId).get('name')+'';
$('#bread > h4').empty().append(_breadcrumbHTML);
- if (typeof tabId !== "undefined" && tabId !== '') view.tabId = tabId;
- view.render();
+ if (tabId && tabId !== '') this.currentView.tabId = tabId;
+ this.currentView.render();
}
});
diff --git a/public/dashboard/js/view/partial/plugin-view.js b/public/dashboard/js/view/partial/plugin-view.js
index d58ca39..b81d69a 100644
--- a/public/dashboard/js/view/partial/plugin-view.js
+++ b/public/dashboard/js/view/partial/plugin-view.js
@@ -11,7 +11,7 @@ window.PluginView = Backbone.View.extend({
// if its the models plugin
if(this.model.get('plugin') === 'models') {
- var tabContent = _self.addTab('overview', 'models-overview');
+ var tabContent = _self.addTab('overview', '');
tabContent
.append('')
.append(
@@ -24,8 +24,7 @@ window.PluginView = Backbone.View.extend({
window.location.reload();
});
})
- )
- ;
+ );
}
this.model.get("objects").each(function(obj){
diff --git a/public/dashboard/js/view/partial/schema-view.js b/public/dashboard/js/view/partial/schema-view.js
index 7f9e09d..3ce8dd2 100644
--- a/public/dashboard/js/view/partial/schema-view.js
+++ b/public/dashboard/js/view/partial/schema-view.js
@@ -26,14 +26,17 @@ window.SchemaView = Backbone.View.extend({
$(".save-changes", this.el).html("Save All Schema Changes").removeClass("white").addClass("blue");
},
schemaChange: function (msg) {
- if (msg.get("errors")) {
- this.showAlert('error', JSON.stringify(msg.get('errors')));
- }
- else if (msg.get("description")) {
- this.showAlert('success', "Schema saved successfully.");
+ console.log(JSON.stringify(msg));
+ if (!msg.description) {
+ if (msg.errors) {
+ this.showAlert('error', JSON.stringify(msg.get('errors')));
+ }
+ else {
+ this.showAlert('error', 'The schema wasn\'t saved but no error messages were received. Make sure the server is online.');
+ }
}
else {
- this.showAlert('warning', "Couldn't determine if schema was saved.");
+ this.showAlert('success', "Schema saved successfully.");
}
},
initialize: function () {