sync(dev): fehlende Admin-Theme-Assets vom Live-Stand ergaenzt (nichts ueberschrieben)
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
bend.dialogs = {
|
||||
confirmationDialog: function(options) {
|
||||
var defaults,
|
||||
configuration,
|
||||
win,
|
||||
dialog;
|
||||
|
||||
defaults = {
|
||||
confirmation: 'ok',
|
||||
denial: 'cancel',
|
||||
confirmationFunction: false,
|
||||
denialFunction: false,
|
||||
showDenial: true,
|
||||
heading: 'Confirmation Dialog',
|
||||
message: false
|
||||
}
|
||||
|
||||
//console.log(options);
|
||||
|
||||
configuration = bend.makeConfiguration(defaults, options);
|
||||
|
||||
win = bend.windows.makeWindow();
|
||||
|
||||
if (win == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dialog = '<h4>' + configuration.heading + '</h4>';
|
||||
|
||||
if (configuration.message) {
|
||||
dialog += '<p>' + configuration.message + '</p>';
|
||||
}
|
||||
|
||||
dialog += '<form id="bendConfirmationDialog">';
|
||||
dialog += '<input type="button" id="bendConfirmationDialogConfirmation" value="' + configuration.confirmation + '" />';
|
||||
if (configuration.showDenial) {
|
||||
dialog += '<input type="button" id="bendConfirmationDialogDenial" value="' + configuration.denial + '" />';
|
||||
}
|
||||
dialog += '</form>'
|
||||
|
||||
$(win).append(dialog);
|
||||
|
||||
$('#bendConfirmationDialogConfirmation').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('#bendConfirmationDialogConfirmation').unbind('click');
|
||||
if (configuration.showDenial) {
|
||||
$('#bendConfirmationDialogDenial').unbind('click');
|
||||
}
|
||||
|
||||
if (configuration.confirmationFunction) {
|
||||
configuration.confirmationFunction();
|
||||
}
|
||||
|
||||
bend.windows.destroyWindow(win);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (configuration.showDenial) {
|
||||
$('#bendConfirmationDialogDenial').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$('#bendConfirmationDialogConfirmation').unbind('click');
|
||||
$('#bendConfirmationDialogDenial').unbind('click');
|
||||
|
||||
if (configuration.denialFunction) {
|
||||
configuration.denialFunction();
|
||||
}
|
||||
|
||||
bend.windows.destroyWindow(win);
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
ajaxDialog: function (options) {
|
||||
var defaults,
|
||||
configuration,
|
||||
win,
|
||||
url;
|
||||
|
||||
defaults = {
|
||||
url: false,
|
||||
width: false,
|
||||
formSelector: false
|
||||
}
|
||||
|
||||
configuration = bend.makeConfiguration(defaults, options);
|
||||
|
||||
if (configuration.width) {
|
||||
win = bend.windows.makeWindow({width: configuration.width});
|
||||
}
|
||||
|
||||
if (win == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$(win).load(configuration.url);
|
||||
|
||||
$(configuration.formSelector).live('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var jqxhr = $.ajax({
|
||||
url: $(this).attr('action'),
|
||||
type: 'POST',
|
||||
data: $(this).serialize()
|
||||
});
|
||||
|
||||
jqxhr.success(function() {
|
||||
window.location.reload()
|
||||
});
|
||||
|
||||
jqxhr.error(function() {
|
||||
bend.dialogs.confirmationDialog({
|
||||
confirmation: 'ok',
|
||||
showDenial: false,
|
||||
heading: 'Fehler: Kann nicht speichern',
|
||||
message: false
|
||||
});
|
||||
|
||||
$(configuration.formSelector).unbind('submit');
|
||||
bend.windows.destroyWindow(win);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user