diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-01 13:03:14 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-04-06 19:56:34 +0200 |
commit | b7fa7c4d59b2fbdc49db81aa2d6a2531c931a2fe (patch) | |
tree | 01b4f5e2aa9231049caa56196f09b4b8a6ebd406 /app | |
parent | 88fc7ccddaab18435bdc85021d06d9aa21d28a68 (diff) | |
download | gitlab-ce-b7fa7c4d59b2fbdc49db81aa2d6a2531c931a2fe.tar.gz |
Extend build status badge, add html/markdown methods
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/badges_controller.rb | 2 | ||||
-rw-r--r-- | app/views/projects/badges/index.html.haml | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index 01db85c4a8a..b96555a153a 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -2,6 +2,8 @@ class Projects::BadgesController < Projects::ApplicationController before_action :no_cache_headers, except: [:index] def index + @ref = params[:ref] || 'master' + @badge = Gitlab::Badge::Build.new(@project, @ref) end def build diff --git a/app/views/projects/badges/index.html.haml b/app/views/projects/badges/index.html.haml index b527df8ac98..87c525cc1cb 100644 --- a/app/views/projects/badges/index.html.haml +++ b/app/views/projects/badges/index.html.haml @@ -4,12 +4,12 @@ .panel.panel-default .panel-heading %b Builds badge · - = image_tag(build_namespace_project_badges_path(@project.namespace, @project, :master, format: :svg), alt: 'Builds badge') + = @badge.to_html .panel-body %table.table %tr %td Markdown - %td= markdown("```markdown\n[![build status](url)](link)\n```") + %td= markdown("```markdown\n#{@badge.to_markdown}\n```") %tr %td HTML - %td= markdown("```html\n<a href='link'><img src='url' /></a>\n```") + %td= markdown("```html\n#{@badge.to_html}\n```") |