improvements_to_email_notifications.patch

Marius BALTEANU, 2016-10-04 00:13

Download (2.44 KB)

View differences:

app/helpers/issues_helper.rb
263 263
    users
264 264
  end
265 265

  
266
  def email_issue_attributes(issue, user)
266
  def email_issue_attributes(issue, user, html)
267 267
    items = []
268 268
    %w(author status priority assigned_to category fixed_version).each do |attribute|
269 269
      unless issue.disabled_core_fields.include?(attribute+"_id")
270
        items << "#{l("field_#{attribute}")}: #{issue.send attribute}"
270
        if html
271
          items << content_tag('strong', "#{l("field_#{attribute}")}: ") + (issue.send attribute)
272
        else
273
          items << "#{l("field_#{attribute}")}: #{issue.send attribute}"
274
        end
271 275
      end
272 276
    end
273 277
    issue.visible_custom_field_values(user).each do |value|
274
      items << "#{value.custom_field.name}: #{show_value(value, false)}"
278
      if html
279
        items << content_tag('strong', "#{value.custom_field.name}: ") + show_value(value, false)
280
      else
281
        items << "#{value.custom_field.name}: #{show_value(value, false)}"
282
      end
275 283
    end
276 284
    items
277 285
  end
278 286

  
279 287
  def render_email_issue_attributes(issue, user, html=false)
280
    items = email_issue_attributes(issue, user)
288
    items = email_issue_attributes(issue, user, html)
281 289
    if html
282
      content_tag('ul', items.map{|s| content_tag('li', s)}.join("\n").html_safe)
290
      content_tag('ul', items.map{|s| content_tag('li', s)}.join("\n").html_safe, :class => "details")
283 291
    else
284 292
      items.map{|s| "* #{s}"}.join("\n")
285 293
    end
app/views/layouts/mailer.html.erb
38 38
  overflow-x: auto;
39 39
  overflow-y: hidden;
40 40
}
41
ul.details {color:#959595; margin-bottom: 1.5em;}
41 42
</style>
42 43
</head>
43 44
<body>
app/views/mailer/issue_edit.html.erb
2 2
  (<%= l(:field_private_notes) %>)
3 3
<% end %>
4 4
<%= l(:text_issue_updated, :id => link_to("##{@issue.id}", @issue_url), :author => h(@journal.user)).html_safe %>
5
<hr />
5 6

  
6
<ul>
7
<ul class="details">
7 8
<% details_to_strings(@journal_details, false, :only_path => false).each do |string| %>
8 9
  <li><%= string %></li>
9 10
<% end %>