Sha256: eea67b5454fb0695110fcb90ea84b2fe2070a61df4ff0f5e6e46b610f27ec52c

Contents?: true

Size: 940 Bytes

Versions: 2

Compression:

Stored size: 940 Bytes

Contents

_.def('Luca.fields.TextField').extends('Luca.core.Field').with
  events:
    "blur input" : "blur_handler"
    "focus input" : "focus_handler"
    "change input" : "change_handler"

  template: 'fields/text_field'

  autoBindEventHandlers: true

  send_blanks: true

  keyEventThrottle: 300

  initialize: (@options={})->
    if @enableKeyEvents
      @registerEvent("keyup input","keyup_handler")     

    @input_id ||= _.uniqueId('field')
    @input_name ||= @name
    @label ||= @name
    @input_class ||= @class

    if @prepend
      @$el.addClass('input-prepend')
      @addOn = @prepend

    if @append
      @$el.addClass('input-append')
      @addOn = @append

    Luca.core.Field::initialize.apply @, arguments

  keyup_handler: (e)->
    @trigger "on:keyup", @, e

  blur_handler: (e)->
    @trigger "on:blur", @, e

  focus_handler: (e)->
    @trigger "on:focus", @, e

  change_handler: (e)-> 
    @trigger "on:change", @, e

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
luca-0.9.42 src/components/fields/text_field.coffee
luca-0.9.4 src/components/fields/text_field.coffee