Skip to content

Instantly share code, notes, and snippets.

@sgharms
Created January 12, 2012 17:01
Show Gist options
  • Save sgharms/1601725 to your computer and use it in GitHub Desktop.
Save sgharms/1601725 to your computer and use it in GitHub Desktop.
class Timesheet.Views.DateScrollView extends Backbone.View
el: '.DateScrollPane'
template: JST['tasks/date_scroll_view']
initialize: ->
@collection.bind 'reset', @render
...
@model.bind 'change:completed_on', @refreshSelection
...
render: =>
completedOn = Date.parse @model.get('completed_on')
$(@el).html @template(tasks: @lastWeekdays(completedOn))
$(@el).find('.date').filter(':last').addClass 'selected'
isCurrentWeek = Date.today().compareTo(@range.end) is 0
if isCurrentWeek
$('#next', @el).remove()
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment