Sha256: 6e90cd447b826c1f86e9976fa9ab0035325fbf0cad640d8fcc4ea3916d4d4b12

Contents?: true

Size: 993 Bytes

Versions: 4

Compression:

Stored size: 993 Bytes

Contents

Luca.fields.TextField = Luca.core.Field.extend
  form_field: true

  events:
    "keydown input" : "keydown_handler"
    "blur input" : "blur_handler"
    "focus input" : "focus_handler"
    "change input" : "change_handler"

  template: 'fields/text_field'

  initialize: (@options={})->
    _.bindAll @, "keydown_handler", "blur_handler", "focus_handler"
    Luca.core.Field::initialize.apply @, arguments

    @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

  keydown_handler: _.throttle ((e)-> @change_handler.apply @, arguments), 300

  blur_handler: (e)->
    me = my = $( e.currentTarget )

  focus_handler: (e)->
    me = my = $( e.currentTarget )
  
  change_handler: (e)->
    @trigger "on:change", @, e


Luca.register "text_field", "Luca.fields.TextField"


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
luca-0.8.3 src/components/fields/text_field.coffee
luca-0.8.2 src/components/fields/text_field.coffee
luca-0.8.06 src/components/fields/text_field.coffee
luca-0.8 src/components/fields/text_field.coffee