Refactor batch view/edit pages to share some "execution options" logic

This commit is contained in:
Lance Edgar 2016-08-22 15:46:16 -05:00
parent 53950931af
commit cdde848275
4 changed files with 67 additions and 43 deletions

View file

@ -0,0 +1,44 @@
/************************************************************
*
* tailbone.batch.js
*
* Common logic for view/edit batch pages
*
************************************************************/
$(function() {
$('.newgrid-wrapper').gridwrapper();
$('#execute-batch').click(function() {
if (has_execution_options) {
$('#execution-options-dialog').dialog({
title: "Execution Options",
width: 500,
height: 300,
modal: true,
buttons: [
{
text: "Execute",
click: function(event) {
$(event.target).button('option', 'label', "Executing, please wait...").button('disable');
$('form[name="batch-execution"]').submit();
}
},
{
text: "Cancel",
click: function() {
$(this).dialog('close');
}
}
]
});
} else {
$(this).button('option', 'label', "Executing, please wait...").button('disable');
$('form[name="batch-execution"]').submit();
}
});
});