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.33 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.32 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.31 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.30 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.29 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.28 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.27 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.26 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.25 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.24 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.23 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.22 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.21 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.20 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.19 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.18 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.17 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.16 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.15 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.14 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb