Sha256: 04e8239b773da4f1469ee84ff09f7f294f60fcda93032084e8b5d52b1a7a7d9a

Contents?: true

Size: 893 Bytes

Versions: 7

Compression:

Stored size: 893 Bytes

Contents

#= require tao/form/shared/fields/select/result/base

class Tao.Form.Select.Result extends Tao.Form.Select.ResultBase

  @attribute 'active', type: 'boolean'

  _connected: ->
    super
    @jq.attr('tabindex', '0') unless @disabled

  _bind: ->
    super

    @on 'click', (e) =>
      return if @disabled
      @trigger 'tao:activeClick'

    @on 'keydown', (e) =>
      return if @disabled
      if e.which == 13
        @trigger 'tao:enterPress'
        false
      else if e.which == 8 || e.which == 46
        @clear() && @trigger('tao:clear')
        false
      else if e.which == 38
        @trigger 'tao:arrowPress', ['up']
        false
      else if e.which == 40
        @trigger 'tao:arrowPress', ['down']
        false

  _disabledChanged: ->
    if @disabled
      @jq.removeAttr 'tabindex'
    else
      @jq.attr 'tabindex', '0'

TaoComponent.register Tao.Form.Select.Result

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tao_form-0.1.9 lib/assets/javascripts/tao/form/fields/select/result.coffee
tao_form-0.1.8 lib/assets/javascripts/tao/form/fields/select/result.coffee
tao_form-0.1.7 lib/assets/javascripts/tao/form/fields/select/result.coffee
tao_form-0.1.6 lib/assets/javascripts/tao/form/fields/select/result.coffee
tao_form-0.1.5 lib/assets/javascripts/tao/form/fields/select/result.coffee
tao_form-0.1.4 lib/assets/javascripts/tao/form/fields/select/result.coffee
tao_form-0.1.3 lib/assets/javascripts/tao/form/fields/select/result.coffee