Sha256: b05189bcc3f55e9e9497f538d9a95c6d51c0d165e149b7aa1d057b43e36984ff

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 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 HIDDEN
# -----------------------------------------------------------------------------
class @InputHidden
  constructor: (@name, @value, @config, @object) ->
    @_create_el()

    return this


  # PRIVATE ===============================================

  _create_el: ->
    @$el =$ "<input type='hidden' name='#{ @name }' value='#{ @_safe_value() }' />"


  _safe_value: ->
    if typeof(@value) == 'object'
      return JSON.stringify(@value)
    else
      _escapeHtml(@value)


  # PUBLIC ================================================

  showErrorMessage: (message) -> ;


  hideErrorMessage: -> ;


  initialize: ->
    @config.onInitialize?(this)


  hash: (hash={}) ->
    hash[@config.klassName] = @$el.val()
    return hash


  updateValue: (@value) ->
    @$el.val(@value)


chr.formInputs['hidden'] = InputHidden




Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
formagic-0.3.4 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.3 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.2 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.1 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.3.0 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.2.9 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.2.8 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.2.6 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.2.5 app/assets/javascripts/formagic/inputs/hidden.coffee
formagic-0.1.0 app/assets/javascripts/formagic/inputs/hidden.coffee
chr-0.3.5 app/assets/javascripts/form/input-hidden.coffee