logTableId: "#logTable",
statusMsgId: "#statusMsg",
hideTabsByDefault: true,
+ dirty: false,
varName: "XOSTenantApp",
});
});
XOSTenantApp.setDirty = function(dirty) {
+ XOSTenantApp.dirty = dirty;
if (dirty) {
$("button.btn-tenant-save").addClass("btn-success");
} else {
var editDialog = this;
user_ids = all_options($("#tenant-edit-users-dialog").find(".select-picker-to"));
user_ids = user_ids.map( function(x) { return parseInt(x,10); } );
+ if (!array_same_elements(user_ids, model.usersBuffer)) {
+ XOSTenantApp.setDirty(true);
+ }
model.usersBuffer = user_ids;
$(editDialog).dialog("close");
},
};\r
\r
XOSTenantApp.viewSlice = function(model) {\r
+ if (XOSTenantApp.dirty) {\r
+ if (!confirm("The current sliver has unsaved data -- view new sliver anyway ?")) {\r
+ $("#tenantSliceSelector select").val(XOSTenantApp.currentSlice.id);\r
+ return;\r
+ }\r
+ }\r
+\r
+ XOSTenantApp.setDirty(false);\r
+\r
if (!model && xos.slicesPlus.models.length > 0) {\r
model = xos.slicesPlus.models[0];\r
}\r
\r
XOSTenantApp.tenantButtons.show( new XOSTenantButtonView( { app: XOSTenantApp,\r
linkedView: tenantSummary } ) );\r
+\r
+ XOSTenantApp.currentSlice = model;\r
} else {\r
XOSTenantApp.tenantSliceSelector.show(new HTMLView({html: ""}));\r
XOSTenantApp.tenantSummary.show(new HTMLView({html: "You have no slices"}));\r