Commit 4d9c1b3f7b266854745129b202a6a29294ec2336

Authored by Victor Costa
1 parent 159de064

rails3: fix action_tracker

- Change from returning to tap;
- Change from lambda to proc;
- Fix broken links.
app/views/profile/_join_community.html.erb
1 -_add_member_in_community.rhtml  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +_add_member_in_community.html.erb
3 \ No newline at end of file 3 \ No newline at end of file
app/views/profile/_leave_scrap_to_self.html.erb
1 -_leave_scrap.rhtml  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +_leave_scrap.html.erb
3 \ No newline at end of file 3 \ No newline at end of file
app/views/profile/_new_friendship.html.erb
1 -_add_member_in_community.rhtml  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +_add_member_in_community.html.erb
3 \ No newline at end of file 3 \ No newline at end of file
app/views/profile/_reply_scrap_on_self.rhtml
1 -_leave_scrap.rhtml  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +_leave_scrap.html.erb
3 \ No newline at end of file 3 \ No newline at end of file
config/initializers/action_tracker.rb
@@ -2,30 +2,30 @@ require 'noosfero/i18n' @@ -2,30 +2,30 @@ require 'noosfero/i18n'
2 2
3 # ActionTracker plugin stuff 3 # ActionTracker plugin stuff
4 4
5 -@reply_scrap_description = lambda { _('sent a message to %{receiver}: <br /> "%{message}"') % { :receiver => "{{link_to(ta.get_receiver_name, ta.get_receiver_url)}}", :message => "{{auto_link_urls(ta.get_content)}}" } } 5 +@reply_scrap_description = proc { _('sent a message to %{receiver}: <br /> "%{message}"') % { :receiver => "{{link_to(ta.get_receiver_name, ta.get_receiver_url)}}", :message => "{{auto_link_urls(ta.get_content)}}" } }
6 6
7 ActionTrackerConfig.verbs = { 7 ActionTrackerConfig.verbs = {
8 8
9 :create_article => { 9 :create_article => {
10 - :description => lambda { _('published an article: %{title}') % { :title => '{{link_to(truncate(ta.get_name), ta.get_url)}}' } } 10 + :description => proc { _('published an article: %{title}') % { :title => '{{link_to(truncate(ta.get_name), ta.get_url)}}' } }
11 }, 11 },
12 12
13 :new_friendship => { 13 :new_friendship => {
14 - :description => lambda { n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', get_friend_name.size) % { :num => get_friend_name.size, :name => '{{ta.collect_group_with_index(:friend_name){ |n,i| link_to(image_tag(ta.get_friend_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")), ta.get_friend_url[i], :title => n)}.join}}' } }, 14 + :description => proc { n_('has made 1 new friend:<br />%{name}', 'has made %{num} new friends:<br />%{name}', get_friend_name.size) % { :num => get_friend_name.size, :name => '{{ta.collect_group_with_index(:friend_name){ |n,i| link_to(image_tag(ta.get_friend_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")), ta.get_friend_url[i], :title => n)}.join}}' } },
15 :type => :groupable 15 :type => :groupable
16 }, 16 },
17 17
18 :join_community => { 18 :join_community => {
19 - :description => lambda { n_('has joined 1 community:<br />%{name}', 'has joined %{num} communities:<br />%{name}', get_resource_name.size) % { :num => get_resource_name.size, :name => '{{ta.collect_group_with_index(:resource_name){ |n,i| link_to(image_tag(ta.get_resource_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/community-icon.png")), ta.get_resource_url[i], :title => n)}.join}}' } }, 19 + :description => proc { n_('has joined 1 community:<br />%{name}', 'has joined %{num} communities:<br />%{name}', get_resource_name.size) % { :num => get_resource_name.size, :name => '{{ta.collect_group_with_index(:resource_name){ |n,i| link_to(image_tag(ta.get_resource_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/community-icon.png")), ta.get_resource_url[i], :title => n)}.join}}' } },
20 :type => :groupable 20 :type => :groupable
21 }, 21 },
22 22
23 :add_member_in_community => { 23 :add_member_in_community => {
24 - :description => lambda { _('has joined the community.') }, 24 + :description => proc { _('has joined the community.') },
25 }, 25 },
26 26
27 :upload_image => { 27 :upload_image => {
28 - :description => lambda do 28 + :description => proc do
29 total = get_view_url.size 29 total = get_view_url.size
30 n_('uploaded 1 image', 'uploaded %d images', total) % total + 30 n_('uploaded 1 image', 'uploaded %d images', total) % total +
31 '<br />{{'+ 31 '<br />{{'+
@@ -55,7 +55,7 @@ ActionTrackerConfig.verbs = { @@ -55,7 +55,7 @@ ActionTrackerConfig.verbs = {
55 }, 55 },
56 56
57 :leave_scrap_to_self => { 57 :leave_scrap_to_self => {
58 - :description => lambda { _('wrote: <br /> "%{text}"') % { :text => "{{auto_link_urls(ta.get_content)}}" } } 58 + :description => proc { _('wrote: <br /> "%{text}"') % { :text => "{{auto_link_urls(ta.get_content)}}" } }
59 }, 59 },
60 60
61 :reply_scrap_on_self => { 61 :reply_scrap_on_self => {
vendor/plugins/action_tracker/lib/action_tracker.rb
@@ -124,7 +124,7 @@ module ActionTracker @@ -124,7 +124,7 @@ module ActionTracker
124 124
125 module ViewHelper 125 module ViewHelper
126 def describe(ta) 126 def describe(ta)
127 - returning "" do |result| 127 + "".tap do |result|
128 if ta.is_a?(ActionTracker::Record) 128 if ta.is_a?(ActionTracker::Record)
129 result << ta.description.gsub(/\{\{(.*?)\}\}/) { eval $1 } 129 result << ta.description.gsub(/\{\{(.*?)\}\}/) { eval $1 }
130 else 130 else