Sha256: a62d01e182f58ade84a9c33df155590283e772894ad4661015365c3d0265b03f

Contents?: true

Size: 928 Bytes

Versions: 2

Compression:

Stored size: 928 Bytes

Contents

_.component('Luca.fields.TextField').extends('Luca.core.Field').with
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
luca-0.8.599 src/components/fields/text_field.coffee
luca-0.8.59 src/components/fields/text_field.coffee