Fix hovercard conflict with vanity urls

This commit is contained in:
Raphael Sofaer 2011-08-01 18:22:29 -07:00
parent d7ac6c4713
commit a469f09c01
3 changed files with 7 additions and 6 deletions

View file

@ -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?
"<a href='/u/#{person.diaspora_handle.split('@')[0]}' class='#{opts[:class]}'>
"<a data-hovercard='#{remote_or_hovercard_link}' href='/u/#{person.diaspora_handle.split('@')[0]}' class='#{opts[:class]}'>
#{h(person.name)}
</a>".html_safe
else
"<a href='/people/#{person.id}'>
"<a href='#{remote_or_hovercard_link}' data-hovercard='#{remote_or_hovercard_link}'>
#{h(person.name)}
</a>".html_safe
end

View file

@ -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'

View file

@ -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);
});