Skip to content
Snippets Groups Projects
Commit 0378340a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

build badge status markdown a& html code for user

parent 330d2842
No related branches found
No related tags found
No related merge requests found
$(document).ready ->
$('.badge-codes-toggle').on 'click', ->
$('.badge-codes-block').toggle()
Loading
Loading
@@ -32,4 +32,14 @@ module ProjectsHelper
ratio = (success_builds.to_f / (success_builds + failed_builds)) * 100
ratio.to_i
end
def markdown_badge_code(project, ref)
url = status_project_url(project, ref: ref, format: 'png')
"[![build status](#{url})](#{project_url(project, ref: ref)})"
end
def html_badge_code(project, ref)
url = status_project_url(project, ref: ref, format: 'png')
"<a href='#{project_url(project, ref: ref)}'><img src='#{url}' /></a>"
end
end
Loading
Loading
@@ -31,7 +31,16 @@
- if @ref
%p
Paste build status image for #{@ref} with next link
%a.btn.btn-small{href: status_project_path(@project, ref: @ref)} Status Badge
= link_to '#', class: 'badge-codes-toggle btn btn-small ' do
Status Badge
.badge-codes-block.well.well-small.hide
%label Markdown:
= text_field_tag 'badge_md', markdown_badge_code(@project, @ref), readonly: true, class: 'input-xxlarge'
%label Html:
= text_field_tag 'badge_html', html_badge_code(@project, @ref), readonly: true, class: 'input-xxlarge'
- if current_user
%p
You can manually run a build for current branch.
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment