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

22 lines
600 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]
def index
@ref = params[:ref] || @project.default_branch || 'master'
@build_badge = Gitlab::Badge::Build.new(@project, @ref)
end
2016-04-02 18:10:28 +05:30
def build
2016-06-02 11:05:42 +05:30
badge = Gitlab::Badge::Build.new(project, params[:ref])
2016-04-02 18:10:28 +05:30
respond_to do |format|
format.html { render_404 }
format.svg do
2016-06-02 11:05:42 +05:30
send_data(badge.data, type: badge.type, disposition: 'inline')
2016-04-02 18:10:28 +05:30
end
end
end
end