diff options
Diffstat (limited to 'app/helpers/ci_status_helper.rb')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 895c3d728ad..d9f5e01f0dc 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -4,17 +4,12 @@ module CiStatusHelper builds_namespace_project_commit_path(project.namespace, project, pipeline.sha) end - def ci_status_with_icon(status, target = nil) - content = ci_icon_for_status(status) + ' '.html_safe + ci_label_for_status(status) - klass = "ci-status ci-#{status}" - if target - link_to content, target, class: klass - else - content_tag :span, content, class: klass + # Is used by Commit and Merge Request Widget + def ci_label_for_status(status) + if detailed_status?(status) + return status.label end - end - def ci_label_for_status(status) case status when 'success' 'passed' @@ -31,6 +26,10 @@ module CiStatusHelper end def ci_icon_for_status(status) + if detailed_status?(status) + return custom_icon(status.icon) + end + icon_name = case status when 'success' @@ -94,4 +93,10 @@ module CiStatusHelper class: klass, title: title, data: data end end + + def detailed_status?(status) + status.respond_to?(:text) && + status.respond_to?(:label) && + status.respond_to?(:icon) + end end |