Sha256: 39216ce945e717d53520d6f32e75f533ec7644ae92ce82e51e58ba495cbb3844

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

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

  if window.Rails
    window.Rails.confirm = (message) -> true
    window.Rails.effective_bootstrap_custom_data_confirm = true

  if $.rails
    $.rails.confirm = (message) -> true
    $.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

8 entries across 8 versions & 1 rubygems

Version Path
effective_bootstrap-0.9.41 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.40 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.39 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.38 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.37 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.36 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.35 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb
effective_bootstrap-0.9.34 app/assets/javascripts/effective_bootstrap/confirm.js.coffee.erb