Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Hampton <shampton@gitlab.com>2019-02-27 00:10:24 +0300
committerScott Hampton <shampton@gitlab.com>2019-02-27 00:10:24 +0300
commit40d15136352958206685197d4176f15781089849 (patch)
treea9f5dc43b3e13aaeb3ae9feca6833aa6e1eabbac /app/helpers/ci_status_helper.rb
parent2b51745394e8568cf91ce6ee95574f84fc38722e (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.rb26
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) &&