mirror of
https://github.com/fergalmoran/dss.git
synced 2026-01-27 03:04:46 +00:00
49 lines
1.4 KiB
CoffeeScript
Executable File
49 lines
1.4 KiB
CoffeeScript
Executable File
define ['marionette', 'vent', 'text!/tpl/NowPlayingView'],
|
|
(Marionette, vent, Template) ->
|
|
|
|
class NowPlayingView extends Marionette.ItemView
|
|
template: _.template(Template)
|
|
className: "now-playing"
|
|
|
|
events: {
|
|
"click .now-playing-play": "doPlay",
|
|
"click .now-playing-pause": "doPause"
|
|
}
|
|
|
|
initialize: ->
|
|
console.log "NowPlayingView: initialize"
|
|
@listenTo(vent, 'mix:play', @mixPlay)
|
|
@listenTo(vent, 'mix:pause', @mixPause)
|
|
true
|
|
|
|
onRender: ->
|
|
@mixPlay()
|
|
true
|
|
|
|
mixPause: (model) ->
|
|
console.log "NowPlayingView: mixPause"
|
|
$('#now-playing-playing-toggle', @el)
|
|
.toggleClass('now-playing-play', true)
|
|
.toggleClass('now-playing-pause', false)
|
|
true
|
|
|
|
mixPlay: (model) ->
|
|
console.log "NowPlayingView: mixPlay"
|
|
$('#now-playing-playing-toggle', @el)
|
|
.toggleClass('now-playing-play', false)
|
|
.toggleClass('now-playing-pause', true)
|
|
true
|
|
|
|
doPlay: ->
|
|
console.log "NowPlayingView: doPlay"
|
|
vent.trigger('mix:play', @model)
|
|
true
|
|
|
|
doPause: ->
|
|
console.log "NowPlayingView: doPause"
|
|
vent.trigger('mix:pause', @model)
|
|
true
|
|
|
|
NowPlayingView
|
|
|