Sha256: 3531dcdacdf4afbd6beb7ee34f78140353632c2ca459e0dca881505a70e5a589

Contents?: true

Size: 1.25 KB

Versions: 4

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'
      JSON.stringify(@value)
    else
      _escapeHtml(@value)


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

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


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


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


  showErrorMessage: (message) -> ;


  hideErrorMessage: -> ;


chr.formInputs['hidden'] = InputHidden




Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chr-0.2.8 app/assets/javascripts/chr/form/input-hidden.coffee
chr-0.2.7 app/assets/javascripts/chr/form/input-hidden.coffee
chr-0.2.5 app/assets/javascripts/chr/form/input-hidden.coffee
chr-0.2.4 app/assets/javascripts/chr/form/input-hidden.coffee