Stats page
This commit is contained in:
parent
ca54d43f99
commit
1c5b2a5153
10 changed files with 186 additions and 15 deletions
|
@ -17,6 +17,8 @@
|
|||
//= require modernizr
|
||||
//= require chosen-jquery
|
||||
//= require raphael
|
||||
//= require g.raphael-min
|
||||
//= require g.bar-min
|
||||
//= require branch-graph
|
||||
//= require ace-src-noconflict/ace
|
||||
//= require_tree .
|
||||
|
|
|
@ -31,3 +31,11 @@ ul {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ol, ul {
|
||||
&.styled {
|
||||
li {
|
||||
padding:2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,14 @@ class RepositoriesController < ProjectResourceController
|
|||
@tags = @project.tags
|
||||
end
|
||||
|
||||
def stats
|
||||
@stats = Gitlab::GitStats.new(@project.repo, @project.root_ref)
|
||||
@graph = @stats.graph
|
||||
end
|
||||
|
||||
def archive
|
||||
unless can?(current_user, :download_code, @project)
|
||||
render_404 and return
|
||||
render_404 and return
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
Tags
|
||||
%span.badge= @project.tags.length
|
||||
|
||||
= nav_link(controller: :repositories, action: :stats) do
|
||||
= link_to stats_project_repository_path(@project) do
|
||||
Stats
|
||||
|
||||
|
||||
- if current_controller?(:commits) && current_user.private_token
|
||||
%li.right
|
||||
%span.rss-icon
|
||||
|
|
39
app/views/repositories/stats.html.haml
Normal file
39
app/views/repositories/stats.html.haml
Normal file
|
@ -0,0 +1,39 @@
|
|||
= render "commits/head"
|
||||
.row
|
||||
.span5
|
||||
%h4
|
||||
Stats for #{@project.root_ref}:
|
||||
%p
|
||||
%b Total commits:
|
||||
%span= @stats.commits_count
|
||||
%p
|
||||
%b Total files:
|
||||
%span= @stats.files_count
|
||||
%p
|
||||
%b Authors:
|
||||
%span= @stats.authors_count
|
||||
|
||||
%br
|
||||
%div#activity-chart
|
||||
.span7
|
||||
%h4 Top 100 Committers:
|
||||
%ol.styled
|
||||
- @stats.authors[0...100].each do |author|
|
||||
%li
|
||||
= image_tag gravatar_icon(author.email, 16), class: 'avatar s16'
|
||||
= author.name
|
||||
%small.light= author.email
|
||||
.right
|
||||
= author.commits
|
||||
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
var labels = [#{@graph.labels.to_json}];
|
||||
var r = Raphael('activity-chart');
|
||||
r.text(160, 10, "Commit activity for last #{@graph.weeks} weeks").attr({ font: "13px sans-serif" });
|
||||
r.barchart(
|
||||
10, 10, 400, 160,
|
||||
[[#{@graph.commits.join(', ')}]]
|
||||
).label(labels, true);
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue