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.2.20 app/assets/javascripts/fullstack/admin/lib/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.19 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.18 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.17 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.16 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.15 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.14 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.13 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.12 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.11 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.9 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.8 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.7 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.6 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.5 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.4 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.3 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.2 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.2.1 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee
fullstack-admin-0.1.56 vendor/assets/javascripts/bootstrap_confirm_modal.js.coffee