Sha256: 3f35a49711e908cd97e0f2abebd4e691f2bd80177dc1a6ab76f805ae886925a3
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
class Tao.Form.MomentPicker.ElementBase extends TaoComponent @attribute 'valueFormat', 'displayFormat' @attribute 'active', 'disabled', type: 'boolean', observe: true _connected: -> @result = @findComponent 'tao-moment-picker-result', => @field = @result.field @result.format = @displayFormat @setMoment @field.val() @segmentList = @findComponent 'tao-moment-picker-segment-list' @_bind() _disconnected: -> @off() _bind: -> @on 'activeClick', 'tao-moment-picker-result', (e) => return if @disabled @_toggleActive() null @on 'clear', 'tao-moment-picker-result', (e) => return if @disabled @active = false @setMoment null @trigger 'change', [@moment] null @on 'momentSelect', 'tao-moment-picker-segment-list', (e, m) => @active = false @setMoment m @trigger 'change', [@moment] null _toggleActive: -> @active = !@active setMoment: (m) -> m = moment(m, @valueFormat) unless moment.isMoment(m) if m && m.isValid() @result.setMoment m @field.val m.format(@valueFormat) @moment = m else @result.setMoment null @field.val '' @moment = null @moment
Version data entries
3 entries across 3 versions & 1 rubygems