Sha256: 19bf3846d9cc90a1afba8bfe0aec64313a9f839a58a1985cca071111e17e08b4

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

bind_galleries = ->
  # Bind the koh uploader and galleries to a page
  $(".gallery-uploader").each ->
    # Check that it's not already bound
    unless $(this).hasClass("uploadable")
      $(this).addClass "uploadable"
      $this = $(this)
      $this.removeClass "uploader"
      
      field = $this.attr("data-uploader-input-name")

      $this.assetable_uploader
        multi_selection: true
        gallery: true
        url: "/assetable/assets"
        fieldname: field
        authenticity_token: $("meta[name=\"csrf-token\"]").attr("content")
        onUploaded: (resp) ->
          $this.find('.uploader-data-wrapper').append(resp.html)
        fileRemoved: (button, item) ->
          $(button).closest('.uploader-preview').remove()
        fileUpdated: (resp) ->
          $this.find('div.uploader-preview[data-asset-id="' + resp.id + '"]').replaceWith(resp.html)

        # Make the gallery sortable
        $(this).sortable
          items: "div.uploader-preview"
          distance: 50
          tolerance: 'pointer'
          placeholder: 'uploader-sortable-placeholder'


window.Assetable.bind_galleries = bind_galleries

$(document).ready ->

  window.Assetable.bind_galleries()

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
assetable-0.1.10 app/assets/javascripts/assetable/gallery.js.coffee
assetable-0.1.9 app/assets/javascripts/assetable/gallery.js.coffee
assetable-0.1.8 app/assets/javascripts/assetable/gallery.js.coffee
assetable-0.1.7 app/assets/javascripts/assetable/gallery.js.coffee
assetable-0.1.6 app/assets/javascripts/assetable/gallery.js.coffee