From 3689e304f0468efa6822153faaba8a5391a98869 Mon Sep 17 00:00:00 2001 From: Fergal Moran Date: Thu, 18 Jul 2013 21:43:24 +0100 Subject: [PATCH] Fixed incorrect object_url in ActivityFollow --- spa/models/activity.py | 2 +- static/js/app/lib/controller.coffee | 2 +- static/js/app/lib/controller.js | 2 +- static/js/app/views/mix/mixListLayout.coffee | 6 +++++- static/js/app/views/mix/mixListLayout.js | 9 +++++++-- static/js/app/views/widgets/mixTabHeaderView.coffee | 1 - 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/spa/models/activity.py b/spa/models/activity.py index e7be204..2357922 100755 --- a/spa/models/activity.py +++ b/spa/models/activity.py @@ -80,7 +80,7 @@ class ActivityFollow(Activity): return self.to_user.get_nice_name() def get_object_url(self): - return self.user.get_profile_url() + return self.to_user.get_profile_url() def get_object_singular(self): return "user" diff --git a/static/js/app/lib/controller.coffee b/static/js/app/lib/controller.coffee index c7dd649..66fb142 100755 --- a/static/js/app/lib/controller.coffee +++ b/static/js/app/lib/controller.coffee @@ -66,7 +66,7 @@ define ['app', 'marionette', 'vent', showUserDetail: (slug) -> console.log("Controller: showUserDetail") @_showMixList() - vent.trigger("mix:showlist", {order_by: 'latest', user: slug}) + vent.trigger("user:showdetail", {order_by: 'latest', user: slug}) showUserFavourites: (slug) -> console.log("Controller: showUserFavourites") diff --git a/static/js/app/lib/controller.js b/static/js/app/lib/controller.js index ff10d59..057be06 100755 --- a/static/js/app/lib/controller.js +++ b/static/js/app/lib/controller.js @@ -102,7 +102,7 @@ DssController.prototype.showUserDetail = function(slug) { console.log("Controller: showUserDetail"); this._showMixList(); - return vent.trigger("mix:showlist", { + return vent.trigger("user:showdetail", { order_by: 'latest', user: slug }); diff --git a/static/js/app/views/mix/mixListLayout.coffee b/static/js/app/views/mix/mixListLayout.coffee index 85a23fd..4cd52a9 100644 --- a/static/js/app/views/mix/mixListLayout.coffee +++ b/static/js/app/views/mix/mixListLayout.coffee @@ -10,12 +10,16 @@ define ['marionette', 'vent', 'views/widgets/mixTabHeaderView', 'views/mix/mixLi initialize: -> @listenTo(vent, "mix:showlist", @showMixList) + @listenTo(vent, "user:showdetail", @showUserView) onShow: -> @headerRegion.show(new MixTabHeaderView()) showMixList: (options)-> - console.log("Layout: showoing mixlist") + @bodyRegion.show(new MixListView(options)) + + showUserView: (options) -> + @headerRegion.close() @bodyRegion.show(new MixListView(options)) MixListRegionView \ No newline at end of file diff --git a/static/js/app/views/mix/mixListLayout.js b/static/js/app/views/mix/mixListLayout.js index a789233..bfa1f7e 100644 --- a/static/js/app/views/mix/mixListLayout.js +++ b/static/js/app/views/mix/mixListLayout.js @@ -21,7 +21,8 @@ }; MixListRegionView.prototype.initialize = function() { - return this.listenTo(vent, "mix:showlist", this.showMixList); + this.listenTo(vent, "mix:showlist", this.showMixList); + return this.listenTo(vent, "user:showdetail", this.showUserView); }; MixListRegionView.prototype.onShow = function() { @@ -29,7 +30,11 @@ }; MixListRegionView.prototype.showMixList = function(options) { - console.log("Layout: showoing mixlist"); + return this.bodyRegion.show(new MixListView(options)); + }; + + MixListRegionView.prototype.showUserView = function(options) { + this.headerRegion.close(); return this.bodyRegion.show(new MixListView(options)); }; diff --git a/static/js/app/views/widgets/mixTabHeaderView.coffee b/static/js/app/views/widgets/mixTabHeaderView.coffee index 4a397a0..aa6f3f7 100644 --- a/static/js/app/views/widgets/mixTabHeaderView.coffee +++ b/static/js/app/views/widgets/mixTabHeaderView.coffee @@ -11,5 +11,4 @@ define ['marionette', 'underscore', 'vent', 'text!/tpl/MixTabHeaderView'], $('#mix-tab li[id=li-' + options.order_by + ']', @el).addClass('active') true - MixTabHeaderView \ No newline at end of file