@@ -0,0 +1,5 | |||
|
1 | <%= link_to @added_to, @url %><br /> | |
|
2 | ||
|
3 | <ul><% @attachments.each do |attachment | %> | |
|
4 | <li><%= attachment.filename %></li> | |
|
5 | <% end %></ul> |
@@ -0,0 +1,4 | |||
|
1 | <%= @added_to %><% @attachments.each do |attachment | %> | |
|
2 | - <%= attachment.filename %><% end %> | |
|
3 | ||
|
4 | <%= url_for @url %> |
@@ -0,0 +1,4 | |||
|
1 | <%= link_to @document.title, :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> | |
|
2 | (<%= @document.category.name %>)<br /> | |
|
3 | <br /> | |
|
4 | <%= textilizable(@document.description) %> |
@@ -0,0 +1,4 | |||
|
1 | <%= @document.title %> (<%= @document.category.name %>) | |
|
2 | <%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> | |
|
3 | ||
|
4 | <%= @document.description %> |
@@ -52,7 +52,7 class DocumentsController < ApplicationController | |||
|
52 | 52 | a = Attachment.create(:container => @document, :file => file, :author => logged_in_user) |
|
53 | 53 | @attachments << a unless a.new_record? |
|
54 | 54 | } if params[:attachments] and params[:attachments].is_a? Array |
|
55 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? && Setting.notified_events.include?('document_added') | |
|
55 | Mailer.deliver_attachments_added(@attachments) if !@attachments.empty? && Setting.notified_events.include?('document_added') | |
|
56 | 56 | redirect_to :action => 'show', :id => @document |
|
57 | 57 | end |
|
58 | 58 |
@@ -182,7 +182,7 class ProjectsController < ApplicationController | |||
|
182 | 182 | Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0 |
|
183 | 183 | } if params[:attachments] and params[:attachments].is_a? Array |
|
184 | 184 | flash[:notice] = l(:notice_successful_create) |
|
185 | Mailer.deliver_document_add(@document) if Setting.notified_events.include?('document_added') | |
|
185 | Mailer.deliver_document_added(@document) if Setting.notified_events.include?('document_added') | |
|
186 | 186 | redirect_to :action => 'list_documents', :id => @project |
|
187 | 187 | end |
|
188 | 188 | end |
@@ -449,7 +449,7 class ProjectsController < ApplicationController | |||
|
449 | 449 | a = Attachment.create(:container => @version, :file => file, :author => logged_in_user) |
|
450 | 450 | @attachments << a unless a.new_record? |
|
451 | 451 | } if params[:attachments] and params[:attachments].is_a? Array |
|
452 | Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? && Setting.notified_events.include?('file_added') | |
|
452 | Mailer.deliver_attachments_added(@attachments) if !@attachments.empty? && Setting.notified_events.include?('file_added') | |
|
453 | 453 | redirect_to :controller => 'projects', :action => 'list_files', :id => @project |
|
454 | 454 | end |
|
455 | 455 | @versions = @project.versions.sort |
@@ -60,7 +60,7 class Mailer < ActionMailer::Base | |||
|
60 | 60 | @body['journal']= journal |
|
61 | 61 | end |
|
62 | 62 | |
|
63 | def document_add(document) | |
|
63 | def document_added(document) | |
|
64 | 64 | set_language_if_valid(Setting.default_language) |
|
65 | 65 | @recipients = document.project.users.collect { |u| u.mail if u.mail_notification }.compact |
|
66 | 66 | @from = Setting.mail_from |
@@ -68,21 +68,18 class Mailer < ActionMailer::Base | |||
|
68 | 68 | @body['document'] = document |
|
69 | 69 | end |
|
70 | 70 | |
|
71 | def attachments_add(attachments) | |
|
71 | def attachments_added(attachments) | |
|
72 | 72 | set_language_if_valid(Setting.default_language) |
|
73 | 73 | container = attachments.first.container |
|
74 | 74 | url = '' |
|
75 | 75 | added_to = '' |
|
76 | 76 | case container.class.name |
|
77 | 77 | when 'Version' |
|
78 |
url = |
|
|
78 | url = {:only_path => false, :host => Setting.host_name, :controller => 'projects', :action => 'list_files', :id => container.project_id} | |
|
79 | 79 | added_to = "#{l(:label_version)}: #{container.name}" |
|
80 | 80 | when 'Document' |
|
81 |
url = |
|
|
81 | url = {:only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => container.id} | |
|
82 | 82 | added_to = "#{l(:label_document)}: #{container.title}" |
|
83 | when 'Issue' | |
|
84 | url = url = url_for(:only_path => false, :host => Setting.host_name, :controller => 'issues', :action => 'show', :id => container.id) | |
|
85 | added_to = "#{container.tracker.name} ##{container.id}: #{container.subject}" | |
|
86 | 83 | end |
|
87 | 84 | @recipients = container.project.users.collect { |u| u.mail if u.mail_notification }.compact |
|
88 | 85 | @from = Setting.mail_from |
@@ -41,7 +41,7 class MailerTest < Test::Unit::TestCase | |||
|
41 | 41 | document = Document.find(1) |
|
42 | 42 | GLoc.valid_languages.each do |lang| |
|
43 | 43 | Setting.default_language = lang.to_s |
|
44 | assert Mailer.deliver_document_add(document) | |
|
44 | assert Mailer.deliver_document_added(document) | |
|
45 | 45 | end |
|
46 | 46 | end |
|
47 | 47 |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now