Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
1b5e2303
Commit
1b5e2303
authored
Jul 28, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new badge template to render build status badge
parent
503c44ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
3 deletions
+8
-3
app/controllers/projects/badges_controller.rb
app/controllers/projects/badges_controller.rb
+2
-1
app/views/projects/badges/badge.svg.erb
app/views/projects/badges/badge.svg.erb
+1
-1
features/steps/project/badges/build.rb
features/steps/project/badges/build.rb
+1
-1
lib/gitlab/badge/build.rb
lib/gitlab/badge/build.rb
+4
-0
No files found.
app/controllers/projects/badges_controller.rb
View file @
1b5e2303
...
@@ -8,8 +8,9 @@ class Projects::BadgesController < Projects::ApplicationController
...
@@ -8,8 +8,9 @@ class Projects::BadgesController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
render_404
}
format
.
html
{
render_404
}
format
.
svg
do
format
.
svg
do
send_data
(
badge
.
data
,
type:
badge
.
type
,
disposition:
'inline'
)
render
'badge'
,
locals:
{
badge:
badge
.
template
}
end
end
end
end
end
end
...
...
app/views/projects/badges/badge.svg.erb
View file @
1b5e2303
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<g
mask=
"url(#a)"
>
<g
mask=
"url(#a)"
>
<path
fill=
"
<%=
badge
.
key_color
%>
"
d=
"M0 0h
<%=
badge
.
key_width
%>
v 20H 0z"
/>
<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"
/>
<path
fill=
"url(#b)"
d=
"M0 0h
<%=
badge
.
width
%>
v 20H 0z"
/>
</g>
</g>
...
...
features/steps/project/badges/build.rb
View file @
1b5e2303
...
@@ -26,7 +26,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
...
@@ -26,7 +26,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
def
expect_badge
(
status
)
def
expect_badge
(
status
)
svg
=
Nokogiri
::
XML
.
parse
(
page
.
body
)
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
expect
(
svg
.
at
(
%Q{text:contains("
#{
status
}
")}
)).
to
be_truthy
end
end
end
end
lib/gitlab/badge/build.rb
View file @
1b5e2303
...
@@ -21,6 +21,10 @@ module Gitlab
...
@@ -21,6 +21,10 @@ module Gitlab
Build
::
Metadata
.
new
(
@project
,
@ref
)
Build
::
Metadata
.
new
(
@project
,
@ref
)
end
end
def
template
Build
::
Template
.
new
(
status
)
end
def
type
def
type
'image/svg+xml'
'image/svg+xml'
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment