Sha256: 6c3b3f5951c3d5682964814108271cca56ee14a5042f26b557bbbfcc89262f51

Contents?: true

Size: 965 Bytes

Versions: 37

Compression:

Stored size: 965 Bytes

Contents

# These next three methods hijack rails/ujs and jquery_ujs data-confirm and do it our own way with a double click confirm

if <%= !!EffectiveBootstrap.use_custom_data_confirm %> && (window.Rails || $.rails)
  $(document).on 'confirm', (event) ->
    $obj = $(event.target)

    if $obj.data('confirmed')
      true
    else
      $obj.data('confirm-original', $obj.html())
      $obj.html($obj.data('confirm'))
      $obj.data('confirmed', true)
      setTimeout(
        (->
          $obj.data('confirmed', false)
          $obj.html($obj.data('confirm-original'))
        )
        , 4000)
      false # don't show the confirmation dialog

  (window.Rails || $.rails).confirm = (message) -> true
  (window.Rails || $.rails).effective_bootstrap_custom_data_confirm = true

  $(document).on 'confirm:complete', (event) -> $(event.target).data('confirmed')

  $(document).on 'click', 'a.dropdown-item[data-confirm]', (event) ->
    event.preventDefault()
    false

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
effective_bootstrap-0.9.13 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.12 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.11 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.10 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.9 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.8 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.7 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.6 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.5 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.4 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.3 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.2 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.1 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.0 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.8.5 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.8.4 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.8.3 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb