Sha256: 4e11a6ce042580ed2ca9cc28e8c9eaecf88af87cb7fdf4d830cdf9530afb384c

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

$ ->
  $.rails.allowAction = (link) ->
    return true unless link.attr('data-confirm')
    $.rails.showConfirmDialog(link)
    false

  $.rails.confirmed = (link) ->
    link.removeAttr('data-confirm')
    link.trigger('click.rails')

  $.rails.showConfirmDialog = (link) ->
    message = link.attr 'data-confirm'
    html = """
           <div class="modal" id="confirmationDialog">
             <div class="modal-dialog">
               <div class="modal-content">
                 <div class="modal-header">
                   <a class="close" data-dismiss="modal">×</a>
                   <h1>#{message}</h1>
                 </div>
                 <div class="modal-body">
                  <p>You are about to delete. Do you want to proceed?</p>
                </div>
                 <div class="modal-footer">
                   <a data-dismiss="modal" class="btn">No</a>
                   <a data-dismiss="modal" class="btn btn-danger confirm">Yes</a>
                 </div>
               </div>
             </div>
           </div>
           """
    $(html).modal()
    $('#confirmationDialog .confirm').on 'click', -> $.rails.confirmed(link)

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
upload_documents_tool-0.1.8 app/assets/javascripts/documents_gem.coffee
upload_documents_tool-0.1.7 app/assets/javascripts/documents_gem.coffee
upload_documents_tool-0.1.6 app/assets/javascripts/documents_gem.coffee
upload_documents_tool-0.1.5 app/assets/javascripts/documents_gem.coffee
upload_documents_tool-0.1.4 app/assets/javascripts/documents_gem.coffee
upload_documents_tool-0.1.3 app/assets/javascripts/documents.coffee
upload_documents_tool-0.1.2 app/assets/javascripts/documents.coffee
upload_documents_tool-0.1.1 app/assets/javascripts/documents.coffee
upload_documents_tool-0.1.0 app/assets/javascripts/documents.coffee