I've two similar functions and I want to use one generic function with two params, dialog and buttons. How do I do it?
My functions:
LanguageLogosView.showConfirmRemoveDialog = function () {
var def = $.Deferred();
var buttons = {
buttons: {
"Remove": function () {
def.resolve(true);
$(this).dialog("close");
},
Cancel: function () {
def.resolve(false);
$(this).dialog("close");
}
}
};
$('#dialog-confirm-remove').dialog($.extend(LanguageLogosView.dialogConfirmDefaultSettings, buttons));
return def;
}
LanguageLogosView.showConfirmEmptyRowsDialog = function () {
var def = $.Deferred();
var buttons = {
buttons: {
"Save": function () {
def.resolve(true);
$(this).dialog("close");
},
Cancel: function () {
def.resolve(false);
$(this).dialog("close");
}
}
};
$("#dialog-confirm-save-with-empty-rows").dialog($.extend(LanguageLogosView.dialogConfirmDefaultSettings, buttons));
return def;
}