badges_controller.rb 481 Bytes
Newer Older
1
class Projects::BadgesController < Projects::ApplicationController
2 3 4
  before_action :no_cache_headers, except: [:index]

  def index
5 6
    @ref = params[:ref] || 'master'
    @badge = Gitlab::Badge::Build.new(@project, @ref)
7
  end
8

9
  def build
10 11
    badge = Gitlab::Badge::Build.new(project, params[:ref])

12 13 14
    respond_to do |format|
      format.html { render_404 }
      format.svg do
15
        send_data(badge.data, type: badge.type, disposition: 'inline')
16 17 18 19
      end
    end
  end
end