fix ajax indicator delay: select2 filters don't break anymore

* no JS code changes, just a different inclusion method
This commit is contained in:
Tobias Stenzel 2017-09-15 13:10:21 +00:00
parent f1ada7eb96
commit 4e3f89e5f5
3 changed files with 16 additions and 13 deletions

View File

@ -6,6 +6,7 @@
<% end %>
<%= additionals_library_load(:font_awesome) %>
<%= stylesheet_link_tag 'additionals', plugin: 'additionals' %>
<%= additionals_library_load(:delay_ajax_indicator) %>
<%
if User.current.try(:hrm_user_manager).nil?

View File

@ -1,14 +1,14 @@
function delayAjaxIndicator() {
$(document).off('ajaxSend').bind('ajaxSend', function(event, xhr, settings) {
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
$('#ajax-indicator').stop(true, false).delay(300).show(0);
}
});
function delayAjaxIndicator() {
$(document).off('ajaxSend').bind('ajaxSend', function(event, xhr, settings) {
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
$('#ajax-indicator').stop(true, false).delay(300).show(0);
}
});
$(document).off('ajaxStop').bind('ajaxStop', function() {
$('#ajax-indicator').hide(0);
});
$(document).off('ajaxStop').bind('ajaxStop', function() {
$('#ajax-indicator').hide(0);
});
};
};
$(document).ready(delayAjaxIndicator)
$(document).ready(delayAjaxIndicator)

View File

@ -188,8 +188,10 @@ module Additionals
def additionals_load_select2
additionals_include_js('additionals_to_select2')
# TODO: breaks query filters with select2
# additionals_include_js('additionals_delay_ajax_indicator')
end
def additionals_load_delay_ajax_indicator
additionals_include_js('additionals_delay_ajax_indicator')
end
def additionals_load_font_awesome