Sha256: c3bf9c9deac5c2ba0ddf7c895071ec346ead059b3b3e3768b17593744bc3cbe3

Contents?: true

Size: 1.31 KB

Versions: 67

Compression:

Stored size: 1.31 KB

Contents

bootStrapConfirmModal = (message, element) ->
  d = $("#modal-confirm")
  $("#modal-confirm div.modal-body p").html message
  $("#modal-confirm #modal-accept").click (e) ->
    d.modal "hide"
    $.rails.handleLink element
    false
  d.modal()

$(document).ready ->
  $("body").append "<div id=\"modal-confirm\" class=\"modal modal-dialog hide fade\"><div class=\"modal-header\"><a href=\"#\" class=\"close\" data-dismiss=\"modal\">×</a><h3>Conferma</h3></div><div class=\"modal-body\"><p class=\"confirm-message\"></p></div><div class=\"modal-footer\"><a href=\"#\" class=\"btn\" data-dismiss=\"modal\">Annulla</a><a href=\"#\" class=\"btn btn-primary\" id=\"modal-accept\">Ok</a></div></div>"  if $("#rails-confirm-modal").length is 0
  $.rails.confirm = (message, element) ->
    bootStrapConfirmModal message, element

  $.rails.allowAction = (element) ->
    message = element.data("confirm")
    answer = false
    callback = undefined
    return true  unless message
    if $.rails.fire(element, "confirm")
      answer = $.rails.confirm(message, element)
      callback = $.rails.fire(element, "confirm:complete", [ answer ])
    answer and callback

  $.rails.handleLink = (link) ->
    if link.data("remote") isnt `undefined`
      $.rails.handleRemote link
    else $.rails.handleMethod link  if link.data("method")
    false

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
fullstack-admin-0.1.35 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.34 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.33 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.32 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.30 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.29 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.28 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.27 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.26 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.25 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.24 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.23 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.20 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.19 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.18 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.17 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.16 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.15 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.14 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.12 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee