Revision 834
Added by Jean-Philippe Lang almost 18 years ago
trunk/app/controllers/documents_controller.rb | ||
---|---|---|
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 |
|
trunk/app/controllers/projects_controller.rb | ||
---|---|---|
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 | 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 |
trunk/app/models/mailer.rb | ||
---|---|---|
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 | 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 = url_for(:only_path => false, :host => Setting.host_name, :controller => 'projects', :action => 'list_files', :id => container.project_id)
|
|
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 = url_for(:only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => container.id)
|
|
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 |
trunk/app/views/mailer/attachments_add_bg.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> файл(а) добавени. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/attachments_add.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> files(s) added. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/attachments_add_de.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> files(s) added. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/attachments_add_fr.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> fichier(s) ajouté(s). |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/attachments_add_it.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> file aggiunti. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/attachments_add_ja.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> ファイルが追加されました。 |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/document_add_ja.rhtml | ||
---|---|---|
1 |
文書が <%= @document.project.name %> (<%= @document.category.name %>) に追加されました: |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/attachments_add_nl.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> bestand(en) toegevoegd. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/document_add_de.rhtml | ||
---|---|---|
1 |
Ein Dokument wurde hinzugefügt: <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/attachments_add_pl.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> plik(ów) dodane. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/attachments_add_pt.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> arquivo(s) adicionado. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/document_add_zh.rhtml | ||
---|---|---|
1 |
��һ���ĵ��ѱ����뵽��Ŀ�� <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/attachments_add_sv.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> fil(er) tillagda. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/document_add_pl.rhtml | ||
---|---|---|
1 |
Dokument został dodany do <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
http://<%= Setting.host_name %>/documents/show/<%= @document.id %> |
|
5 | 0 |
trunk/app/views/mailer/document_add_nl.rhtml | ||
---|---|---|
1 |
Een document is toegevoegd aan <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/document_add_pt.rhtml | ||
---|---|---|
1 |
Um documento foi adicionado no projeto <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/document_add_it.rhtml | ||
---|---|---|
1 |
Un documento e' stato aggiunto a <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/attachments_add_zh.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
??????<%= @attachments.size %> ???ļ?. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/document_add.rhtml | ||
---|---|---|
1 |
A document has been added to <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/attachments_add_pt-br.rhtml | ||
---|---|---|
1 |
<%= @added_to %> |
|
2 |
<%= @attachments.size %> arquivo(s) adicionado. |
|
3 |
<% @attachments.each do |attachment | %> |
|
4 |
- <%= attachment.filename %><% end %> |
|
5 | ||
6 |
<%= @url %> |
|
7 | 0 |
trunk/app/views/mailer/document_add_bg.rhtml | ||
---|---|---|
1 |
Добавен е документ в <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/document_add_pt-br.rhtml | ||
---|---|---|
1 |
Um documento foi adicionado no projeto <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/document_add_fr.rhtml | ||
---|---|---|
1 |
Un document a été ajouté à <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/document_add_sv.rhtml | ||
---|---|---|
1 |
Ett dokument har lagts till i <%= @document.project.name %> (<%= @document.category.name %>): |
|
2 |
<%= l(:field_title) %>: <%= @document.title %> |
|
3 | ||
4 |
<%= url_for :only_path => false, :host => Setting.host_name, :controller => 'documents', :action => 'show', :id => @document %> |
|
5 | 0 |
trunk/app/views/mailer/attachments_added.text.html.rhtml | ||
---|---|---|
1 |
<%= link_to @added_to, @url %><br /> |
|
2 | ||
3 |
<ul><% @attachments.each do |attachment | %> |
|
4 |
<li><%= attachment.filename %></li> |
|
5 |
<% end %></ul> |
|
0 | 6 |
trunk/app/views/mailer/attachments_added.text.plain.rhtml | ||
---|---|---|
1 |
<%= @added_to %><% @attachments.each do |attachment | %> |
|
2 |
- <%= attachment.filename %><% end %> |
|
3 | ||
4 |
<%= url_for @url %> |
|
0 | 5 |
trunk/app/views/mailer/document_added.text.html.rhtml | ||
---|---|---|
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 | 5 |
trunk/app/views/mailer/document_added.text.plain.rhtml | ||
---|---|---|
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 %> |
|
0 | 5 |
trunk/test/unit/mailer_test.rb | ||
---|---|---|
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 |
Also available in: Unified diff
Removed translated email templates attachments_added and document_added (no longer usefull).