diff options
author | Scott Hampton <shampton@gitlab.com> | 2019-02-27 00:10:24 +0300 |
---|---|---|
committer | Scott Hampton <shampton@gitlab.com> | 2019-02-27 00:10:24 +0300 |
commit | 40d15136352958206685197d4176f15781089849 (patch) | |
tree | a9f5dc43b3e13aaeb3ae9feca6833aa6e1eabbac /app/helpers/ci_status_helper.rb | |
parent | 2b51745394e8568cf91ce6ee95574f84fc38722e (diff) |
Adding ability to pass in path to status icon
Project passed a very specific details path. Also reverted a change.
Diffstat (limited to 'app/helpers/ci_status_helper.rb')
-rw-r--r-- | app/helpers/ci_status_helper.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index c02f3707b9e..355b91a8661 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -100,6 +100,32 @@ module CiStatusHelper "pipeline-status/#{pipeline_status.sha}-#{pipeline_status.status}" end + def render_commit_status(commit, ref: nil, tooltip_placement: 'left') + project = commit.project + path = pipelines_project_commit_path(project, commit, ref: ref) + + render_status_with_link( + 'commit', + commit.status(ref), + path, + tooltip_placement: tooltip_placement, + icon_size: 24) + end + + def render_status_with_link(type, status, path = nil, tooltip_placement: 'left', cssclass: '', container: 'body', icon_size: 16) + klass = "ci-status-link ci-status-icon-#{status.dasherize} #{cssclass}" + title = "#{type.titleize}: #{ci_label_for_status(status)}" + data = { toggle: 'tooltip', placement: tooltip_placement, container: container } + + if path + link_to ci_icon_for_status(status, size: icon_size), path, + class: klass, title: title, data: data + else + content_tag :span, ci_icon_for_status(status, size: icon_size), + class: klass, title: title, data: data + end + end + def detailed_status?(status) status.respond_to?(:text) && status.respond_to?(:label) && |