diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-01-27 16:57:50 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-01-27 16:57:50 +0000 |
commit | b9d841c0e2a8b179cbbf99cbf87b311db52c9d3a (patch) | |
tree | 47fcf93d449737717a1848c25c3397134b736967 | |
parent | 1897d5564b5ddb8c3e8ea4bd1bbff99226a90442 (diff) | |
parent | 6679a9062ad9f3ee9092655a5129feba1bcdd9d7 (diff) | |
download | gitlab-ce-b9d841c0e2a8b179cbbf99cbf87b311db52c9d3a.tar.gz |
Merge branch '26947-build-status-self-link' into 'master'
Use new partial to render a badge without a link in the builds details.
Closes #26947
See merge request !8740
-rw-r--r-- | app/views/ci/status/_badge.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/builds/_header.html.haml | 4 | ||||
-rw-r--r-- | changelogs/unreleased/26947-build-status-self-link.yml | 4 | ||||
-rw-r--r-- | spec/views/projects/builds/show.html.haml_spec.rb | 30 |
4 files changed, 38 insertions, 3 deletions
diff --git a/app/views/ci/status/_badge.html.haml b/app/views/ci/status/_badge.html.haml index 601fb7f0f3f..c00c7f7407e 100644 --- a/app/views/ci/status/_badge.html.haml +++ b/app/views/ci/status/_badge.html.haml @@ -1,7 +1,8 @@ - status = local_assigns.fetch(:status) +- link = local_assigns.fetch(:link, true) - css_classes = "ci-status ci-#{status.group}" -- if status.has_details? +- if link && status.has_details? = link_to status.details_path, class: css_classes do = custom_icon(status.icon) = status.text diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml index b15be0d861d..736b485bf06 100644 --- a/app/views/projects/builds/_header.html.haml +++ b/app/views/projects/builds/_header.html.haml @@ -1,8 +1,8 @@ .content-block.build-header .header-content - = render 'ci/status/badge', status: @build.detailed_status(current_user) + = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false Build - %strong ##{@build.id} + %strong.js-build-id ##{@build.id} in pipeline = link_to pipeline_path(@build.pipeline) do %strong ##{@build.pipeline.id} diff --git a/changelogs/unreleased/26947-build-status-self-link.yml b/changelogs/unreleased/26947-build-status-self-link.yml new file mode 100644 index 00000000000..15c5821874e --- /dev/null +++ b/changelogs/unreleased/26947-build-status-self-link.yml @@ -0,0 +1,4 @@ +--- +title: Add link verification to badge partial in order to render a badge without a link +merge_request: 8740 +author: diff --git a/spec/views/projects/builds/show.html.haml_spec.rb b/spec/views/projects/builds/show.html.haml_spec.rb index 745d0c745bd..44870cfcfb3 100644 --- a/spec/views/projects/builds/show.html.haml_spec.rb +++ b/spec/views/projects/builds/show.html.haml_spec.rb @@ -15,6 +15,36 @@ describe 'projects/builds/show', :view do allow(view).to receive(:can?).and_return(true) end + describe 'build information in header' do + let(:build) do + create(:ci_build, :success, environment: 'staging') + end + + before do + render + end + + it 'shows status name' do + expect(rendered).to have_css('.ci-status.ci-success', text: 'passed') + end + + it 'does not render a link to the build' do + expect(rendered).not_to have_link('passed') + end + + it 'shows build id' do + expect(rendered).to have_css('.js-build-id', text: build.id) + end + + it 'shows a link to the pipeline' do + expect(rendered).to have_link(build.pipeline.id) + end + + it 'shows a link to the commit' do + expect(rendered).to have_link(build.pipeline.short_sha) + end + end + describe 'environment info in build view' do context 'build with latest deployment' do let(:build) do |