blob: 824aa41db51c7145140ba00f50aabc6f5abca9cc (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 | class Projects::BadgesController < Projects::ApplicationController
  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
  def build
    badge = Gitlab::Badge::Build.new(project, params[:ref])
    respond_to do |format|
      format.html { render_404 }
      format.svg do
        send_data(badge.data, type: badge.type, disposition: 'inline')
      end
    end
  end
end
 |