Sha256: b3b5bd4f42d7d0979731f97e0d6e3cfc0601d12037666173c84a05b38cba8e39

Contents?: true

Size: 1.93 KB

Versions: 13

Compression:

Stored size: 1.93 KB

Contents

HCalendarPulldown = HMiniMenu.extend
  componentName: 'calendar_pulldown'
  defaultEvents:
    click: true
    resize: true
    preserveTime: true
  controlDefaults: HMiniMenu.prototype.controlDefaults.extend
    calendarHorizontalAlign: 'right'
    calendarVerticalAlign: 'top'
    label: ''
  calendarRect: ->
    [ x, y ] = [ @pageX(), @pageY() ]
    if @options.calendarHorizontalAlign == 'right'
      x = x - 200 + @rect.width
    else
      x = x + @rect.width
    if @options.calendarVerticalAlign == 'bottom'
      y = y - 200
    else
      y = y
    return [ x, y, 200, 200 ]
  repositionMenuItems: ->
    @menuItemView.setRect( @calendarRect() )
    @menuItemView.drawRect()
  menuShow: ->
    @base()
    @setLabel( @options.labelHide )
  menuHide: ->
    @base()
    @setLabel( @options.labelShow )
  setValueObj: (_valueObj)->
    @base(_valueObj)
    if @calendar?
      @calendar.valueObj.release( @calendar )
      @valueObj.bind(@calendar)
  refreshValue: ->
    _date = moment(@value).utc()
    @_timePreserve = [ _date.hours(), _date.minutes(), _date.seconds() ] if @options.preserveTime
    @calendar.setValue(@value)
  drawSubviews: ->
    @menuItemView = HView.new( @calendarRect(), @app,
      visible: false
      logicParent: @
      style:
        overflow: 'visible'
    )
    HControl.extend(
      defaultEvents:
        click: true
      click: ->
        @parent.options.logicParent.menuHide()
        true
    ).new( [ 0, 0, 200, 20 ], @menuItemView )
    @calendar = HCalendar.extend(
      refreshValue: ->
        @base()
        @parent.options.logicParent.setValue(@value)
    ).new( [ 0, 20, 200, 180 ], @menuItemView,
      value: @value
      valueObj: @valueObj
      preserveTime: @options.preserveTime
      todayStart: @options.todayStart
      style:
        boxShadow: '0 0 5px #333'
        borderRadius: '5px'
    )
HCalendarPullDown = HCalendarPulldown
HCalendarMenu = HCalendarPulldown
HCalenderButton = HCalendarPulldown

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rsence-pre-3.0.0.16 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.15 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.14 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.12 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.11 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.10 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.9 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.8 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.7 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.6 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.5 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.4 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee
rsence-pre-3.0.0.3 client/js/datetime/calendar_pulldown/calendar_pulldown.coffee