Commit 1d54742e authored by Taddeus Kroes's avatar Taddeus Kroes

Programs now update highlighted state when indicator moves

parent 63bb365f
...@@ -158,6 +158,7 @@ ProgramView = Backbone.View.extend( ...@@ -158,6 +158,7 @@ ProgramView = Backbone.View.extend(
) )
@listenTo(Settings, 'change:favourite_programs', @updateFavlink) @listenTo(Settings, 'change:favourite_programs', @updateFavlink)
@listenTo(Clock, 'tick', @render)
toggleFavourite: (e) -> toggleFavourite: (e) ->
Settings.toggleFavouriteProgram(@model.get('title')) Settings.toggleFavouriteProgram(@model.get('title'))
...@@ -171,6 +172,7 @@ ProgramView = Backbone.View.extend( ...@@ -171,6 +172,7 @@ ProgramView = Backbone.View.extend(
if @model.get('start') <= Date.now() if @model.get('start') <= Date.now()
if @model.get('end') < Date.now() if @model.get('end') < Date.now()
@$el.removeClass('current').addClass('past') @$el.removeClass('current').addClass('past')
@stopListening(Clock, 'tick')
else else
@$el.addClass('current') @$el.addClass('current')
) )
...@@ -256,7 +258,7 @@ AppView = Backbone.View.extend( ...@@ -256,7 +258,7 @@ AppView = Backbone.View.extend(
Channels.fetch() Channels.fetch()
@centerIndicator() @centerIndicator()
@updateIndicator() @updateIndicator()
setInterval((=> @updateIndicator()), 60 * 60 * 1000 / HOUR_WIDTH) @listenTo(Clock, 'tick', @updateIndicator)
addChannels: -> addChannels: ->
@$('.channels > .channel').remove() @$('.channels > .channel').remove()
...@@ -320,5 +322,11 @@ Settings = new (Backbone.Model.extend( ...@@ -320,5 +322,11 @@ Settings = new (Backbone.Model.extend(
isFavouriteProgram: (title) -> isFavouriteProgram: (title) ->
_.contains(@get('favourite_programs'), title) _.contains(@get('favourite_programs'), title)
))() ))()
Clock = new (->
_.extend(@, Backbone.Events)
setInterval((=> @trigger('tick')), 60 * 60 * 1000 / HOUR_WIDTH)
)()
Channels = new ChannelList() Channels = new ChannelList()
App = new AppView() App = new AppView()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment