From 416a77f37736262145bee4bcacd2becd210ca6c1 Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Sun, 16 Jun 2013 10:29:34 +0100 Subject: [PATCH] Fixed mix nav pills not selecting --- static/js/app/dss.bootstrapper.js | 2 +- static/js/app/views/mix/mixListView.coffee | 10 +++------- static/js/app/views/mix/mixListView.js | 13 +++++-------- templates/views/MixListView.html | 10 +++++----- 4 files changed, 14 insertions(+), 21 deletions(-) diff --git a/static/js/app/dss.bootstrapper.js b/static/js/app/dss.bootstrapper.js index db7cbdd..2e61af9 100644 --- a/static/js/app/dss.bootstrapper.js +++ b/static/js/app/dss.bootstrapper.js @@ -1,6 +1,6 @@ requirejs.config({ baseUrl: "static/js", - urlArgs: "bust="+ (new Date()).getTime(), + //urlArgs: "bust="+ (new Date()).getTime(), waitSeconds: 200, paths: { jquery: 'libs/jquery', diff --git a/static/js/app/views/mix/mixListView.coffee b/static/js/app/views/mix/mixListView.coffee index 45e8015..48a17e5 100644 --- a/static/js/app/views/mix/mixListView.coffee +++ b/static/js/app/views/mix/mixListView.coffee @@ -9,14 +9,14 @@ define ['marionette', 'vent', 'models/mix/mixCollection', 'views/mix/mixItemView currentMix = -1 - initialize: -> + initialize: => console.log "MixListView: initialize" @collection = new MixCollection() @collection.fetch( data: @options success: => console.log("MixListView: Collection fetched") - @tabChanged('latest') + @tabChanged(@options.order_by) @listenTo(vent, 'mix:play', @mixPlay) true ) @@ -32,13 +32,9 @@ define ['marionette', 'vent', 'models/mix/mixCollection', 'views/mix/mixItemView currentMix = model.cid return - onRender: -> - $('#li-' + @options.type, @el).addClass('active') - true - tabChanged: (type) -> console.log("MixListView: tab changed") - $('#mix-tab a#' + type, @el).tab('show') + $('#mix-tab li[id=li-' + type + ']', @el).addClass('active') true MixListView diff --git a/static/js/app/views/mix/mixListView.js b/static/js/app/views/mix/mixListView.js index 73ced97..8cf2862 100644 --- a/static/js/app/views/mix/mixListView.js +++ b/static/js/app/views/mix/mixListView.js @@ -1,6 +1,7 @@ // Generated by CoffeeScript 1.3.3 (function() { - var __hasProp = {}.hasOwnProperty, + var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __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', 'models/mix/mixCollection', 'views/mix/mixItemView', 'text!/tpl/MixListView'], function(Marionette, vent, MixCollection, MixItemView, Template) { @@ -11,6 +12,7 @@ __extends(MixListView, _super); function MixListView() { + this.initialize = __bind(this.initialize, this); return MixListView.__super__.constructor.apply(this, arguments); } @@ -32,7 +34,7 @@ data: this.options, success: function() { console.log("MixListView: Collection fetched"); - _this.tabChanged('latest'); + _this.tabChanged(_this.options.order_by); _this.listenTo(vent, 'mix:play', _this.mixPlay); return true; } @@ -46,14 +48,9 @@ currentMix = model.cid; }; - MixListView.prototype.onRender = function() { - $('#li-' + this.options.type, this.el).addClass('active'); - return true; - }; - MixListView.prototype.tabChanged = function(type) { console.log("MixListView: tab changed"); - $('#mix-tab a#' + type, this.el).tab('show'); + $('#mix-tab li[id=li-' + type + ']', this.el).addClass('active'); return true; }; diff --git a/templates/views/MixListView.html b/templates/views/MixListView.html index fa85261..edfafba 100644 --- a/templates/views/MixListView.html +++ b/templates/views/MixListView.html @@ -1,9 +1,9 @@