From f9fbb63ecbda5f25a96bca8f2890d98b1f12b2e2 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 26 Jan 2011 11:26:14 -0800 Subject: [PATCH] Make 'not sharing' a button, eliminate xss in alert --- app/models/person.rb | 2 +- app/views/people/_aspect_list.haml | 7 ++++++- app/views/people/_profile_sidebar.html.haml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index 2b31e6eb8..d7e67fe49 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -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") end - def name + def name(opts = {}) @name ||= if profile.first_name.nil? || profile.first_name.blank? self.diaspora_handle else diff --git a/app/views/people/_aspect_list.haml b/app/views/people/_aspect_list.haml index 5bf170336..ffbdb61b1 100644 --- a/app/views/people/_aspect_list.haml +++ b/app/views/people/_aspect_list.haml @@ -25,7 +25,12 @@ .aspects - if !contact %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 %h4 = t('people.person.pending_request') diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 01637470a..bcefdf668 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -9,7 +9,7 @@ $(this).closest('li').fadeOut(200); }); $('.delete').bind('ajax:failure', function() { - alert(h("#{t('.cannot_remove', :name => person.name)}")); + alert("#{h(t('.cannot_remove', :name => person.name))}"); }); });