Commit 251a7802 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Cleanup changes

parent 4af0968c
module CiStatusHelper
def ci_status_path(ci_commit)
project = ci_commit.project
builds_namespace_project_commit_path(project.namespace, project, ci_commit.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}"
......@@ -34,10 +39,11 @@ module CiStatusHelper
end
def render_ci_status(ci_commit, tooltip_placement: 'auto left')
return unless ci_commit.is_a?(Commit) || ci_commit.is_a?(Ci::Commit)
# TODO: split this method into
# - render_commit_status
# - render_pipeline_status
link_to ci_icon_for_status(ci_commit.status),
project_ci_commit_path(ci_commit.project, ci_commit),
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 }
......
......@@ -33,14 +33,6 @@ module GitlabRoutingHelper
namespace_project_builds_path(project.namespace, project, *args)
end
def project_commit_path(project, commit)
builds_namespace_project_commit_path(project.namespace, project, commit.id)
end
def project_ci_commit_path(project, ci_commit)
builds_namespace_project_commit_path(project.namespace, project, ci_commit.sha)
end
def activity_project_path(project, *args)
activity_namespace_project_path(project.namespace, project, *args)
end
......
......@@ -117,7 +117,7 @@
%td.build-link
- if project
= link_to builds_namespace_project_commit_path(project.namespace, project, build.sha) do
= link_to ci_status_path(build.commit) do
%strong #{build.commit.short_sha}
%td.timestamp
......
.project-last-commit
- if commit.status
= link_to project_commit_path(commit.project, commit), class: "ci-status ci-#{commit.status}" do
= link_to builds_namespace_project_commit_path(commit.project.namespace, commit.project, commit), class: "ci-status ci-#{commit.status}" do
= ci_icon_for_status(commit.status)
= ci_label_for_status(commit.status)
......
......@@ -4,7 +4,7 @@
.build-page
.gray-content-block.top-block
Build ##{@build.id} for commit
%strong.monospace= link_to @build.commit.short_sha, builds_namespace_project_commit_path(@project.namespace, @project, @build.sha)
%strong.monospace= link_to @build.commit.short_sha, ci_status_path(@build.commit)
from
= link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref)
- merge_request = @build.merge_request
......@@ -173,7 +173,7 @@
Commit
.pull-right
%small
= link_to @build.commit.short_sha, builds_namespace_project_commit_path(@project.namespace, @project, @build.sha), class: "monospace"
= link_to @build.commit.short_sha, ci_status_path(@build.commit), class: "monospace"
%p
%span.attr-name Branch:
= link_to @build.ref, namespace_project_commits_path(@project.namespace, @project, @build.ref)
......@@ -196,7 +196,7 @@
.build-widget
%h4.title #{pluralize(@builds.count(:id), "other build")} for
= succeed ":" do
= link_to @build.commit.short_sha, builds_namespace_project_commit_path(@project.namespace, @project, @build.sha), class: "monospace"
= link_to @build.commit.short_sha, ci_status_path(@build.commit), class: "monospace"
%table.table.builds
- @builds.each_with_index do |build, i|
%tr.build
......
This diff is collapsed.
......@@ -162,9 +162,4 @@ describe 'Commits' do
end
end
end
def ci_status_path(ci_commit)
project = ci_commit.project
builds_namespace_project_commit_path(project.namespace, project, ci_commit.sha)
end
end
......@@ -6,7 +6,7 @@ describe CiStatusHelper do
let(:success_commit) { double("Ci::Commit", status: 'success') }
let(:failed_commit) { double("Ci::Commit", status: 'failed') }
describe 'ci_status_icon' do
describe 'ci_icon_for_status' do
it { expect(helper.ci_icon_for_status(success_commit.status)).to include('fa-check') }
it { expect(helper.ci_icon_for_status(failed_commit.status)).to include('fa-close') }
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment