Sha256: 0363c142edcfc1780a603a352d76129eb355db0c27f5c635de1511ff66278618

Contents?: true

Size: 637 Bytes

Versions: 10

Compression:

Stored size: 637 Bytes

Contents

class @AssetReplacer

  constructor: (element, options={}) ->
    @element = $(element)
    @input = @element.find('.js-replace-asset')
    @form = @element.find('form')
    @btn = @input.prev()
    @actions = @element.find('.media-actions')
    @bindEvents()

  bindEvents: () =>
    @input.on('change', @change)
    @element.on('mouseover', @toggleActions)
    @element.on('mouseout', @toggleActions)

  change: (e) =>
    @form.submit()
    @btn.html("<i class='fa fa-spinner fa-spin'></i> Uploading...")

  toggleActions: (e) =>
    @actions.toggle()

jQuery ->
  $('.js-media-editable').each (index, el) ->
    new AssetReplacer(el)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
georgia-0.8.0 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.8 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.7 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.6 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.5 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.4 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.3 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.2 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.1 app/assets/javascripts/georgia/components/asset-replacer.js.coffee
georgia-0.7.0 app/assets/javascripts/georgia/components/asset-replacer.js.coffee