Sha256: 1c0915945e13e6fbfae3375ea6ec23516be4ac52170d7108315a1e828c1d7783

Contents?: true

Size: 748 Bytes

Versions: 7

Compression:

Stored size: 748 Bytes

Contents

class Tao.Form.MomentPicker.ResultBase extends TaoComponent

  @tag 'tao-moment-picker-result'

  @attribute 'selected', type: 'boolean'

  @attribute 'disabled', type: 'boolean', observe: true

  @attribute 'format'

  _connected: ->
    @field = @jq.find '> input'
    @_bind()

  _disconnected: ->
    @off()

  _bind: ->
    @on 'click', 'input', =>
      @trigger 'tao:activeClick'
      false

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

  clear: ->
    @moment = null
    @selected = false
    @jq.find('.result-text').text ''

  setMoment: (m) ->
    unless m && moment.isMoment(m)
      @clear()
      return
    @moment = m
    @selected = true
    @jq.find('.result-text').text m.format(@format)

Version data entries

7 entries across 7 versions & 1 rubygems

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