app/assets/javascripts/effective_datatables/flash.js.coffee in effective_datatables-4.3.11 vs app/assets/javascripts/effective_datatables/flash.js.coffee in effective_datatables-4.3.12
- old
+ new
@@ -1,19 +1,29 @@
-flash = (message) ->
+flash = (message, status = '') ->
@context[0].oFeatures.bProcessing = false
message ||= 'Processing...'
+ if status == 'danger'
+ message = 'Error: ' + message
+
$processing = $(@table().node()).siblings('.dataTables_processing')
+ $processing.removeClass('alert-success alert-info alert-warning alert-danger alert-error')
+
+ if status.length > 0
+ $processing.addClass("alert-#{status}")
+
$processing.html(message).show()
timeout = $processing.data('timeout')
clearTimeout(timeout) if timeout
+ delay = (if status == 'danger' then 4000 else 1000)
+
$processing.html(message).data('timeout', setTimeout( =>
$processing.html('Processing...').hide()
@context[0].oFeatures.bProcessing = true
- , 1500)
+ , delay)
)
return @
$.fn.DataTable.Api.register('flash()', flash);