Commit b1f0622e3f9761c4a9015e06f005b58ad4fc6349

Authored by Evandro Junior
1 parent a40bfcc8
Exists in master

Code cleaned

controllers/email_article_plugin_myprofile_controller.rb
1 1 class EmailArticlePluginMyprofileController < MyProfileController
2   -
3 2  
4 3 needs_profile
5   -# before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add]
6   -# before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail]
7   -# before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail]
8 4  
9 5 def send_email
10 6 if user.is_admin?(profile)
... ... @@ -15,7 +11,6 @@ class EmailArticlePluginMyprofileController &lt; MyProfileController
15 11 end
16 12  
17 13 class Sender < ActionMailer::Base
18   - add_template_helper(PersonNotifierHelper)
19 14 def mail(article)
20 15 members = article.profile.members
21 16 emails = []
... ... @@ -29,24 +24,20 @@ class EmailArticlePluginMyprofileController &lt; MyProfileController
29 24 subject "[Artigo] " + article.title
30 25 body set_absolute_path(article.body, article.environment)
31 26 end
32   -
33   - def set_absolute_path(body, environment)
34   - parsed = Hpricot(body.to_s)
35   - parsed.search('img[@src]').map { |i| change_element_path(i, 'src', environment) }
36   - parsed.search('a[@href]').map { |i| change_element_path(i, 'href', environment) }
37   - parsed.to_s
38   - end
39 27  
40   - def change_element_path(el, attribute, environment)
41   - fullpath = /^http/.match(el[attribute])
42   - if not fullpath
43   - relative_path = /\/?(.*)/.match(el[attribute])
44   - el[attribute] = "http://#{environment.default_hostname}/#{relative_path[1]}"
  28 + def set_absolute_path(body, environment)
  29 + parsed = Hpricot(body.to_s)
  30 + parsed.search('img[@src]').map { |i| change_element_path(i, 'src', environment) }
  31 + parsed.search('a[@href]').map { |i| change_element_path(i, 'href', environment) }
  32 + parsed.to_s
45 33 end
46   - end
47 34  
48   -
  35 + def change_element_path(el, attribute, environment)
  36 + fullpath = /^http/.match(el[attribute])
  37 + if not fullpath
  38 + relative_path = /\/?(.*)/.match(el[attribute])
  39 + el[attribute] = "http://#{environment.default_hostname}/#{relative_path[1]}"
  40 + end
  41 + end
49 42 end
50   -
51   -
52 43 end
53 44 \ No newline at end of file
... ...