2016-02-09 07:10:16 -05:00
|
|
|
class Projects::BadgesController < Projects::ApplicationController
|
2016-04-04 06:32:50 -04:00
|
|
|
layout 'project_settings'
|
|
|
|
before_action :authorize_admin_project!, only: [:index]
|
2016-03-22 05:21:45 -04:00
|
|
|
before_action :no_cache_headers, except: [:index]
|
|
|
|
|
2017-07-19 07:08:47 -04:00
|
|
|
def pipeline
|
|
|
|
pipeline_status = Gitlab::Badge::Pipeline::Status
|
2016-08-11 09:17:13 -04:00
|
|
|
.new(project, params[:ref])
|
2016-03-23 06:24:18 -04:00
|
|
|
|
2017-07-19 07:08:47 -04:00
|
|
|
render_badge pipeline_status
|
2016-08-11 09:17:13 -04:00
|
|
|
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)
|
2016-02-09 07:10:16 -05:00
|
|
|
respond_to do |format|
|
|
|
|
format.html { render_404 }
|
|
|
|
format.svg do
|
2016-07-28 09:39:41 -04:00
|
|
|
render 'badge', locals: { badge: badge.template }
|
2016-02-09 07:10:16 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|