Small bug fixes calling reset

This commit is contained in:
Tyler Renelle 2012-02-09 21:14:46 -05:00
parent 8c494a189a
commit 952cc206c5
2 changed files with 3 additions and 5 deletions

View file

@ -2,7 +2,7 @@ HabitTracker.Views.Habits ||= {}
class HabitTracker.Views.Habits.HabitView extends Backbone.View
template: JST["backbone/templates/habits/habit"]
events:
"click .destroy" : "destroy"
"click .vote-up" : "voteUp"
@ -15,7 +15,6 @@ class HabitTracker.Views.Habits.HabitView extends Backbone.View
voteUp: ->
@model.vote("up")
@trigger("reset")
voteDown: ->
@model.vote("down")

View file

@ -5,8 +5,7 @@ class HabitTracker.Views.Habits.IndexView extends Backbone.View
initialize: () ->
@options.habits.bind('reset', @addAll)
#TODO this is causing "Remaining" tab to be auto-selected
@options.habits.bind('change', @render, this)
@options.habits.bind('change', @render, this) #TODO this ruins tabs, revisit
addAll: () =>
@options.habits.each(@addOne)
@ -17,7 +16,7 @@ class HabitTracker.Views.Habits.IndexView extends Backbone.View
if habit.isDaily() then @$("#habits-daily").append(view.render().el)
if habit.isDoneTodo() then @$("#habits-todos-done").append(view.render().el)
if habit.isRemainingTodo() then @$("#habits-todos-remaining").append(view.render().el)
render: =>
$(@el).html(@template(habits: @options.habits.toJSON() ))
@addAll()