// Generated by CoffeeScript 1.6.2
(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['marionette', 'vent', 'text!/tpl/NowPlayingView'], function(Marionette, vent, Template) {
    var NowPlayingView, _ref;

    NowPlayingView = (function(_super) {
      __extends(NowPlayingView, _super);

      function NowPlayingView() {
        _ref = NowPlayingView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      NowPlayingView.prototype.template = _.template(Template);

      NowPlayingView.prototype.className = "now-playing";

      NowPlayingView.prototype.events = {
        "click .now-playing-play": "doPlay",
        "click .now-playing-pause": "doPause"
      };

      NowPlayingView.prototype.initialize = function() {
        console.log("NowPlayingView: initialize");
        this.listenTo(vent, 'mix:play', this.mixPlay);
        this.listenTo(vent, 'mix:pause', this.mixPause);
        return true;
      };

      NowPlayingView.prototype.onRender = function() {
        this.mixPlay();
        return true;
      };

      NowPlayingView.prototype.mixPause = function(model) {
        console.log("NowPlayingView: mixPause");
        $('#now-playing-playing-toggle', this.el).toggleClass('now-playing-play', true).toggleClass('now-playing-pause', false);
        return true;
      };

      NowPlayingView.prototype.mixPlay = function(model) {
        console.log("NowPlayingView: mixPlay");
        $('#now-playing-playing-toggle', this.el).toggleClass('now-playing-play', false).toggleClass('now-playing-pause', true);
        return true;
      };

      NowPlayingView.prototype.doPlay = function() {
        console.log("NowPlayingView: doPlay");
        vent.trigger('mix:play', this.model);
        return true;
      };

      NowPlayingView.prototype.doPause = function() {
        console.log("NowPlayingView: doPause");
        vent.trigger('mix:pause', this.model);
        return true;
      };

      return NowPlayingView;

    })(Marionette.ItemView);
    return NowPlayingView;
  });

}).call(this);
