From a469f09c0140df2585a5ac5c69dcad6c39be4f29 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Mon, 1 Aug 2011 18:22:29 -0700 Subject: [PATCH] Fix hovercard conflict with vanity urls --- app/helpers/application_helper.rb | 5 +++-- config/routes.rb | 4 ++-- public/javascripts/widgets/hovercard.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ab99b20a7..a981dc89c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -48,12 +48,13 @@ module ApplicationHelper def person_link(person, opts={}) opts[:class] ||= "" opts[:class] << " self" if defined?(user_signed_in?) && user_signed_in? && current_user.person == person + remote_or_hovercard_link = "/people/#{person.id}".html_safe if person.local? - " + " #{h(person.name)} ".html_safe else - " + " #{h(person.name)} ".html_safe end diff --git a/config/routes.rb b/config/routes.rb index 48ed744b7..8a693de36 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -83,7 +83,7 @@ Diaspora::Application.routes.draw do :invitations => "invitations"} do get 'invitations/resend/:id' => 'invitations#resend', :as => 'invitation_resend' end - + get 'login' => redirect('/users/sign_in') scope 'admins', :controller => :admins do @@ -112,6 +112,7 @@ Diaspora::Application.routes.draw do get :tag_index end end + get '/u/:username' => 'people#show', :as => 'user_profile' # Federation @@ -155,7 +156,6 @@ Diaspora::Application.routes.draw do get 'mobile/toggle', :to => 'home#toggle_mobile', :as => 'toggle_mobile' - get '/u/:username' => 'people#show', :as => 'user_profile' # Startpage root :to => 'home#show' diff --git a/public/javascripts/widgets/hovercard.js b/public/javascripts/widgets/hovercard.js index 21664aa99..9540cfe1f 100644 --- a/public/javascripts/widgets/hovercard.js +++ b/public/javascripts/widgets/hovercard.js @@ -52,7 +52,7 @@ self.hoverCard.tip.hide(); self.hoverCard.tip.prependTo(self.target.parent()); - self.personCache.get(self.target.attr("href") + ".json?includes=tags", function(person) { + self.personCache.get(self.target.attr("data-hovercard") + ".json?includes=tags", function(person) { self.populateHovercard(person); }); }; @@ -78,7 +78,7 @@ ); }); - self.dropdownCache.get(self.target.attr("href") + "/aspect_membership_button", function(dropdown) { + self.dropdownCache.get(self.target.attr("data-hovercard") + "/aspect_membership_button", function(dropdown) { self.hoverCard.dropdownContainer.html(dropdown); self.hoverCard.tip.fadeIn(140); });