Commit 497a87a5 authored by Dave Lane's avatar Dave Lane

updated dialogue workflow with 'processing...'

parent e0cc1272
Pipeline #5 failed with stages
......@@ -165,22 +165,30 @@ article.ore-form .container .entry-content > div.ore {
word-wrap: unset;
word-break: unset;
}
#ore-container .modal-dialog button.close {
margin-top: -4px -8px 0 0;
#ore-container .modal-dialog .modal-header button.close {
margin: -10px -15px 0 0;
padding: 0;
width: 16px;
height: 16px;
cursor: pointer;
background: transparent;
text-transform: none;
border: 0;
float: right;
font-size: 21px;
font-weight: bold;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
opacity: 0.8;
}
#ore-container .modal-dialog span.close { opacity: 1.0; color: #555; }
#ore-container .modal-dialog span.close {
opacity: 1.0;
color: #555;
background-image: url("img/close.16x16.png");
background-repeat: none;
background-position: center center;
width: 16px;
height: 16px;
margin: 0;
padding: 0;
}
#ore-container .modal-dialog span.close:hover { color: #000; }
#ore-container .modal-content {
position: relative;
......@@ -234,6 +242,21 @@ article.ore-form .container .entry-content > div.ore {
color: #737373 !important;
}
.ore-throbber {
background-image: url('img/working.gif');
background-position: center center;
background-repeat: no-repeat;
background-color: transparent;
width: 20px;
height: 20px;
margin: 0px;
padding: 7px;
}
button.ore-processing {
padding-right: 30px;
}
/* validation errors */
.form-group .error {
color: #C60C0C;
......
......@@ -119,6 +119,9 @@ class OREMain extends OREBase {
$this->log('ore-submit-nonce all good.');
}
$this->log("processing submit form...");
/*$this->log("sleeping briefly for debugging purposes");
sleep(5);
$this->log("done sleeping");*/
// generate the response
header( "Content-Type: application/json" );
$response = $this->process();
......@@ -753,7 +756,7 @@ class OREMain extends OREBase {
if (isset($val['title'])) {
//$this->log('getting the modal: "'.$val['title'].'"');
$markup .= '<div class="modal-header">';
$markup .= '<button class="close" type="button" data-dismiss="modal" aria-label="Close"><span class="close" aria-hidden="true" title="This will close this window, and any changes will be lost...">x</span></button>';
$markup .= '<button class="close" type="button" data-dismiss="modal" aria-label="Close"><span class="close" aria-hidden="true" title="This will close this window, and any changes will be lost...">&nbsp;</span></button>';
$markup .= '<legend class="ore-title">'.$val['title'].'</legend>';
$markup .= '</div><!-- modal-header -->';
}
......
......@@ -545,6 +545,7 @@ jQuery(document).ready(function() {
if (modals.hasOwnProperty(id)) {
// if a menu is showing, close it.
close_menu();
not_busy();
// close any currently showing modals
if (id != current_modal) {
LOG('got a new id: '+id+' vs. '+current_modal);
......@@ -604,6 +605,24 @@ jQuery(document).ready(function() {
return false;
}
}
// show busy cursor
function busy() {
LOG('showing busy cursor');
$("body").css("cursor", "progress");
}
// return to the default cursor
function not_busy() {
LOG('hiding busy cursor');
$("body").css("cursor", "default");
}
// show a "working" throbber in the modal button
function busy_modal(form) {
LOG('busy modal: form details - ', form);
button = form.find("button.ore-default");
LOG('found button: ', button);
button.html('Processing...&nbsp;<span class="ore-throbber">&nbsp;</span>');
button.addClass('ore-processing');
}
// close any currently open modal
function close_modal(hash = null) {
LOG('closing currently open modal');
......@@ -661,7 +680,7 @@ jQuery(document).ready(function() {
if (ajax_submit(action, special_data)) {
LOG('completed ajax call for', action);
// check if a new hash has been specified by the submit, and act on it!
close_modal();
//close_modal();
check_hash(window.location.hash);
} else {
LOG('failed to complete ajax call for', action);
......@@ -709,6 +728,10 @@ jQuery(document).ready(function() {
'form_action': action,
'nonce_submit': ore_data.nonce_submit
}
// show the busy cursor
busy();
// turn on a throbber (for touch devices without cursor)
busy_modal(form);
$.ajax({
type: 'POST',
dataType: 'json',
......@@ -716,6 +739,7 @@ jQuery(document).ready(function() {
data: concat_data(default_data, special_data),
success: function(data) {
LOG('completed submission without submission error, returning true', data);
close_modal();
// handle post submission stuff
// if it was successful, do other stuff
if (data.hasOwnProperty('success')) {
......@@ -743,6 +767,7 @@ jQuery(document).ready(function() {
} else if (data.hasOwnProperty('failed')) { // if it failed, show error info
//LOG('wrapper html: ', wrapper.val());
LOG('Failed: ', action);
close_modal();
// setting hash to the "failed" result from the action
if (ore_data.modals[action].default.failed != null) {
LOG('setting hash to #'+ore_data.modals[action].default.failed)
......@@ -771,12 +796,15 @@ jQuery(document).ready(function() {
return true;
},
error: function(jqXHR, textStatus, errorThrown) {
close_modal();
LOG('failure: jqXHR ', jqXHR);
LOG('failure: textStatus ', textStatus);
LOG('failure: errorThrown ', errorThrown);
return false;
}
});
// return to the default cursor
not_busy();
return true;
}
// combine data arrays
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment