]> source.dussan.org Git - redmine.git/commitdiff
Add links to attachments in new issue email notification (#12293).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 17 May 2013 16:51:09 +0000 (16:51 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 17 May 2013 16:51:09 +0000 (16:51 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11853 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/views/layouts/mailer.html.erb
app/views/mailer/_issue.html.erb
app/views/mailer/_issue.text.erb
test/functional/issues_controller_test.rb

index b100fe75dcde30aaeea8e660bca7d02817e2f830..46003e69d8ffea30410e4db03c4c0c6229db2c14 100644 (file)
@@ -12,13 +12,14 @@ h2, h3 { font-size: 1.1em; }
 a, a:link, a:visited { color: #2A5685;}
 a:hover, a:active { color: #c61a1a; }
 a.wiki-anchor { display: none; }
+fieldset.attachments {border-width: 1px 0 0 0;}
 hr {
   width: 100%;
   height: 1px;
   background: #ccc;
   border: 0;
 }
-.footer {
+span.footer {
   font-size: 0.8em;
   font-style: italic;
 }
index 3d851d4428c99522fc9f322ee2393a8e8135eea8..829f8d5768299aabe85c6cbc9bbb9bef089ad0a2 100644 (file)
 </ul>
 
 <%= textilizable(issue, :description, :only_path => false) %>
+
+<% if issue.attachments.any? %>
+  <fieldset class="attachments"><legend><%= l(:label_attachment_plural) %></legend>
+  <% issue.attachments.each do |attachment| %>
+    <%= link_to_attachment attachment, :download => true, :only_path => false %>
+    (<%= number_to_human_size(attachment.filesize) %>)<br />
+  <% end %>
+  </fieldset>
+<% end %>
index 427b6a890be959b0cbceabb2ec77ac16a8e99ac4..55448804924a2c55cbbcca25d83194fe40705353 100644 (file)
 <% end -%>
 ----------------------------------------
 <%= issue.description %>
+
+<% if issue.attachments.any? -%>
+---<%= l(:label_attachment_plural).ljust(37, '-') %>
+<% issue.attachments.each do |attachment| -%>
+<%= attachment.filename %> (<%= number_to_human_size(attachment.filesize) %>)
+<% end -%>
+<% end -%>
index b0dc58634caee81d68535bd5a919889d6d13c68b..243ff83c9f6b15aa33cb09455571a59ac9d27375 100644 (file)
@@ -2159,6 +2159,25 @@ class IssuesControllerTest < ActionController::TestCase
     assert_equal 59, File.size(attachment.diskfile)
   end
 
+  def test_post_create_with_attachment_should_notify_with_attachments
+    ActionMailer::Base.deliveries.clear
+    set_tmp_attachments_directory
+    @request.session[:user_id] = 2
+
+    with_settings :host_name => 'mydomain.foo', :protocol => 'http' do
+      assert_difference 'Issue.count' do
+        post :create, :project_id => 1,
+          :issue => { :tracker_id => '1', :subject => 'With attachment' },
+          :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}}
+      end
+    end
+
+    assert_not_nil ActionMailer::Base.deliveries.last
+    assert_select_email do
+      assert_select 'a[href^=?]', 'http://mydomain.foo/attachments/download', 'testfile.txt'
+    end
+  end
+
   def test_post_create_with_failure_should_save_attachments
     set_tmp_attachments_directory
     @request.session[:user_id] = 2