Add method for coverage badge in badges controller
This commit is contained in:
parent
3e481f154f
commit
b6ca47f6d4
1 changed files with 15 additions and 2 deletions
|
@ -4,11 +4,24 @@ class Projects::BadgesController < Projects::ApplicationController
|
|||
before_action :no_cache_headers, except: [:index]
|
||||
|
||||
def build
|
||||
badge = Gitlab::Badge::Build::Status.new(project, params[:ref])
|
||||
build_status = Gitlab::Badge::Build::Status
|
||||
.new(project, params[:ref])
|
||||
|
||||
render_badge build_status
|
||||
end
|
||||
|
||||
def coverage
|
||||
coverage_report = Gitlab::Badge::Coverage::Report
|
||||
.new(project, params[:ref], params[:job])
|
||||
|
||||
render_badge coverage_report
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def render_badge(badge)
|
||||
respond_to do |format|
|
||||
format.html { render_404 }
|
||||
|
||||
format.svg do
|
||||
render 'badge', locals: { badge: badge.template }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue