summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-05-19 20:42:43 +0000
committerDouwe Maan <douwe@gitlab.com>2016-05-19 20:42:43 +0000
commitbd0cecfdf6ec504421b44f1174040c5003c13f65 (patch)
tree200c89a047765c7578bc34c16065d8b2ee81980a /app/helpers
parent53e2d30af4f5a23d4f58c051293188e891c385fa (diff)
parent4f1c63683175fa88ca41ba2180b68e266d7118e4 (diff)
downloadgitlab-ce-bd0cecfdf6ec504421b44f1174040c5003c13f65.tar.gz
Merge branch 'with-pipeline-view' into 'master'
Add pipeline view This is continuation of https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3653 cc @DouweM @grzesiek Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17551 Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/15625 See merge request !3703
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/ci_status_helper.rb29
1 files changed, 20 insertions, 9 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index 417050b4132..cfad17dcacf 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -38,19 +38,30 @@ module CiStatusHelper
icon(icon_name + ' fw')
end
- def render_ci_status(ci_commit, tooltip_placement: 'auto left')
- # TODO: split this method into
- # - render_commit_status
- # - render_pipeline_status
- link_to ci_icon_for_status(ci_commit.status),
- ci_status_path(ci_commit),
- class: "ci-status-link ci-status-icon-#{ci_commit.status.dasherize}",
- title: "Build #{ci_label_for_status(ci_commit.status)}",
- data: { toggle: 'tooltip', placement: tooltip_placement }
+ def render_commit_status(commit, tooltip_placement: 'auto left')
+ project = commit.project
+ path = builds_namespace_project_commit_path(project.namespace, project, commit)
+ render_status_with_link('commit', commit.status, path, tooltip_placement)
+ end
+
+ def render_pipeline_status(pipeline, tooltip_placement: 'auto left')
+ project = pipeline.project
+ path = namespace_project_pipeline_path(project.namespace, project, pipeline)
+ render_status_with_link('pipeline', pipeline.status, path, tooltip_placement)
end
def no_runners_for_project?(project)
project.runners.blank? &&
Ci::Runner.shared.blank?
end
+
+ private
+
+ def render_status_with_link(type, status, path, tooltip_placement)
+ link_to ci_icon_for_status(status),
+ path,
+ class: "ci-status-link ci-status-icon-#{status.dasherize}",
+ title: "#{type.titleize}: #{ci_label_for_status(status)}",
+ data: { toggle: 'tooltip', placement: tooltip_placement }
+ end
end