Commit 8b89ef8639b2b6ee69d991fb0d6089f9437bbee2

Authored by Dmitriy Zaporozhets
1 parent 0b59af49

Add templates for Emails on push

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/mailers/emails/projects.rb
... ... @@ -16,7 +16,7 @@ module Emails
16 16  
17 17 def repository_push_email(project_id, recipient, branch, compare)
18 18 @project = Project.find project_id
19   - @commits = compare.commits
  19 + @commits = Commit.decorate compare.commits
20 20 @commit = compare.commit
21 21 @diffs = compare.diffs
22 22 @branch = branch
... ...
app/views/notify/repository_push_email.html.haml 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +%h3 New push to #{@branch} at #{@project.name_with_namespace}
  2 +
  3 +%h4 Commits:
  4 +
  5 +%ul
  6 + - @commits.each do |commit|
  7 + %li
  8 + #{commit.short_id} - #{commit.title}
  9 +
  10 +%h4 Diff:
  11 +- @diffs.each do |diff|
  12 + %li
  13 + %strong
  14 + - if diff.old_path == diff.new_path
  15 + = diff.new_path
  16 + - elsif diff.new_path && diff.old_path
  17 + #{diff.old_path} &rarr; #{diff.new_path}
  18 + - else
  19 + = diff.new_path || diff.old_path
  20 + %hr
  21 + %pre
  22 + = diff.diff
  23 + %br
... ...
app/views/notify/repository_push_email.text.haml 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +New push to #{@branch} at #{@project.name_with_namespace}
  2 +
  3 +\
  4 +Commits:
  5 +- @commits.each do |commit|
  6 + #{commit.short_id} - #{truncate(commit.title, length: 40)}
  7 +\
  8 +\
  9 +Diff:
  10 +- @diffs.each do |diff|
  11 + \
  12 + \=====================================
  13 + - if diff.old_path == diff.new_path
  14 + = diff.new_path
  15 + - elsif diff.new_path && diff.old_path
  16 + #{diff.old_path} &rarr; #{diff.new_path}
  17 + - else
  18 + = diff.new_path || diff.old_path
  19 + \=====================================
  20 + = diff.diff
... ...