diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-08-10 16:52:56 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-08-10 16:52:56 +0000 |
commit | ae63f152c3b1135500577e0b7e6528c607ebc1f7 (patch) | |
tree | 0aed9b1bbca3491dd821d3ef557351633c9088d4 /app/controllers | |
parent | 34d5426f0e17a9d0a2d2330b472114e7e457ae05 (diff) | |
parent | 3756bbe12c922ad23dd5ab6302cf64b7bafe84ba (diff) | |
download | gitlab-ce-ae63f152c3b1135500577e0b7e6528c607ebc1f7.tar.gz |
Merge branch 'feature/svg-badge-template' into 'master'
Use badge image template instead of using separate images
## What does this MR do?
Makes it possible to use template for badge instead of having multiple files.
## Are there points in the code the reviewer needs to double check?
We also have a deprecated badge in `controllers/ci/projects_controller.rb`. We decided to leave it until 9.0, so we still have images in `public/ci/` until 9.0.
## Why was this MR needed?
We are going to implement build coverage badge, and we do not want to store 101 SVG images for each percentage value.
## What are the relevant issue numbers?
#3714
## Screenshots (if relevant)
![new_build_badge](/uploads/f1d4ed5e34278eb01f48994b5b0579f1/new_build_badge.png)
## Does this MR meet the acceptance criteria?
- [ ] ~~[CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added~~ (refactoring)
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [ ] ~~API support added~~
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] ~~[Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)~~ (refactoring)
See merge request !5520
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/badges_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects/pipelines_settings_controller.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index a9f482c8787..d0f5071d2cc 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -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 diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb index 85ba706e5cd..75dd3648e45 100644 --- a/app/controllers/projects/pipelines_settings_controller.rb +++ b/app/controllers/projects/pipelines_settings_controller.rb @@ -3,7 +3,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController def show @ref = params[:ref] || @project.default_branch || 'master' - @build_badge = Gitlab::Badge::Build.new(@project, @ref) + @build_badge = Gitlab::Badge::Build.new(@project, @ref).metadata end def update |