gitlab-org--gitlab-foss/app/controllers/projects/badges_controller.rb
Z.J. van de Weg 2086483b24 Rename build to pipeline for status badges
First commit in probably 2, for resolve gitlab-org/gitlab-ce#15582. This
commit is renaming files and classes from build to pipeline. Also
wording is editted to pipeline. Given `pipeline` had more characters
than `build`, I've made the field a bit wider. The width now matchers
the one for the coverage badge, so they look nice when in a table
format, or in a list.

As soon as this commit is merged to master, and released, the build.svg
is deprecated, meaning that all users which already placed a badge
should update it. However, to make sure it keeps working tests are added
for this case.
2017-07-21 10:22:09 +02:00

30 lines
711 B
Ruby

class Projects::BadgesController < Projects::ApplicationController
layout 'project_settings'
before_action :authorize_admin_project!, only: [:index]
before_action :no_cache_headers, except: [:index]
def pipeline
pipeline_status = Gitlab::Badge::Pipeline::Status
.new(project, params[:ref])
render_badge pipeline_status
end
def coverage
coverage_report = Gitlab::Badge::Coverage::Report
.new(project, params[:ref], params[:job])
render_badge coverage_report
end
private
def render_badge(badge)
respond_to do |format|
format.html { render_404 }
format.svg do
render 'badge', locals: { badge: badge.template }
end
end
end
end