Commit 8b89ef8639b2b6ee69d991fb0d6089f9437bbee2
1 parent
0b59af49
Exists in
master
and in
4 other branches
Add templates for Emails on push
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
44 additions
and
1 deletions
Show diff stats
app/mailers/emails/projects.rb
@@ -16,7 +16,7 @@ module Emails | @@ -16,7 +16,7 @@ module Emails | ||
16 | 16 | ||
17 | def repository_push_email(project_id, recipient, branch, compare) | 17 | def repository_push_email(project_id, recipient, branch, compare) |
18 | @project = Project.find project_id | 18 | @project = Project.find project_id |
19 | - @commits = compare.commits | 19 | + @commits = Commit.decorate compare.commits |
20 | @commit = compare.commit | 20 | @commit = compare.commit |
21 | @diffs = compare.diffs | 21 | @diffs = compare.diffs |
22 | @branch = branch | 22 | @branch = branch |
@@ -0,0 +1,23 @@ | @@ -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} → #{diff.new_path} | ||
18 | + - else | ||
19 | + = diff.new_path || diff.old_path | ||
20 | + %hr | ||
21 | + %pre | ||
22 | + = diff.diff | ||
23 | + %br |
@@ -0,0 +1,20 @@ | @@ -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} → #{diff.new_path} | ||
17 | + - else | ||
18 | + = diff.new_path || diff.old_path | ||
19 | + \===================================== | ||
20 | + = diff.diff |