diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 29ab1404f415d50c78e646ec00d289120c7dc675..8e19752a8a1142565450fe635345ca277e52cd70 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -5,8 +5,8 @@ module CiStatusHelper end def ci_status_with_icon(status, target = nil) - content = ci_icon_for_status(status) + ci_label_for_status(status) - klass = "ci-status ci-#{status}" # TODO, add support for detailed status + content = ci_icon_for_status(status) + ci_text_for_status(status) + klass = "ci-status ci-#{status}" if target link_to content, target, class: klass @@ -15,6 +15,14 @@ module CiStatusHelper end end + def ci_text_for_status(status) + if detailed_status?(status) + status.text + else + status + end + end + def ci_label_for_status(status) if detailed_status?(status) return status.label diff --git a/lib/gitlab/ci/status/core.rb b/lib/gitlab/ci/status/core.rb index fbfe257eeca8ef388b2fa47fffc64495aba70f35..10e04d5be03b47263a9f692e1efb74b1133d7ca7 100644 --- a/lib/gitlab/ci/status/core.rb +++ b/lib/gitlab/ci/status/core.rb @@ -22,6 +22,17 @@ module Gitlab "#{@subject.class.name.demodulize}: #{label}" end + # Deprecation warning: this method is here because we need to maintain + # backwards compatibility with legacy statuses. We often do something + # like "ci-status ci-status-#{status}" to set CSS class. + # + # `to_s` method should be renamed to `group` at some point, after + # phasing legacy satuses out. + # + def to_s + self.class.name.demodulize.downcase + end + def has_details? raise NotImplementedError end