Use new badge template to render build status badge
This commit is contained in:
parent
503c44ee2a
commit
1b5e2303de
4 changed files with 8 additions and 3 deletions
|
@ -8,8 +8,9 @@ class Projects::BadgesController < Projects::ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html { render_404 }
|
||||
|
||||
format.svg do
|
||||
send_data(badge.data, type: badge.type, disposition: 'inline')
|
||||
render 'badge', locals: { badge: badge.template }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<g mask="url(#a)">
|
||||
<path fill="<%= badge.key_color%>" d="M0 0h <%= badge.key_width%>v 20H 0z"/>
|
||||
<path fill="#4c1" d="M<%= badge.key_width%> 0h <%= badge.value_width %>v 20H <%= badge.key_width%>z"/>
|
||||
<path fill="<%= badge.value_color %>" d="M<%= badge.key_width%> 0h <%= badge.value_width %>v 20H <%= badge.key_width%>z"/>
|
||||
<path fill="url(#b)" d="M0 0h <%= badge.width %>v 20H 0z"/>
|
||||
</g>
|
||||
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -26,7 +26,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
|
|||
|
||||
def expect_badge(status)
|
||||
svg = Nokogiri::XML.parse(page.body)
|
||||
expect(page.response_headers).to include('Content-Type' => 'image/svg+xml')
|
||||
expect(page.response_headers['Content-Type']).to include('image/svg+xml')
|
||||
expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,6 +21,10 @@ module Gitlab
|
|||
Build::Metadata.new(@project, @ref)
|
||||
end
|
||||
|
||||
def template
|
||||
Build::Template.new(status)
|
||||
end
|
||||
|
||||
def type
|
||||
'image/svg+xml'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue