Sha256: 070ff74f0417182a6fbb3d880987a96f376584a51b11263b9cc09ef1610d621c

Contents?: true

Size: 675 Bytes

Versions: 3

Compression:

Stored size: 675 Bytes

Contents

#= require ./base

MomentPicker = Tao.Form.MomentPicker

class MomentPicker.HourSegment extends MomentPicker.SegmentBase

  @tag 'tao-moment-picker-hour-segment'

  segmentName: 'hour'

  _bind: ->
    @on 'click', '.hour', (e) =>
      $hour = $ e.currentTarget
      momentData = _.clone @momentData
      momentData.hour = $hour.data 'hour'
      @trigger 'dataSelect', [momentData]

  setMomentData: (momentData) ->
    super
    @_render()
    @momentData

  _render: ->
    @jq.find('.hour.selected').removeClass 'selected'
    unless _.isNil @value()
      @jq.find(".hour[data-hour='#{@value()}']").addClass 'selected'

TaoComponent.register MomentPicker.HourSegment

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tao_form-0.1.2 lib/assets/javascripts/tao/form/shared/fields/moment_picker/segments/hour_segment.coffee
tao_form-0.1.1 lib/assets/javascripts/tao/form/shared/fields/moment_picker/segments/hour_segment.coffee
tao_form-0.1.0 lib/assets/javascripts/tao/form/shared/fields/moment_picker/segments/hour_segment.coffee