Sha256: ed6a019f0578c04b438d6147e5cd3fdc64b67f5d7db844dc962f68f160289ae3

Contents?: true

Size: 986 Bytes

Versions: 10

Compression:

Stored size: 986 Bytes

Contents

# -----------------------------------------------------------------------------
# INPUT FILE IMAGE
# -----------------------------------------------------------------------------
# Config options:
#   thumbnail(object) - method that returns thumbnail for input
# -----------------------------------------------------------------------------
class @InputFileImage extends InputFile
  _add_input: ->
    @$link =$ "<a href='#' target='_blank' title=''></a>"
    @$el.append @$link

    @$thumb =$ "<img src='' />"
    @$el.append @$thumb

    @$input =$ "<input type='file' name='#{ @name }' id='#{ @name }' />"
    @$el.append @$input

    @_add_clear_button()
    @_add_remove_checkbox()


  _update_inputs: ->
    @$link.html(@filename).attr('title', @filename).attr('href', @value.url)
    image_thumb_url = if @config.thumbnail then @config.thumbnail(@object) else @value.url
    @$thumb.attr('src', image_thumb_url).attr('alt', @filename)


chr.formInputs['image'] = InputFileImage

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
formagic-0.3.4 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.3.3 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.3.2 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.3.1 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.3.0 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.2.9 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.2.8 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.2.6 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.2.5 app/assets/javascripts/formagic/inputs/image.coffee
formagic-0.1.0 app/assets/javascripts/formagic/inputs/image.coffee