Sha256: d975ceb2c069cf7a61fec640647b8d088eabbca7fd3faaa90ad0b79c97780a52

Contents?: true

Size: 679 Bytes

Versions: 7

Compression:

Stored size: 679 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 'tao: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

7 entries across 7 versions & 1 rubygems

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