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]
|
|
|
|
|
|
|
|
def index
|
2016-04-06 13:55:37 -04:00
|
|
|
@ref = params[:ref] || @project.default_branch || 'master'
|
2016-04-06 04:10:29 -04:00
|
|
|
@build_badge = Gitlab::Badge::Build.new(@project, @ref)
|
2016-03-22 05:21:45 -04:00
|
|
|
end
|
2016-03-04 04:34:35 -05:00
|
|
|
|
2016-02-09 07:10:16 -05:00
|
|
|
def build
|
2016-03-23 06:24:18 -04:00
|
|
|
badge = Gitlab::Badge::Build.new(project, params[:ref])
|
|
|
|
|
2016-02-09 07:10:16 -05:00
|
|
|
respond_to do |format|
|
|
|
|
format.html { render_404 }
|
|
|
|
format.svg do
|
2016-03-23 06:24:18 -04:00
|
|
|
send_data(badge.data, type: badge.type, disposition: 'inline')
|
2016-02-09 07:10:16 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|