Sha256: c4017ceb9137c34456251a76383b24b0bc13e4be534d62cb665235a730bb0f90

Contents?: true

Size: 949 Bytes

Versions: 7

Compression:

Stored size: 949 Bytes

Contents

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

class Tao.Form.Select.MultipleResult extends Tao.Form.Select.MultipleResultBase

  @attribute 'active', type: 'boolean'

  _connected: ->
    super
    @linkAdd = @jq.find '.link-add'
    @linkAdd.attr('tabindex', '0') unless @disabled

  _bind: ->
    super

    @on 'click', '.link-add', (e) =>
      return if @disabled
      @trigger 'tao:activeClick'
      false

    @on 'keydown', '.link-add', (e) =>
      return if @disabled
      if e.which == 13
        @trigger 'tao:enterPress'
        false
      else if e.which == 38
        @trigger 'tao:arrowPress', ['up']
        false
      else if e.which == 40
        @trigger 'tao:arrowPress', ['down']
        false

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

  focus: ->
    @linkAdd.focus()

TaoComponent.register Tao.Form.Select.MultipleResult

Version data entries

7 entries across 7 versions & 1 rubygems

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