Dont show '0 additions and 0 deletions' message for commit

This commit is contained in:
Dmitriy Zaporozhets 2013-03-21 22:50:18 +02:00
parent ad5ea14210
commit 5f9d654939
2 changed files with 12 additions and 5 deletions

View file

@ -172,4 +172,10 @@ class Commit
lines.pop if lines.last == "-- " # end of diff
lines.join("\n")
end
def has_zero_stats?
stats.total.zero?
rescue
true
end
end

View file

@ -1,10 +1,11 @@
= render "commit_box"
%p.pull-right.cgray
This commit has
%span.cgreen #{@commit.stats.additions} additions
and
%span.cred #{@commit.stats.deletions} deletions
- unless @commit.has_zero_stats?
%p.pull-right.cgray
This commit has
%span.cgreen #{@commit.stats.additions} additions
and
%span.cred #{@commit.stats.deletions} deletions
= render "commits/diffs", diffs: @commit.diffs
= render "notes/notes_with_form"