diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-26 04:42:46 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-26 04:42:46 +0300 |
commit | 046b28312704f3131e72dcd2dbdacc5264d4aa62 (patch) | |
tree | a8c2b14a6e1db3b662fee2c79af70d9fcb643c2e /app/helpers/ci/commits_helper.rb | |
parent | e449426a4e7d15cdd582d4f136add52cbfb5e04e (diff) |
Groundwork for merging CI into CE
Diffstat (limited to 'app/helpers/ci/commits_helper.rb')
-rw-r--r-- | app/helpers/ci/commits_helper.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/helpers/ci/commits_helper.rb b/app/helpers/ci/commits_helper.rb new file mode 100644 index 00000000000..0479bc10594 --- /dev/null +++ b/app/helpers/ci/commits_helper.rb @@ -0,0 +1,26 @@ +module Ci + module CommitsHelper + def commit_status_alert_class(commit) + return unless commit + + case commit.status + when 'success' + 'alert-success' + when 'failed', 'canceled' + 'alert-danger' + when 'skipped' + 'alert-disabled' + else + 'alert-warning' + end + end + + def commit_link(commit) + link_to(commit.short_sha, ci_project_ref_commit_path(commit.project, commit.ref, commit.sha)) + end + + def truncate_first_line(message, length = 50) + truncate(message.each_line.first.chomp, length: length) if message + end + end +end |