Commit 05d537e3590b3ce92baec5d0a6a977f4198bebe5

Authored by tallys
Committed by Tallys Martins
1 parent 6ef3eef0

Inserted message body into Work Assignment email notification

TODO Refactor send_email method on Work Assignment Cms controller

Signed-off-by: Hebert Douglas <hebertdougl@gmail.com>
Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
plugins/work_assignment/controllers/myprofile/work_assignment_plugin_cms_controller.rb
... ... @@ -92,4 +92,29 @@ class WorkAssignmentPluginCmsController &lt; CmsController
92 92 redirect_to referer
93 93 end
94 94 end
  95 +
  96 +#TODO
  97 +#Refatorar o método send_email para utilizar o build_mail_message para inserir o link dos arquivos
  98 +=begin
  99 + def build_mail_message
  100 + @files_paths = []
  101 + @files_string = params[:self_files_id]
  102 + @files_id_list = @files_string.split(' ')
  103 +
  104 + @files_id_list.each do |file_id|
  105 + @file = environment.articles.find_by_id(file_id)
  106 + @real_file_url = "http://#{@file.url[:host]}:#{@file.url[:port]}/#{@file.url[:profile]}/#{@file.path}"
  107 + @files_paths << @real_file_url
  108 + unless params[:email_contact][:message].include? "#{@real_file_url}"
  109 + params[:email_contact][:message] += "<br> Clique <a href='#{@real_file_url}'>aqui</a> para acessar o arquivo ou acesse pela URL: <br>"
  110 + params[:email_contact][:message] += "<br><a href='#{@real_file_url}'>#{@real_file_url}</a>"
  111 + end
  112 + end
  113 + @message = "AVISO: O aluno deve imprimir este email e entrega-lo na secretaria como comprovante do envio!"
  114 + unless params[:email_contact][:message].include? "#{@message}"
  115 + params[:email_contact][:message] += "<br><br>#{@message}"
  116 + end
  117 + end
  118 +=end
  119 +
95 120 end
96 121 \ No newline at end of file
... ...
plugins/work_assignment/lib/ext/email_contact.rb
... ... @@ -40,6 +40,7 @@ class EmailContact
40 40 to: email_contact.reciever,
41 41 reply_to: email_contact.email,
42 42 subject: email_contact.subject,
  43 + message: email_contact.message,
43 44 from: "#{email_contact.name} <#{email_contact.email}>"
44 45 }
45 46  
... ...
plugins/work_assignment/lib/work_assignment_plugin.rb
... ... @@ -50,6 +50,7 @@ class WorkAssignmentPlugin &lt; Noosfero::Plugin
50 50 :options => {:only => 'view_page'},
51 51 :block => block }
52 52 end
  53 +
53 54  
54 55 def upload_files_extra_contents
55 56 proc do
... ...
plugins/work_assignment/views/work_assignment_plugin_cms/_work_assignment_form.html.erb
1 1 <% form_for('uploaded_file', :url => { :controller => 'work_assignment_plugin_cms', :action => 'upload_files' }, :html => {:multipart => true}) do |f| %>
2 2 <%= render :partial => 'notify_checkbox', :locals => { :size => '45'} %>
3 3 <%= render :partial => 'upload_file_form', :locals => { :size => '45'} %>
4   - x
  4 +
5 5 <% end %>
6 6 \ No newline at end of file
... ...