diff --git a/controllers/email_article_plugin_myprofile_controller.rb b/controllers/email_article_plugin_myprofile_controller.rb index 37350fc..c606668 100644 --- a/controllers/email_article_plugin_myprofile_controller.rb +++ b/controllers/email_article_plugin_myprofile_controller.rb @@ -4,19 +4,19 @@ class EmailArticlePluginMyprofileController < MyProfileController # before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add] # before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail] # 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] - + def send_email article = Article.find(params[:id]) EmailArticlePluginMyprofileController::Sender.deliver_mail(article) render :text=>'ok' end - + class Sender < ActionMailer::Base def mail(article) members = article.profile.members emails = [] members.each{ |m| - emails.push(m.user.email) + emails.push(m.user.email) } content_type 'text/html' recipients emails @@ -25,6 +25,5 @@ class EmailArticlePluginMyprofileController < MyProfileController subject "[Artigo] " + article.title body article.body end - end -end - + end +end \ No newline at end of file diff --git a/lib/email_article_plugin.rb b/lib/email_article_plugin.rb index c60aaab..9fae3a0 100644 --- a/lib/email_article_plugin.rb +++ b/lib/email_article_plugin.rb @@ -12,9 +12,9 @@ class EmailArticlePlugin < Noosfero::Plugin label = _("Send article to members") htmlclass = _("button with-text icon-menu-mail") title = _("Email article to all community members") - lambda { + lambda { link_to_remote( - label, + label, { :url => { :controller => 'email_article_plugin_myprofile', :action => "send_email", :id => @page}, :method => :get, @@ -22,12 +22,12 @@ class EmailArticlePlugin < Noosfero::Plugin :failure => "alert('Erro ao enviar email')", :confirm => _("Are you sure you want to email this article to the all community members?"), }, - :class => htmlclass, + :class => htmlclass, :title => title ) } end - + def stylesheet? true end diff --git a/test/unit/email_article_plugin_test.rb b/test/unit/email_article_plugin_test.rb index b23b9e6..f5d94eb 100644 --- a/test/unit/email_article_plugin_test.rb +++ b/test/unit/email_article_plugin_test.rb @@ -17,5 +17,5 @@ class EmailArticlePluginTest < ActiveSupport::TestCase should 'have description' do assert_equal _("A plugin that lists the most accessed, most commented, most liked and most disliked contents."), EmailArticlePlugin.plugin_description end - + end -- libgit2 0.21.2