Sha256: a52fc06ddef2f8d7d91492c62565821cf8217a0cae679e965d32d61d812a42d8

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

# -----------------------------------------------------------------------------
# Author: Alexander Kravets <alex@slatestudio.com>,
#         Slate Studio (http://www.slatestudio.com)
#
# Coding Guide:
#   https://github.com/thoughtbot/guides/tree/master/style/coffeescript
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# INPUT INVERTER VERSION SELECT
# -----------------------------------------------------------------------------
class @InputInverterVersion extends InputSelect

  _create_el: ->
    @config.optionsHashFieldName = '_document_versions'
    @config.ignoreOnSubmission   = true
    @config.default              = 0
    @url                         = "#{ @config.path }/#{ @object._id }.json"

    @$el =$ "<div class='input-#{ @config.type } #{ @config.klass } #{ @config.klassName }'>"


  _add_input: ->
    @$input =$ """<select name='#{ @name }'></select>"""
    @$el.append @$input

    @$input.on 'change', (e) => @_load_version()

    @_add_options()


  _load_version: ->
    version = @$input.val()
    $.get @url, { version: version }, (object) ->
      chr.module.view.form.updateValues(object)


chr.formInputs['inverter-version'] = InputInverterVersion




Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inverter-0.4.7 app/assets/javascripts/inputs/inverter-version.coffee
inverter-0.4.6 app/assets/javascripts/inputs/inverter-version.coffee