Skip to content
Snippets Groups Projects
Commit f4022f02 authored by Douwe Maan's avatar Douwe Maan
Browse files

Add badges to commit page Changes/Builds tabs.

parent e73a6c16
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6,14 +6,13 @@ class Projects::CommitController < Projects::ApplicationController
before_action :require_non_empty_project
before_action :authorize_download_code!
before_action :commit
before_action :define_show_vars, only: [:show, :ci]
 
def show
return git_not_found! unless @commit
 
@line_notes = commit.notes.inline
@diffs = @commit.diffs
@note = @project.build_commit_note(commit)
@notes_count = commit.notes.count
@notes = commit.notes.not_inline.fresh
@noteable = @commit
@comments_allowed = @reply_allowed = true
Loading
Loading
@@ -22,8 +21,6 @@ class Projects::CommitController < Projects::ApplicationController
commit_id: @commit.id
}
 
@ci_commit = project.ci_commit(commit.sha)
respond_to do |format|
format.html
format.diff { render text: @commit.to_diff }
Loading
Loading
@@ -32,9 +29,6 @@ class Projects::CommitController < Projects::ApplicationController
end
 
def ci
@ci_commit = @project.ci_commit(@commit.sha)
@builds = @ci_commit.builds if @ci_commit
@notes_count = @commit.notes.count
@ci_project = @project.gitlab_ci_project
end
 
Loading
Loading
@@ -55,4 +49,12 @@ class Projects::CommitController < Projects::ApplicationController
def commit
@commit ||= @project.commit(params[:id])
end
def define_show_vars
@diffs = commit.diffs
@notes_count = commit.notes.count
@ci_commit = project.ci_commit(commit.sha)
@builds = ci_commit.builds if ci_commit
end
end
Loading
Loading
@@ -2,6 +2,8 @@
= nav_link(path: 'commit#show') do
= link_to namespace_project_commit_path(@project.namespace, @project, @commit.id) do
Changes
%span.badge= @diffs.count
= nav_link(path: 'commit#ci') do
= link_to ci_namespace_project_commit_path(@project.namespace, @project, @commit.id) do
Builds
%span.badge= @builds.count
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