diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-15 23:29:07 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-15 23:29:07 +0200 |
commit | 8de2f5b103f84a76ff941a80ac7fc0bb934b480f (patch) | |
tree | 810cb183f99593ebb964feca90a1f6051bf70617 /app/controllers | |
parent | d626c1d3729f500a891a6934ea779136671ef8b2 (diff) | |
parent | e8aab1cd1550dd14408ae4c7b51f45110898b949 (diff) | |
download | gitlab-ce-8de2f5b103f84a76ff941a80ac7fc0bb934b480f.tar.gz |
Merge branch 'fix-failing-tests' into pipeline-hooks-without-slack
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/badges_controller.rb | 17 | ||||
-rw-r--r-- | app/controllers/projects/pipelines_settings_controller.rb | 8 |
2 files changed, 22 insertions, 3 deletions
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index d0f5071d2cc..6c25cd83a24 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -4,11 +4,24 @@ class Projects::BadgesController < Projects::ApplicationController before_action :no_cache_headers, except: [:index] def build - badge = Gitlab::Badge::Build.new(project, params[:ref]) + build_status = Gitlab::Badge::Build::Status + .new(project, params[:ref]) + render_badge build_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 diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb index 75dd3648e45..9136633b87a 100644 --- a/app/controllers/projects/pipelines_settings_controller.rb +++ b/app/controllers/projects/pipelines_settings_controller.rb @@ -3,7 +3,13 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController def show @ref = params[:ref] || @project.default_branch || 'master' - @build_badge = Gitlab::Badge::Build.new(@project, @ref).metadata + + @badges = [Gitlab::Badge::Build::Status, + Gitlab::Badge::Coverage::Report] + + @badges.map! do |badge| + badge.new(@project, @ref).metadata + end end def update |