воскресенье, 22 января 2012 г.

redmine эмайл увидомления с приложениями

Патч добавляющий в тело эмайла ссылки на приложения к задачи
http://pastebin.com/p0Esq3iP
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index ff434d8..0a7e69a 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -116,6 +116,11 @@ class Attachment < ActiveRecord::Base
   def deletable?(user=User.current)
     container.attachments_deletable?(user)
   end
+  
+  # my fix for email attachment
+  def to_s
+        self.filename
+  end
 
   def image?
     self.filename =~ /\.(jpe?g|gif|png)$/i
diff --git a/app/views/mailer/_issue_text_html.rhtml b/app/views/mailer/_issue_text_html.rhtml
index 3d851d4..06f0aec 100644
--- a/app/views/mailer/_issue_text_html.rhtml
+++ b/app/views/mailer/_issue_text_html.rhtml
@@ -7,6 +7,16 @@
 <li><%=l(:field_assigned_to)%>: <%=h issue.assigned_to %></li>
 <li><%=l(:field_category)%>: <%=h issue.category %></li>
 <li><%=l(:field_fixed_version)%>: <%=h issue.fixed_version %></li>
+<% if issue.attachments.size > 0 %>
+    <li>
+        <ul>
+           <%=l(:label_attachment)%>: 
+           <% issue.attachments.each do | c | %>
+               <li> <%= link_to(c.to_s(), "http://redmine.tnt.it-solutions.cz/attachments/"+ c.id.to_s() + "/" + c.to_s() ) %> </li>
+        <% end %>
+        </ul>
+    </li>
+<% end %>
 <% issue.custom_field_values.each do |c| %>
   <li><%=h c.custom_field.name %>: <%=h show_value(c) %></li>
 <% end %>
diff --git a/app/views/mailer/_issue_text_plain.rhtml b/app/views/mailer/_issue_text_plain.rhtml
index bea2a58..5e49b99 100644
--- a/app/views/mailer/_issue_text_plain.rhtml
+++ b/app/views/mailer/_issue_text_plain.rhtml
@@ -7,6 +7,7 @@
 <%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
 <%=l(:field_category)%>: <%= issue.category %>
 <%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
+<% if issue.attachments.size > 0 %><%=l(:label_attachment)%>: <%= issue.attachments.join(", ") %><% end %>
 <% issue.custom_field_values.each do |c| %><%= c.custom_field.name %>: <%= show_value(c) %>
 <% end %>

Комментариев нет:

Отправить комментарий