Skip to content

Instantly share code, notes, and snippets.

@ef4
Created October 1, 2011 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ef4/1256029 to your computer and use it in GitHub Desktop.
Save ef4/1256029 to your computer and use it in GitHub Desktop.
App.AgendaController = SC.Object.extend
month: (->
if m = /agenda\/(\d+)/.exec(@get('subpath'))
Number(m[1])
else
(new Date).getMonth() + 1
).property('subpath').cacheable()
year: (->
if m = /agenda\/\d+\/(\d+)/.exec(@get('subpath'))
Number(m[1])
else
(new Date).getFullYear()
).property('subpath').cacheable()
stableMonthBinding: 'month'
stableYearBinding: 'year'
firstDate: (->
new Date(@get('year'), @get('month') - 1, 1)
).property('stableMonth', 'stableYear').cacheable()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment