mirror of
https://github.com/tomgi/git_stats.git
synced 2025-01-03 11:12:11 +01:00
activity tabs
This commit is contained in:
parent
faba8bfdad
commit
c960c3dff7
6 changed files with 105 additions and 47 deletions
|
@ -22,3 +22,5 @@ en:
|
||||||
day: Day
|
day: Day
|
||||||
day_of_week: Day of week
|
day_of_week: Day of week
|
||||||
hour_of_week: Hour of week
|
hour_of_week: Hour of week
|
||||||
|
month: Month
|
||||||
|
month_of_year: Month of year
|
|
@ -30,6 +30,10 @@ module GitStats
|
||||||
@by_month ||= default_hash
|
@by_month ||= default_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def by_month_array
|
||||||
|
by_month.to_key_indexed_array(min_size: 12, default: 0)
|
||||||
|
end
|
||||||
|
|
||||||
def by_year
|
def by_year
|
||||||
@by_year ||= default_hash
|
@by_year ||= default_hash
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,6 +29,18 @@ module GitStats
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def activity_by_month
|
||||||
|
Chart.new do |f|
|
||||||
|
f.simple_column_chart(
|
||||||
|
title: :commits_by_month.t,
|
||||||
|
y_text: :commits.t,
|
||||||
|
x_text: :month.t,
|
||||||
|
data_x: Date::ABBR_MONTHNAMES,
|
||||||
|
data_y: @activity.by_month_array
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ module GitStats
|
||||||
delegate :files_by_extension, :lines_by_extension, :files_by_date, :lines_by_date,
|
delegate :files_by_extension, :lines_by_extension, :files_by_date, :lines_by_date,
|
||||||
:lines_added_by_author, :lines_deleted_by_author, to: :repo_charts
|
:lines_added_by_author, :lines_deleted_by_author, to: :repo_charts
|
||||||
delegate :by_authors_wday, to: :authors_charts
|
delegate :by_authors_wday, to: :authors_charts
|
||||||
delegate :activity_by_hour, :activity_by_wday, to: :activity_charts
|
delegate :activity_by_hour, :activity_by_wday, :activity_by_month, to: :activity_charts
|
||||||
|
|
||||||
attr_reader :repo
|
attr_reader :repo
|
||||||
|
|
||||||
|
|
|
@ -1,48 +1,80 @@
|
||||||
.page-header
|
.tabbable.tabs-left
|
||||||
%h1.pagination-centered= :hour_of_day.t
|
%ul.nav.nav-tabs
|
||||||
%table{:class => "table table-bordered table-condensed"}
|
%li.active
|
||||||
%tr
|
%a{:href => '#hour_of_day', 'data-toogle' => 'tab'}= :hour_of_day.t
|
||||||
%th= :hour.t
|
%li
|
||||||
- (0..23).each do |h|
|
%a{:href => '#day_of_week', 'data-toogle' => 'tab'}= :day_of_week.t
|
||||||
%th= h
|
%li
|
||||||
%tr
|
%a{:href => '#hour_of_week', 'data-toogle' => 'tab'}= :hour_of_week.t
|
||||||
%th= :commits.t
|
%li
|
||||||
- repo.activity.by_hour_array.each do |commits|
|
%a{:href => '#month_of_year', 'data-toogle' => 'tab'}= :month_of_year.t
|
||||||
%td= commits
|
|
||||||
%tr
|
.tab-content
|
||||||
%th= :percentage.t
|
.tab-pane.active{id: 'hour_of_day'}
|
||||||
- repo.activity.by_hour_array.each do |commits|
|
.page-header
|
||||||
%td= (commits * 100.0 / repo.activity.by_hour_array.sum).round(2)
|
%h1.pagination-centered= :hour_of_day.t
|
||||||
= high_chart("activity_by_hour", charts.activity_by_hour)
|
%table{:class => "table table-bordered table-condensed"}
|
||||||
|
%tr
|
||||||
|
%th= :hour.t
|
||||||
|
- (0..23).each do |h|
|
||||||
|
%th= h
|
||||||
|
%tr
|
||||||
|
%th= :commits.t
|
||||||
|
- repo.activity.by_hour_array.each do |commits|
|
||||||
|
%td= commits
|
||||||
|
%tr
|
||||||
|
%th= :percentage.t
|
||||||
|
- repo.activity.by_hour_array.each do |commits|
|
||||||
|
%td= (commits * 100.0 / repo.activity.by_hour_array.sum).round(2)
|
||||||
|
= high_chart("activity_by_hour", charts.activity_by_hour)
|
||||||
|
|
||||||
|
.tab-pane{id: 'day_of_week'}
|
||||||
|
.page-header
|
||||||
|
%h1.pagination-centered= :day_of_week.t
|
||||||
|
%table{:class => "table table-bordered table-condensed"}
|
||||||
|
%tr
|
||||||
|
%th= :day.t
|
||||||
|
- Date::ABBR_DAYNAMES.each do |d|
|
||||||
|
%th= d
|
||||||
|
%tr
|
||||||
|
%th= :commits.t
|
||||||
|
- repo.activity.by_wday_array.each do |commits|
|
||||||
|
%td= commits
|
||||||
|
%tr
|
||||||
|
%th= :percentage.t
|
||||||
|
- repo.activity.by_wday_array.each do |commits|
|
||||||
|
%td= (commits * 100.0 / repo.activity.by_wday_array.sum).round(2)
|
||||||
|
= high_chart("activity_by_wday", charts.activity_by_wday)
|
||||||
|
|
||||||
|
|
||||||
.page-header
|
.tab-pane{id: 'hour_of_week'}
|
||||||
%h1.pagination-centered= :day_of_week.t
|
.page-header
|
||||||
%table{:class => "table table-bordered table-condensed"}
|
%h1.pagination-centered= :hour_of_week.t
|
||||||
%tr
|
%table{:class => "table table-bordered table-condensed"}
|
||||||
%th= :day.t
|
%tr
|
||||||
- Date::ABBR_DAYNAMES.each do |d|
|
%th
|
||||||
%th= d
|
- (0..23).each do |h|
|
||||||
%tr
|
%th= h
|
||||||
%th= :commits.t
|
- (0..6).each do |day|
|
||||||
- repo.activity.by_wday_array.each do |commits|
|
%tr
|
||||||
%td= commits
|
%th= Date::ABBR_DAYNAMES[day]
|
||||||
%tr
|
- (0..23).each do |hour|
|
||||||
%th= :percentage.t
|
%td= repo.activity.by_wday_hour[day][hour]
|
||||||
- repo.activity.by_wday_array.each do |commits|
|
|
||||||
%td= (commits * 100.0 / repo.activity.by_wday_array.sum).round(2)
|
|
||||||
= high_chart("activity_by_wday", charts.activity_by_wday)
|
|
||||||
|
|
||||||
|
.tab-pane{id: 'month_of_year'}
|
||||||
.page-header
|
.page-header
|
||||||
%h1.pagination-centered= :hour_of_week.t
|
%h1.pagination-centered= :month_of_year.t
|
||||||
%table{:class => "table table-bordered table-condensed"}
|
%table{:class => "table table-bordered table-condensed"}
|
||||||
%tr
|
%tr
|
||||||
%th
|
%th= :day.t
|
||||||
- (0..23).each do |h|
|
- Date::ABBR_MONTHNAMES.each do |m|
|
||||||
%th= h
|
%th= m
|
||||||
- (0..6).each do |day|
|
%tr
|
||||||
%tr
|
%th= :commits.t
|
||||||
%th= Date::ABBR_DAYNAMES[day]
|
- repo.activity.by_month_array.each do |commits|
|
||||||
- (0..23).each do |hour|
|
%td= commits
|
||||||
%td= repo.activity.by_wday_hour[day][hour]
|
%tr
|
||||||
|
%th= :percentage.t
|
||||||
|
- repo.activity.by_month_array.each do |commits|
|
||||||
|
%td= (commits * 100.0 / repo.activity.by_month_array.sum).round(2)
|
||||||
|
= high_chart("activity_by_month", charts.activity_by_month)
|
||||||
|
|
|
@ -11,6 +11,14 @@
|
||||||
%script{:src => "assets/jquery.min.js", :type => "text/javascript"}
|
%script{:src => "assets/jquery.min.js", :type => "text/javascript"}
|
||||||
%script{:src => "assets/bootstrap/js/bootstrap.min.js", :type => "text/javascript"}
|
%script{:src => "assets/bootstrap/js/bootstrap.min.js", :type => "text/javascript"}
|
||||||
%script{:src => "assets/highstock.js", :type => "text/javascript"}
|
%script{:src => "assets/highstock.js", :type => "text/javascript"}
|
||||||
|
%script
|
||||||
|
:plain
|
||||||
|
$(function() {
|
||||||
|
$('.tabbable ul a').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).tab('show');
|
||||||
|
})
|
||||||
|
});
|
||||||
%body
|
%body
|
||||||
%div.navbar.navbar-inverse.navbar-fixed-top
|
%div.navbar.navbar-inverse.navbar-fixed-top
|
||||||
%div.navbar-inner
|
%div.navbar-inner
|
||||||
|
|
Loading…
Reference in a new issue