on query request failure, show an error flash

pull/6827/head
Tim Felgentreff 14 years ago
parent 31a1c75a67
commit ea69f0a3b9
  1. 7
      assets/javascripts/reporting.js
  2. 10
      assets/javascripts/reporting/controls.js
  3. 21
      assets/stylesheets/reporting.css

@ -20,6 +20,13 @@ window.Reporting = {
onload: function (func) {
document.observe("dom:loaded", func);
},
flash: function (string, type) {
if (type === undefined) {
type = "error";
}
$("content").insert({before: "<div onclick='$(this).remove();' id='flash_" + type + "'>" + string + "</div>"});
}
};

@ -62,7 +62,12 @@ Reporting.Controls = {
e.preventDefault();
},
send_settings_data: function (targetUrl, callback) {
send_settings_data: function (targetUrl, callback, failureCallback) {
if (failureCallback === undefined) {
failureCallback = function () {
Reporting.flash("There was an error getting the results. The administrator has been informed.");
};
}
selectAllOptions('group_by_rows');
selectAllOptions('group_by_columns');
var updater = new Ajax.Request(
@ -70,7 +75,8 @@ Reporting.Controls = {
{ asynchronous: true,
evalScripts: true,
postBody: Form.serialize('query_form'),
onSuccess: callback });
onSuccess: callback,
onFailure: failureCallback});
},
attach_settings_callback: function (element, callback) {

@ -410,6 +410,27 @@ div.button_form p * {
margin: 2px;
}
/***** Flash ******/
#flash_error {
font-size: large;
line-height: 1;
text-align: center;
width: 90%;
background-color: #D55;
padding: 5px;
margin-bottom: 1em;
}
#flash_info {
font-size: large;
line-height: 1;
text-align: center;
width: 90%;
background-color: #FC6;
padding: 5px;
margin-bottom: 1em;
}
/***** Ajax indicator ******/
#ajax-indicator {
font-family: Verdana, sans-serif;

Loading…
Cancel
Save