summaryrefslogtreecommitdiff
path: root/app/views/projects/graphs
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-26 20:32:44 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-26 20:32:44 +0300
commit6d0ddf45bada832a315d7f84b3cafd1a92beff34 (patch)
treebc52485858e00fca3a5d7968978d1534f079ac48 /app/views/projects/graphs
parentaa46a15d2adaa018b7d8c59e6def2643fb2acab1 (diff)
downloadgitlab-ce-6d0ddf45bada832a315d7f84b3cafd1a92beff34.tar.gz
Raw implementation of commits stats page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/views/projects/graphs')
-rw-r--r--app/views/projects/graphs/_head.html.haml5
-rw-r--r--app/views/projects/graphs/commits.html.haml85
-rw-r--r--app/views/projects/graphs/show.html.haml1
3 files changed, 91 insertions, 0 deletions
diff --git a/app/views/projects/graphs/_head.html.haml b/app/views/projects/graphs/_head.html.haml
new file mode 100644
index 00000000000..9f37a760e61
--- /dev/null
+++ b/app/views/projects/graphs/_head.html.haml
@@ -0,0 +1,5 @@
+%ul.nav.nav-tabs
+ = nav_link(action: :show) do
+ = link_to 'Contributors', project_graph_path
+ = nav_link(action: :commits) do
+ = link_to 'Commits', commits_project_graph_path
diff --git a/app/views/projects/graphs/commits.html.haml b/app/views/projects/graphs/commits.html.haml
new file mode 100644
index 00000000000..2b72bdfae21
--- /dev/null
+++ b/app/views/projects/graphs/commits.html.haml
@@ -0,0 +1,85 @@
+= render 'head'
+
+%p.lead
+ Commits statistic for
+ %strong #{@repository.root_ref}
+ #{@start_date.strftime('%b %d')} - #{@end_date.strftime('%b %d')}
+
+.row
+ .col-md-6
+ %ul
+ %li
+ %p.lead
+ %strong #{@commits.size}
+ commits during
+ %strong #{@duration}
+ days
+ %li
+ %p.lead
+ Average
+ %strong #{@commit_per_day}
+ commits per day
+ %li
+ %p.lead
+ Contributed by
+ %strong #{@authors}
+ authors
+ .col-md-6
+ %div
+ %p.slead
+ Commits per day of month
+ %canvas#month-chart{width: 800, height: 400}
+.row
+ .col-md-6
+ %div
+ %p.slead
+ Commits per day hour (UTC)
+ %canvas#hour-chart{width: 800, height: 400}
+ .col-md-6
+ %div
+ %p.slead
+ Commits per weekday
+ %canvas#weekday-chart{width: 800, height: 400}
+
+:coffeescript
+ data = {
+ labels : #{@commits_per_time.keys.to_json},
+ datasets : [{
+ fillColor : "rgba(220,220,220,0.5)",
+ strokeColor : "rgba(220,220,220,1)",
+ pointColor : "rgba(220,220,220,1)",
+ pointStrokeColor : "#EEE",
+ data : #{@commits_per_time.values.to_json}
+ }]
+ }
+
+ ctx = $("#hour-chart").get(0).getContext("2d");
+ new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true});
+
+ data = {
+ labels : #{@commits_per_week_days.keys.to_json},
+ datasets : [{
+ fillColor : "rgba(220,220,220,0.5)",
+ strokeColor : "rgba(220,220,220,1)",
+ pointColor : "rgba(220,220,220,1)",
+ pointStrokeColor : "#EEE",
+ data : #{@commits_per_week_days.values.to_json}
+ }]
+ }
+
+ ctx = $("#weekday-chart").get(0).getContext("2d");
+ new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true});
+
+ data = {
+ labels : #{@commits_per_month.keys.to_json},
+ datasets : [{
+ fillColor : "rgba(220,220,220,0.5)",
+ strokeColor : "rgba(220,220,220,1)",
+ pointColor : "rgba(220,220,220,1)",
+ pointStrokeColor : "#EEE",
+ data : #{@commits_per_month.values.to_json}
+ }]
+ }
+
+ ctx = $("#month-chart").get(0).getContext("2d");
+ new Chart(ctx).Line(data,{"scaleOverlay": true, responsive: true});
diff --git a/app/views/projects/graphs/show.html.haml b/app/views/projects/graphs/show.html.haml
index c2878e13e7c..e0a9f62752a 100644
--- a/app/views/projects/graphs/show.html.haml
+++ b/app/views/projects/graphs/show.html.haml
@@ -1,3 +1,4 @@
+= render 'head'
.loading-graph
.center
%h3.page-title