Make 'not sharing' a button, eliminate xss in alert

This commit is contained in:
Raphael 2011-01-26 11:26:14 -08:00
parent 7399caa066
commit f9fbb63ecb
3 changed files with 8 additions and 3 deletions

View file

@ -71,7 +71,7 @@ class Person < ActiveRecord::Base
).order("contacts.user_id DESC", "requests.recipient_id DESC", "profiles.last_name ASC", "profiles.first_name ASC") ).order("contacts.user_id DESC", "requests.recipient_id DESC", "profiles.last_name ASC", "profiles.first_name ASC")
end end
def name def name(opts = {})
@name ||= if profile.first_name.nil? || profile.first_name.blank? @name ||= if profile.first_name.nil? || profile.first_name.blank?
self.diaspora_handle self.diaspora_handle
else else

View file

@ -25,7 +25,12 @@
.aspects .aspects
- if !contact - if !contact
%h4 %h4
= t('people.show.not_connected', :name => person.first_name) = link_to truncate(t('people.show.not_connected', :name => person.name), :length => 49, :separator => ' ', :omission => ''),
{:controller => "people",
:action => "share_with",
:id => @person.id},
:class => 'share_with button',
:rel => 'facebox'
- elsif contact.pending - elsif contact.pending
%h4 %h4
= t('people.person.pending_request') = t('people.person.pending_request')

View file

@ -9,7 +9,7 @@
$(this).closest('li').fadeOut(200); $(this).closest('li').fadeOut(200);
}); });
$('.delete').bind('ajax:failure', function() { $('.delete').bind('ajax:failure', function() {
alert(h("#{t('.cannot_remove', :name => person.name)}")); alert("#{h(t('.cannot_remove', :name => person.name))}");
}); });
}); });