mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[feature/ajax] Generic error handling with a phpbb.alert box
PHPBB3-10270
This commit is contained in:
parent
2f25173d93
commit
27199bb509
4 changed files with 21 additions and 3 deletions
|
@ -18,7 +18,7 @@
|
||||||
{DEBUG_OUTPUT}
|
{DEBUG_OUTPUT}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<div id="darkenwrapper">
|
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}">
|
||||||
<div id="darken"> </div>
|
<div id="darken"> </div>
|
||||||
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -324,12 +324,28 @@ phpbb.ajaxify = function(options) {
|
||||||
{
|
{
|
||||||
phpbb.loading_alert();
|
phpbb.loading_alert();
|
||||||
data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize();
|
data = $('<form>' + res.S_HIDDEN_FIELDS + '</form>').serialize();
|
||||||
$.post(res.S_CONFIRM_ACTION, data + '&confirm=' + res.YES_VALUE, return_handler);
|
$.ajax({
|
||||||
|
url: res.S_CONFIRM_ACTION,
|
||||||
|
type: 'POST',
|
||||||
|
data: data + '&confirm=' + res.YES_VALUE,
|
||||||
|
success: return_handler
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function error_handler()
|
||||||
|
{
|
||||||
|
var alert;
|
||||||
|
|
||||||
|
alert = phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
|
||||||
|
|
||||||
|
dark.fadeOut(phpbb.alert_time, function() {
|
||||||
|
alert.hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// If the element is a form, POST must be used and some extra data must
|
// If the element is a form, POST must be used and some extra data must
|
||||||
// be taken from the form.
|
// be taken from the form.
|
||||||
var run_filter = (typeof options.filter === 'function');
|
var run_filter = (typeof options.filter === 'function');
|
||||||
|
|
|
@ -67,6 +67,8 @@ $lang = array_merge($lang, array(
|
||||||
'ADMINISTRATORS' => 'Administrators',
|
'ADMINISTRATORS' => 'Administrators',
|
||||||
'AGE' => 'Age',
|
'AGE' => 'Age',
|
||||||
'AIM' => 'AIM',
|
'AIM' => 'AIM',
|
||||||
|
'AJAX_ERROR_TITLE' => 'AJAX error',
|
||||||
|
'AJAX_ERROR_TEXT' => 'Something went wrong when processing your request.',
|
||||||
'ALLOWED' => 'Allowed',
|
'ALLOWED' => 'Allowed',
|
||||||
'ALL_FILES' => 'All files',
|
'ALL_FILES' => 'All files',
|
||||||
'ALL_FORUMS' => 'All forums',
|
'ALL_FORUMS' => 'All forums',
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->
|
<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="darkenwrapper">
|
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}">
|
||||||
<div id="darken"> </div>
|
<div id="darken"> </div>
|
||||||
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue