This commit is contained in:
Tomasz Gieniusz 2012-10-21 14:36:13 +02:00
parent 470bcd4ecf
commit 65bbdfa87a
5 changed files with 26 additions and 3 deletions

View File

@ -23,4 +23,8 @@ en:
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: Month
month_of_year: Month of year month_of_year: Month of year
commits_by_wday: Commits by day of week
commits_by_month: Commits by month of year
year: Year
commits_by_year: Commits by year

View File

@ -41,6 +41,17 @@ module GitStats
) )
end end
end end
def activity_by_year
Chart.new do |f|
f.column_hash_chart(
title: :commits_by_year.t,
y_text: :commits.t,
x_text: :year.t,
data: @activity.by_year
)
end
end
end end
end end
end end

View File

@ -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, :activity_by_month, to: :activity_charts delegate :activity_by_hour, :activity_by_wday, :activity_by_month, :activity_by_year, to: :activity_charts
attr_reader :repo attr_reader :repo

View File

@ -8,6 +8,8 @@
%a{:href => '#hour_of_week', 'data-toogle' => 'tab'}= :hour_of_week.t %a{:href => '#hour_of_week', 'data-toogle' => 'tab'}= :hour_of_week.t
%li %li
%a{:href => '#month_of_year', 'data-toogle' => 'tab'}= :month_of_year.t %a{:href => '#month_of_year', 'data-toogle' => 'tab'}= :month_of_year.t
%li
%a{:href => '#year', 'data-toogle' => 'tab'}= :year.t
.tab-content .tab-content
.tab-pane.active{id: 'hour_of_day'} .tab-pane.active{id: 'hour_of_day'}
@ -78,3 +80,9 @@
- repo.activity.by_month_array.each do |commits| - repo.activity.by_month_array.each do |commits|
%td= (commits * 100.0 / repo.activity.by_month_array.sum).round(2) %td= (commits * 100.0 / repo.activity.by_month_array.sum).round(2)
= high_chart("activity_by_month", charts.activity_by_month) = high_chart("activity_by_month", charts.activity_by_month)
.tab-pane{id: 'year'}
.page-header
%h1.pagination-centered= :year.t
= high_chart("activity_by_year", charts.activity_by_year)

View File

@ -21,7 +21,7 @@
}) })
}); });
%body %body
%div.navbar.navbar-inverse.navbar-fixed-top %div.navbar.navbar-fixed-top
%div.navbar-inner %div.navbar-inner
%div.container %div.container
%a.btn.btn-navbar{'data-toggle' => "collapse", 'data-target' => ".nav-collapse"} %a.btn.btn-navbar{'data-toggle' => "collapse", 'data-target' => ".nav-collapse"}