Skip to content

Instantly share code, notes, and snippets.

@BlakeWilliams
Last active December 12, 2015 00:29
Show Gist options
  • Select an option

  • Save BlakeWilliams/4684540 to your computer and use it in GitHub Desktop.

Select an option

Save BlakeWilliams/4684540 to your computer and use it in GitHub Desktop.
Remove useless parts.
App.PickADate = Ember.View.extend
attributes: ['monthsFull', 'monthsShort', 'weekdaysFull', 'weekdaysShort',
'monthPrev', 'monthNext', 'showMonthsFull', 'showWeekdaysShort', 'today',
'clear', 'format', 'formatSubmit', 'hiddenSuffix', 'firstDay', 'monthSelector',
'yearSelector', 'dateMin', 'dateMax', 'datesDisabled', 'disablePicker']
events: ['onOpen', 'onClose', 'onSelect', 'onStart']
attributeBindings: ['type', 'value', 'placeholder']
type: 'text'
tagName: 'input'
classNames: 'pickadate'
didInsertElement: ->
options = {}
self = this
@get('events').forEach (event) ->
callback = self[event]
if callback
options[event] = ->
callback.call(this)
@get('attributes').forEach (attr) ->
options[attr] = self[attr] if self[attr] != undefined
onSelectCallback = options.onSelect
options.onSelect = ->
Ember.set self, 'value', this.getDate(true)
onSelectCallback.call(this) if onSelectCallback
@$().pickadate(options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment