summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-23 11:24:18 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-03-29 09:01:19 +0200
commit4cd1b9f4d82efe3ffe810dabf6929a749c36c1bf (patch)
tree907813709b26f17c94b8a8e9234bea07e0935e4d /app/controllers
parent63c8a05bf7f18ac4093ece1f08b4b5fd8dba5fac (diff)
downloadgitlab-ce-4cd1b9f4d82efe3ffe810dabf6929a749c36c1bf.tar.gz
Refactor builds badge, encapsulate inside a class
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/badges_controller.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb
index 6ff47c4033a..6d4d4360988 100644
--- a/app/controllers/projects/badges_controller.rb
+++ b/app/controllers/projects/badges_controller.rb
@@ -2,11 +2,12 @@ class Projects::BadgesController < Projects::ApplicationController
before_action :no_cache_headers
def build
+ badge = Gitlab::Badge::Build.new(project, params[:ref])
+
respond_to do |format|
format.html { render_404 }
format.svg do
- image = Ci::ImageForBuildService.new.execute(project, ref: params[:ref])
- send_file(image.path, filename: image.name, disposition: 'inline', type: 'image/svg+xml')
+ send_data(badge.data, type: badge.type, disposition: 'inline')
end
end
end