diff options
-rw-r--r-- | app/controllers/projects/badges_controller.rb | 5 | ||||
-rw-r--r-- | app/views/projects/badges/index.html.haml | 15 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 3 | ||||
-rw-r--r-- | config/routes.rb | 2 |
4 files changed, 23 insertions, 2 deletions
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb index 6d4d4360988..01db85c4a8a 100644 --- a/app/controllers/projects/badges_controller.rb +++ b/app/controllers/projects/badges_controller.rb @@ -1,5 +1,8 @@ class Projects::BadgesController < Projects::ApplicationController - before_action :no_cache_headers + before_action :no_cache_headers, except: [:index] + + def index + end def build badge = Gitlab::Badge::Build.new(project, params[:ref]) diff --git a/app/views/projects/badges/index.html.haml b/app/views/projects/badges/index.html.haml new file mode 100644 index 00000000000..b527df8ac98 --- /dev/null +++ b/app/views/projects/badges/index.html.haml @@ -0,0 +1,15 @@ +- page_title 'Badges' + +.prepend-top-10 + .panel.panel-default + .panel-heading + %b Builds badge · + = image_tag(build_namespace_project_badges_path(@project.namespace, @project, :master, format: :svg), alt: 'Builds badge') + .panel-body + %table.table + %tr + %td Markdown + %td= markdown("```markdown\n[![build status](url)](link)\n```") + %tr + %td HTML + %td= markdown("```html\n<a href='link'><img src='url' /></a>\n```") diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 4310f038fc9..6963d657d9e 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -57,6 +57,9 @@ %li.missing = link_to add_contribution_guide_path(@project) do Add Contribution guide + - if @project.builds_enabled? + %li + = link_to 'Badges', '' - if @repository.commit .content-block.second-block.white diff --git a/config/routes.rb b/config/routes.rb index 36561c31d48..3ef5931d97c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -749,7 +749,7 @@ Rails.application.routes.draw do end resources :runner_projects, only: [:create, :destroy] - resources :badges, only: [] do + resources :badges, only: [:index] do collection do scope '*ref', constraints: { ref: Gitlab::Regex.git_reference_regex } do get :build, constraints: { format: /svg/ } |