git_stats/templates/activity/_activity.haml

101 lines
3.9 KiB
Text
Raw Normal View History

2012-10-21 20:05:12 +02:00
.tabbable.tabs-left
%ul.nav.nav-tabs
2012-10-22 19:50:31 +02:00
%li{class: page == :activity_by_date ? "active" : "" }
%a{href: "by_date.html"}= :activity_by_date.t
%li{class: page == :hour_of_day ? "active" : "" }
%a{href: "hour_of_day.html"}= :hour_of_day.t
%li{class: page == :day_of_week ? "active" : "" }
%a{href: "day_of_week.html"}= :day_of_week.t
%li{class: page == :hour_of_week ? "active" : "" }
%a{href: "hour_of_week.html"}= :hour_of_week.t
%li{class: page == :month_of_year ? "active" : "" }
%a{href: "month_of_year.html"}= :month_of_year.t
%li{class: page == :year ? "active" : "" }
%a{href: "year.html"}= :year.t
%li{class: page == :year_month ? "active" : "" }
%a{href: "year_month.html"}= :year_month.t
2012-10-21 20:05:12 +02:00
.tab-content
2012-10-22 19:50:31 +02:00
.tab-pane.active
.page-header.pagination-centered
%h1= page.t
%h3= "#{author.respond_to?(:name) ? author.name : ""} #{author.respond_to?(:email) ? "<#{author.email}>" : ""}"
2012-10-22 19:50:31 +02:00
- if page == :activity_by_date
= high_stock("charts.activity_by_date", charts.activity_by_date(author))
2012-10-21 20:05:12 +02:00
2012-10-22 19:50:31 +02:00
- elsif page == :hour_of_day
2012-10-21 20:05:12 +02:00
%table{:class => "table table-bordered table-condensed"}
%tr
%th= :hour.t
- (0..23).each do |h|
%th= h
%tr
%th= :commits.t
- author.activity.by_hour_array.each do |commits|
%td= commits
%tr
%th= :percentage.t
- author.activity.by_hour_array.each do |commits|
%td= (commits * 100.0 / author.activity.by_hour_array.sum).round(1)
2012-10-22 19:50:31 +02:00
= high_chart("charts.activity_by_hour", charts.activity_by_hour(author))
2012-10-21 20:05:12 +02:00
2012-10-22 19:50:31 +02:00
- elsif page == :day_of_week
2012-10-21 20:05:12 +02:00
%table{:class => "table table-bordered table-condensed"}
%tr
%th= :day.t
2012-10-22 23:18:54 +02:00
- I18n.t('date.abbr_day_names').each do |d|
2012-10-21 20:05:12 +02:00
%th= d
%tr
%th= :commits.t
- author.activity.by_wday_array.each do |commits|
%td= commits
%tr
%th= :percentage.t
- author.activity.by_wday_array.each do |commits|
%td= (commits * 100.0 / author.activity.by_wday_array.sum).round(1)
2012-10-22 19:50:31 +02:00
= high_chart("charts.activity_by_wday", charts.activity_by_wday(author))
2012-10-21 20:05:12 +02:00
2012-10-22 19:50:31 +02:00
- elsif page == :hour_of_week
2012-10-21 20:05:12 +02:00
%table{:class => "table table-bordered table-condensed"}
%tr
%th
- (0..23).each do |h|
%th= h
2012-10-22 19:50:31 +02:00
- max = author.activity.by_wday_hour.values.map {|h| h.values.empty? ? 0 : h.values.max }.max
2012-10-21 20:05:12 +02:00
- (0..6).each do |day|
%tr
2012-10-22 23:18:54 +02:00
%th= I18n.t('date.abbr_day_names')[day]
2012-10-21 20:05:12 +02:00
- (0..23).each do |hour|
2012-10-22 19:50:31 +02:00
- color = max ? "%02x" % (255 - author.activity.by_wday_hour[day][hour] * 100 / max) : "FF"
2012-10-21 21:33:44 +02:00
%td{style: "background-color: ##{color}#{color}#{color};"}= author.activity.by_wday_hour[day][hour]
2012-10-21 20:05:12 +02:00
2012-10-22 19:50:31 +02:00
- elsif page == :month_of_year
2012-10-21 20:05:12 +02:00
%table{:class => "table table-bordered table-condensed"}
%tr
2012-10-22 19:50:31 +02:00
%th= :month.t
2012-10-22 23:18:54 +02:00
- I18n.t('date.abbr_month_names')[1..-1].each do |m|
2012-10-21 20:05:12 +02:00
%th= m
%tr
%th= :commits.t
- author.activity.by_month_array.each do |commits|
%td= commits
%tr
%th= :percentage.t
- author.activity.by_month_array.each do |commits|
%td= (commits * 100.0 / author.activity.by_month_array.sum).round(1)
2012-10-22 19:50:31 +02:00
= high_chart("charts.activity_by_month", charts.activity_by_month(author))
2012-10-21 20:05:12 +02:00
2012-10-22 19:50:31 +02:00
- elsif page == :year
= high_chart("charts.activity_by_year", charts.activity_by_year(author))
2012-10-21 20:05:12 +02:00
2012-10-22 19:50:31 +02:00
- elsif page == :year_month
2012-10-21 20:05:12 +02:00
%table{:class => "table table-bordered table-condensed"}
%tr
%th
2012-10-22 23:18:54 +02:00
- I18n.t('date.abbr_month_names')[1..-1].each do |h|
2012-10-21 20:05:12 +02:00
%th= h
- author.activity.by_year_month.each do |year, months|
%tr
%th= year
- (1..12).each do |month|
%td= months[month]