templates/activity/_activity.haml
.tabbable.tabs-left
%ul.nav.nav-tabs
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :activity_by_date ? 'active' : '', href: 'by_date.html'}= :activity_by_date.t
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :hour_of_day ? 'active' : '', href: 'hour_of_day.html'}= :hour_of_day.t
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :day_of_week ? 'active' : '', href: 'day_of_week.html'}= :day_of_week.t
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :hour_of_week ? 'active' : '', href: 'hour_of_week.html'}= :hour_of_week.t
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :month_of_year ? 'active' : '', href: 'month_of_year.html'}= :month_of_year.t
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :year ? 'active' : '', href: 'year.html'}= :year.t
%li.nav-item{role: 'presentation'}
%a.nav-link{class: page == :year_month ? 'active' : '', href: 'year_month.html'}= :year_month.t
.tab-content
.tab-pane.active
.page-header.text-center
%h1= page.t
%h3 #{author.respond_to?(:name) ? author.name : ''} #{author.respond_to?(:email) ? "<#{author.email}>" : ''}
- case page
- when :activity_by_date
= high_stock('charts.activity_by_date', charts.activity_by_date(author))
- when :hour_of_day
%table{class: 'table table-bordered table-condensed'}
%tr
%th= :hour.t
- 24.times 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)
= high_chart('charts.activity_by_hour', charts.activity_by_hour(author))
- when :day_of_week
%table{class: 'table table-bordered table-condensed'}
%tr
%th= :day.t
- I18n.t('date.abbr_day_names').each do |d|
%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)
= high_chart('charts.activity_by_wday', charts.activity_by_wday(author))
- when :hour_of_week
%table{class: 'table table-bordered table-condensed'}
%tr
%th
- 24.times do |h|
%th= h
- max = author.activity.by_wday_hour.values.map { |h| h.values.empty? ? 0 : h.values.max }.max
- 7.times do |day|
%tr
%th= I18n.t('date.abbr_day_names')[day]
- 24.times do |hour|
- color = max ? format('%02x', 255 - author.activity.by_wday_hour[day][hour] * 100 / max) : 'FF'
%td{style: "background-color: ##{color}#{color}#{color};"}= author.activity.by_wday_hour[day][hour]
- when :month_of_year
%table{class: 'table table-bordered table-condensed'}
%tr
%th= :month.t
- I18n.t('date.abbr_month_names')[1..-1].each do |m|
%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)
= high_chart('charts.activity_by_month', charts.activity_by_month(author))
- when :year
= high_chart('charts.activity_by_year', charts.activity_by_year(author))
- when :year_month
%table{class: 'table table-bordered table-condensed'}
%tr
%th
- I18n.t('date.abbr_month_names')[1..-1].each do |h|
%th= h
- author.activity.by_year_month.each do |year, months|
%tr
%th= year
- (1..12).each do |month|
%td= months[month]