Modified: branches/event_logging/app/helpers/application_helper.rb (1936 => 1937)
--- branches/event_logging/app/helpers/application_helper.rb 2008-11-10 15:01:11 UTC (rev 1936)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-11-10 16:43:19 UTC (rev 1937)
@@ -101,7 +101,7 @@
return link_to(user.openid_url, user.openid_url)
end
- def name(user_id, truncate_to=nil)
+ def name(user_id, truncate_to=nil, set_tooltip=true)
if user_id.kind_of? Fixnum
user = User.find(:first, :select => "id, name", :conditions => ["id = ?", user_id])
return nil unless user
@@ -112,8 +112,9 @@
end
name = truncate_to ? truncate(user.name, truncate_to) : name = user.name
+ title_param = (set_tooltip ? tooltip_title_attrib(h(user.name)) : nil)
- return link_to(h(name), user_url(user), :title => tooltip_title_attrib(h(user.name)))
+ return link_to(h(name), user_url(user), :title => title_param)
end
def title(network_id, truncate_to=nil)
@@ -1661,7 +1662,7 @@
culprit = User.find(:first, :select => "id, name", :conditions => ["id = ?", log_entry.culprit_id])
return nil if culprit.nil?
- culprit_link = name(culprit)
+ culprit_link = name(culprit, nil, false)
my_event = (log_entry.culprit_id == current_viewer_id)
rescue ActiveRecord::RecordNotFound
# culprit wasn't found - skip this news entry
@@ -1811,27 +1812,27 @@
if authorized
case action
when "invite"
- rtn << [timestamp, "#{name(network_admin)} <span class='news_feed_action'>invited</span> #{name(user)} to join the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(network_admin, nil, false)} <span class='news_feed_action'>invited</span> #{name(user, nil, false)} to join the #{title(network)} Group."]
when "request"
- rtn << [timestamp, "#{name(user)} <span class='news_feed_action'>requested</span> to join the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(user, nil, false)} <span class='news_feed_action'>requested</span> to join the #{title(network)} Group."]
when "accept"
# even though it can be the admin who accepted the membership request,
# news item says that the "user" has joined the group - so it's not
# acceptable to show this event on the group admin's profile page
return nil if (contributor_news_only && contributor.id == network_admin.id)
- rtn << [timestamp, "#{name(user)} <span class='news_feed_action'>joined</span> the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(user, nil, false)} <span class='news_feed_action'>joined</span> the #{title(network)} Group."]
when "reject"
if log_entry.culprit_type == "User"
- rtn << [timestamp, "#{name(user)} <span class='news_feed_action'>rejected</span> invitation to join the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(user, nil, false)} <span class='news_feed_action'>rejected</span> invitation to join the #{title(network)} Group."]
else
- rtn << [timestamp, "#{name(network_admin)} <span class='news_feed_action'>rejected</span> #{name(user)}'s request to join the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(network_admin, nil, false)} <span class='news_feed_action'>rejected</span> #{name(user, nil, false)}'s request to join the #{title(network)} Group."]
end
when "destroy"
if log_entry.culprit_type == "User"
- rtn << [timestamp, "#{name(user)} has <span class='news_feed_action'>left</span> the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(user, nil, false)} has <span class='news_feed_action'>left</span> the #{title(network)} Group."]
else
- rtn << [timestamp, "#{name(network_admin)} <span class='news_feed_action'>removed</span> #{name(user)} from the list of members of the #{title(network)} Group."]
+ rtn << [timestamp, "#{name(network_admin, nil, false)} <span class='news_feed_action'>removed</span> #{name(user, nil, false)} from the list of members of the #{title(network)} Group."]
end
end
else
@@ -1864,13 +1865,13 @@
if authorized
case action
when "create"
- rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>requested</span> friendship with #{name(referenced_user)}."]
+ rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>requested</span> friendship with #{name(referenced_user, nil, false)}."]
when "accept"
- rtn << [timestamp, "#{culprit_link} and #{name(referenced_user)} <span class='news_feed_action'>became friends</span>."]
+ rtn << [timestamp, "#{culprit_link} and #{name(referenced_user, nil, false)} <span class='news_feed_action'>became friends</span>."]
when "reject"
- rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>rejected</span> a friendship request from #{name(referenced_user)}."]
+ rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>rejected</span> a friendship request from #{name(referenced_user, nil, false)}."]
when "destroy"
- rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>removed</span> #{name(referenced_user)} from their friends list."]
+ rtn << [timestamp, "#{culprit_link} <span class='news_feed_action'>removed</span> #{name(referenced_user, nil, false)} from their friends list."]
end
else
return nil
@@ -2079,7 +2080,7 @@
else
case log_entry.referenced_type
when "User"
- credited_whom = name(log_entry.referenced_id)
+ credited_whom = name(log_entry.referenced_id, nil, false)
return nil if credited_whom.nil?
when "Network"
network_title = title(log_entry.referenced_id)
@@ -2185,7 +2186,7 @@
when "activate"
# anyone can see new users joining myExperiment - just need to check that user still exists
# (if "name()" helper returns NIL -> user not found)
- user_link = name(log_entry.activity_loggable_id)
+ user_link = name(log_entry.activity_loggable_id, nil, false)
return nil if user_link.nil?
rtn << [timestamp, "#{user_link} <span class='news_feed_action'>joined</span> #{link_to "myExperiment", "/"}."]
@@ -2195,7 +2196,7 @@
# which triggers this event
# DISABLED FRAGMENT
#if log_entry.activity_loggable_id == current_viewer_id
- # rtn << [timestamp, "#{name(log_entry.activity_loggable_id)} updated their #{link_to "account", user_path(log_entry.activity_loggable_id)} settings."]
+ # rtn << [timestamp, "#{name(log_entry.activity_loggable_id, nil, false)} updated their #{link_to "account", user_path(log_entry.activity_loggable_id)} settings."]
#end
# END OF DISABLED FRAGMENT
end