debian-mirror-gitlab/app/controllers/projects/badges_controller.rb

31 lines
699 B
Ruby
Raw Normal View History

2016-04-02 18:10:28 +05:30
class Projects::BadgesController < Projects::ApplicationController
2016-06-02 11:05:42 +05:30
layout 'project_settings'
before_action :authorize_admin_project!, only: [:index]
before_action :no_cache_headers, except: [:index]
2016-04-02 18:10:28 +05:30
def build
2016-09-13 17:45:13 +05:30
build_status = Gitlab::Badge::Build::Status
.new(project, params[:ref])
2016-06-02 11:05:42 +05:30
2016-09-13 17:45:13 +05:30
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)
2016-04-02 18:10:28 +05:30
respond_to do |format|
format.html { render_404 }
format.svg do
2016-09-13 17:45:13 +05:30
render 'badge', locals: { badge: badge.template }
2016-04-02 18:10:28 +05:30
end
end
end
end