2016-02-09 12:10:16 +00:00
|
|
|
class Projects::BadgesController < Projects::ApplicationController
|
2016-04-04 10:32:50 +00:00
|
|
|
layout 'project_settings'
|
|
|
|
before_action :authorize_admin_project!, only: [:index]
|
2016-03-22 09:21:45 +00:00
|
|
|
before_action :no_cache_headers, except: [:index]
|
|
|
|
|
|
|
|
def index
|
2016-04-06 17:55:37 +00:00
|
|
|
@ref = params[:ref] || @project.default_branch || 'master'
|
2016-04-06 08:10:29 +00:00
|
|
|
@build_badge = Gitlab::Badge::Build.new(@project, @ref)
|
2016-03-22 09:21:45 +00:00
|
|
|
end
|
2016-03-04 09:34:35 +00:00
|
|
|
|
2016-02-09 12:10:16 +00:00
|
|
|
def build
|
2016-03-23 10:24:18 +00:00
|
|
|
badge = Gitlab::Badge::Build.new(project, params[:ref])
|
|
|
|
|
2016-02-09 12:10:16 +00:00
|
|
|
respond_to do |format|
|
|
|
|
format.html { render_404 }
|
|
|
|
format.svg do
|
2016-03-23 10:24:18 +00:00
|
|
|
send_data(badge.data, type: badge.type, disposition: 'inline')
|
2016-02-09 12:10:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|