diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-29 16:26:40 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-29 16:26:40 +0200 |
commit | 3d9a7cdb4be6d6d059dfd7ccc8fa2e4bd3ab12e3 (patch) | |
tree | fbc4fb4a8ae361436e92c794c01ebab2c83c4e18 /app/helpers/ci_status_helper.rb | |
parent | 87240e989ba913bad787d8bc81da1a9b87f1da53 (diff) | |
download | gitlab-ce-3d9a7cdb4be6d6d059dfd7ccc8fa2e4bd3ab12e3.tar.gz |
Refactor CI helpers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/helpers/ci_status_helper.rb')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 18c30ddb281..3a88ed7107e 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -4,19 +4,7 @@ module CiStatusHelper end def ci_status_icon(ci_commit) - icon_name = - case ci_commit.status - when 'success' - 'check' - when 'failed' - 'close' - when 'running', 'pending' - 'clock-o' - else - 'circle' - end - - icon(icon_name) + ci_icon_for_status(ci_commit.status) end def ci_status_color(ci_commit) @@ -31,4 +19,26 @@ module CiStatusHelper 'gray' end end + + def ci_status_with_icon(status) + content_tag :span, class: "ci-status ci-#{status}" do + ci_icon_for_status(status) + ' '.html_safe + status + end + end + + def ci_icon_for_status(status) + icon_name = + case status + when 'success' + 'check' + when 'failed' + 'close' + when 'running', 'pending' + 'clock-o' + else + 'circle' + end + + icon(icon_name) + end end |