Session settings: close dialog on save response

This commit is contained in:
Jonathon Wilson 2013-06-09 23:24:33 -06:00
parent 2b78c6de3c
commit ea96d153ef
2 changed files with 18 additions and 10 deletions

View File

@ -368,20 +368,25 @@
}
function close(evt) {
var $target = $(evt.currentTarget).closest('[layout]');
var layoutId = $target.attr('layout-id');
var isDialog = ($target.attr('layout') === 'dialog');
if (isDialog) {
dialogEvent(layoutId, 'beforeHide');
$('.dialog-overlay').hide();
}
$target.hide();
if (isDialog) {
dialogEvent(layoutId, 'afterHide');
closeDialog(layoutId);
} else {
var $target = $(evt.currentTarget).closest('[layout]');
$target.hide();
}
return false;
}
function closeDialog(dialog) {
var $dialog = $('[layout-id="' + dialog + '"]');
dialogEvent(dialog, 'beforeHide');
$('.dialog-overlay').hide();
$dialog.hide();
dialogEvent(dialog, 'afterHide');
}
function screenEvent(screen, evtName, data) {
if (screen && screen in screenBindings) {
if (evtName in screenBindings[screen]) {
@ -583,6 +588,8 @@
close(evt);
};
this.closeDialog = closeDialog;
/**
* Given information on a grid, and a given card's grid settings, use the
* margin options and return a list of [top, left, width, height]

View File

@ -63,12 +63,13 @@
if (typeof newSessionInfo.genres === "string") {
newSessionInfo.genres = [newSessionInfo.genres];
}
alert("About to try and save: " + JSON.stringify(newSessionInfo));
rest.updateSession(id, newSessionInfo, settingsSaved);
var toSend = { music_session: newSessionInfo };
rest.updateSession(id, toSend, settingsSaved);
}
function settingsSaved(response) {
alert(response);
// No response returned from this call. 204.
app.layout.closeDialog('session-settings');
}
function events() {