Sha256: 2654f6c608632540f2024f15ad6ea0c7b69b807cadda37ee479af6f457c7f630

Contents?: true

Size: 865 Bytes

Versions: 9

Compression:

Stored size: 865 Bytes

Contents

$ ()->
  controller = $("body").data("controller")
  action = $("body").data("action")

  controllerObj = Storytime.Utilities.controllerFromString(controller)
  
  if controllerObj?
    instance = new controllerObj()
    instance["init"]() if typeof(instance["init"]) == "function"
    instance["init#{action}"]() if typeof(instance["init#{action}"]) == "function"
    Storytime.instance = instance

  $(".flash").delay(2000).fadeOut()

  $(".chosen").chosen()

  $(document).on('ajax:beforeSend', '.btn-delete-resource', ()->
    $(@).attr("disabled", true)
  ).on('ajax:success', '.btn-delete-resource', ()->
    $("##{$(@).data('resource-type')}_#{$(@).data('resource-id')}").remove()
  ).on('ajax:error', '.btn-delete-resource', (e, data, d1, d2)->
    $(@).attr("disabled", false)
    alert("There was an error deleting your #{$(@).data('resource-type')}")
  )

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
storytime-1.2.0 app/assets/javascripts/storytime/base.js.coffee
storytime-1.1.1 app/assets/javascripts/storytime/base.js.coffee
storytime-1.0.7 app/assets/javascripts/storytime/base.js.coffee
storytime-1.0.6 app/assets/javascripts/storytime/base.js.coffee
storytime-1.0.5 app/assets/javascripts/storytime/base.js.coffee
storytime-1.0.2 app/assets/javascripts/storytime/base.js.coffee
storytime-1.0.1 app/assets/javascripts/storytime/base.js.coffee
storytime-1.0.0 app/assets/javascripts/storytime/base.js.coffee
storytime-0.0.4 app/assets/javascripts/storytime/base.js.coffee