mirror of
https://github.com/tomgi/git_stats.git
synced 2024-12-22 13:32:17 +01:00
seperate pages instead of tabs
This commit is contained in:
parent
b1713e3bff
commit
07fac90986
37 changed files with 247 additions and 234 deletions
|
@ -49,6 +49,6 @@ en:
|
|||
first_commit: First_commit
|
||||
last_commit: Last commit
|
||||
author: Author
|
||||
show_more: Show more
|
||||
show_more: More
|
||||
close: Close
|
||||
more_data_not_available: More data not available
|
|
@ -6,6 +6,7 @@ require 'action_pack'
|
|||
require 'action_view'
|
||||
require 'fileutils'
|
||||
require 'tilt'
|
||||
require 'pathname'
|
||||
#require 'lazy_high_charts'
|
||||
require 'launchy'
|
||||
require 'i18n'
|
||||
|
|
|
@ -49,6 +49,10 @@ module GitStats
|
|||
@activity ||= Activity.new(commits)
|
||||
end
|
||||
|
||||
def dirname
|
||||
@name.underscore.split.join '_'
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{self.class} #@name <#@email>"
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ module GitStats
|
|||
|
||||
def render(data, params={})
|
||||
if @layout
|
||||
@layout.render(data, :active_page => @name, :all_templates => params[:all_templates]) { @template.render(data, params) }
|
||||
@layout.render(data, :active_page => params[:active_page] || @name, :links => params[:links]) { @template.render(data, params) }
|
||||
else
|
||||
@template.render(data, params)
|
||||
end
|
||||
|
|
|
@ -3,25 +3,59 @@ module GitStats
|
|||
class View
|
||||
def initialize(view_data, out_path)
|
||||
@view_data, @out_path = view_data, out_path
|
||||
@layout = Tilt.new("templates/layout.haml")
|
||||
end
|
||||
|
||||
def render_all
|
||||
prepare_static_content
|
||||
prepare_assets
|
||||
|
||||
layout = Tilt.new("templates/layout.haml")
|
||||
|
||||
all_templates.each do |template|
|
||||
output = Template.new(template, layout).render(@view_data, all_templates: all_templates)
|
||||
File.open("#@out_path/#{template}.html", 'w') { |f| f.write output }
|
||||
output = Template.new(template, @layout).render(@view_data, author: @view_data.repo, links: links)
|
||||
write(output, "#@out_path/#{template}.html")
|
||||
end
|
||||
|
||||
render_authors_activity
|
||||
end
|
||||
|
||||
def render_authors_activity
|
||||
done = []
|
||||
@view_data.repo.authors.sort_by { |a| -a.commits.size }.each do |author|
|
||||
next if done.include? author.dirname
|
||||
done << author.dirname
|
||||
all_templates('activity/').each do |template|
|
||||
output = Template.new(template, @layout).render(@view_data,
|
||||
author: author,
|
||||
links: links,
|
||||
active_page: "/authors/#{author.dirname}/#{template}")
|
||||
write(output, "#@out_path/authors/#{author.dirname}/#{template}.html")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def all_templates(root = '')
|
||||
Dir["templates/#{root}**/[^_]*.haml"].map {
|
||||
|f| Pathname.new(f)
|
||||
}.map { |f|
|
||||
f.relative_path_from(Pathname.new('templates')).sub_ext('')
|
||||
}.map(&:to_s) - %w(layout)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def all_templates
|
||||
%w(general activity authors files lines)
|
||||
def write(output, write_file)
|
||||
FileUtils.mkdir_p(File.dirname(write_file))
|
||||
File.open(write_file, 'w') { |f| f.write output }
|
||||
end
|
||||
|
||||
def links
|
||||
{
|
||||
'General' => 'general.html',
|
||||
'Activity' => 'activity/by_date.html',
|
||||
'Authors' => 'authors/best_authors.html',
|
||||
'Files' => 'files/by_date.html',
|
||||
'Lines' => 'lines/by_date.html'
|
||||
}
|
||||
end
|
||||
|
||||
def prepare_static_content
|
||||
|
|
|
@ -13,10 +13,18 @@ module GitStats
|
|||
@charts ||= Charts::All.new(repo)
|
||||
end
|
||||
|
||||
def render(template_name, params = {})
|
||||
def render_partial(template_name, params = {})
|
||||
Template.new(template_name).render(self, params)
|
||||
end
|
||||
|
||||
def asset_path(asset, active_page)
|
||||
Pathname.new("/assets/#{asset}").relative_path_from(Pathname.new("/#{active_page}").dirname)
|
||||
end
|
||||
|
||||
def link_to(href, active_page)
|
||||
Pathname.new("/#{href}").relative_path_from(Pathname.new("/#{active_page}").dirname)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -8,7 +8,7 @@ describe GitStats::GitData::Commit do
|
|||
before {
|
||||
commit.repo.should_receive(:run).with('git ls-tree -r abc').and_return("100644 blob 5ade7ad51a75ee7db4eb06cecd3918d38134087d lib/git_stats/git_data/commit.rb
|
||||
100644 blob db01e94677a8f72289848e507a52a43de2ea109a lib/git_stats/git_data/repo.rb
|
||||
100644 blob 1463eacb3ac9f95f21f360f1eb935a84a9ee0895 templates/activity.haml
|
||||
100644 blob 1463eacb3ac9f95f21f360f1eb935a84a9ee0895 templates/index.haml
|
||||
100644 blob 31d8b960a67f195bdedaaf9e7aa70b2389f3f1a8 templates/assets/bootstrap/css/bootstrap.min.css
|
||||
") }
|
||||
|
||||
|
@ -16,7 +16,7 @@ describe GitStats::GitData::Commit do
|
|||
commit.files.should == [
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "5ade7ad51a75ee7db4eb06cecd3918d38134087d", filename: "lib/git_stats/git_data/commit.rb"),
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "db01e94677a8f72289848e507a52a43de2ea109a", filename: "lib/git_stats/git_data/repo.rb"),
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "1463eacb3ac9f95f21f360f1eb935a84a9ee0895", filename: "templates/activity.haml"),
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "1463eacb3ac9f95f21f360f1eb935a84a9ee0895", filename: "templates/index.haml"),
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "31d8b960a67f195bdedaaf9e7aa70b2389f3f1a8", filename: "templates/assets/bootstrap/css/bootstrap.min.css"),
|
||||
]
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ describe GitStats::GitData::Commit do
|
|||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "5ade7ad51a75ee7db4eb06cecd3918d38134087d", filename: "lib/git_stats/git_data/commit.rb"),
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "db01e94677a8f72289848e507a52a43de2ea109a", filename: "lib/git_stats/git_data/repo.rb")
|
||||
], '.haml' => [
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "1463eacb3ac9f95f21f360f1eb935a84a9ee0895", filename: "templates/activity.haml")
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "1463eacb3ac9f95f21f360f1eb935a84a9ee0895", filename: "templates/index.haml")
|
||||
], '.css' => [
|
||||
GitStats::GitData::Blob.new(repo: commit.repo, sha: "31d8b960a67f195bdedaaf9e7aa70b2389f3f1a8", filename: "templates/assets/bootstrap/css/bootstrap.min.css")
|
||||
]
|
||||
|
|
9
spec/stats_view/view_spec.rb
Normal file
9
spec/stats_view/view_spec.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe GitStats::StatsView::View do
|
||||
let(:view) { GitStats::StatsView::View.new(double('view_data'), 'out_path') }
|
||||
|
||||
it 'should find all haml except partials and layout in templates directory' do
|
||||
view.all_templates.should =~ %w(files activity/index general authors lines)
|
||||
end
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
= render '_activity', author: repo
|
|
@ -1,30 +1,29 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li.active
|
||||
%a{:href => "#activity_by_date-#{author.hash}", 'data-toogle' => 'tab'}= :activity_by_date.t
|
||||
%li
|
||||
%a{:href => "#hour_of_day-#{author.hash}", 'data-toogle' => 'tab'}= :hour_of_day.t
|
||||
%li
|
||||
%a{:href => "#day_of_week-#{author.hash}", 'data-toogle' => 'tab'}= :day_of_week.t
|
||||
%li
|
||||
%a{:href => "#hour_of_week-#{author.hash}", 'data-toogle' => 'tab'}= :hour_of_week.t
|
||||
%li
|
||||
%a{:href => "#month_of_year-#{author.hash}", 'data-toogle' => 'tab'}= :month_of_year.t
|
||||
%li
|
||||
%a{:href => "#year-#{author.hash}", 'data-toogle' => 'tab'}= :year.t
|
||||
%li
|
||||
%a{:href => "#year_month-#{author.hash}", 'data-toogle' => 'tab'}= :year_month.t
|
||||
%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
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active{id: "activity_by_date-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :activity_by_date.t
|
||||
= high_stock("charts.activity_by_date-#{author.hash}", charts.activity_by_date(author))
|
||||
.tab-pane.active
|
||||
.page-header.pagination-centered
|
||||
%h1= page.t
|
||||
%h3= author.respond_to?(:name) ? author.name : ""
|
||||
- if page == :activity_by_date
|
||||
= high_stock("charts.activity_by_date", charts.activity_by_date(author))
|
||||
|
||||
|
||||
.tab-pane{id: "hour_of_day-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :hour_of_day.t
|
||||
- elsif page == :hour_of_day
|
||||
%table{:class => "table table-bordered table-condensed"}
|
||||
%tr
|
||||
%th= :hour.t
|
||||
|
@ -38,11 +37,9 @@
|
|||
%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-#{author.hash}", charts.activity_by_hour(author))
|
||||
= high_chart("charts.activity_by_hour", charts.activity_by_hour(author))
|
||||
|
||||
.tab-pane{id: "day_of_week-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :day_of_week.t
|
||||
- elsif page == :day_of_week
|
||||
%table{:class => "table table-bordered table-condensed"}
|
||||
%tr
|
||||
%th= :day.t
|
||||
|
@ -56,32 +53,26 @@
|
|||
%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-#{author.hash}", charts.activity_by_wday(author))
|
||||
= high_chart("charts.activity_by_wday", charts.activity_by_wday(author))
|
||||
|
||||
|
||||
.tab-pane{id: "hour_of_week-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :hour_of_week.t
|
||||
- elsif page == :hour_of_week
|
||||
%table{:class => "table table-bordered table-condensed"}
|
||||
%tr
|
||||
%th
|
||||
- (0..23).each do |h|
|
||||
%th= h
|
||||
- max = author.activity.by_wday_hour.values.map {|h| h.values.max }.max
|
||||
- max = author.activity.by_wday_hour.values.map {|h| h.values.empty? ? 0 : h.values.max }.max
|
||||
- (0..6).each do |day|
|
||||
%tr
|
||||
%th= Date::ABBR_DAYNAMES[day]
|
||||
- (0..23).each do |hour|
|
||||
- color = "%02x" % (255 - author.activity.by_wday_hour[day][hour] * 100 / max)
|
||||
- color = max ? "%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]
|
||||
|
||||
|
||||
.tab-pane{id: "month_of_year-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :month_of_year.t
|
||||
- elsif page == :month_of_year
|
||||
%table{:class => "table table-bordered table-condensed"}
|
||||
%tr
|
||||
%th= :day.t
|
||||
%th= :month.t
|
||||
- Date::ABBR_MONTHNAMES[1..-1].each do |m|
|
||||
%th= m
|
||||
%tr
|
||||
|
@ -92,18 +83,12 @@
|
|||
%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-#{author.hash}", charts.activity_by_month(author))
|
||||
= high_chart("charts.activity_by_month", charts.activity_by_month(author))
|
||||
|
||||
- elsif page == :year
|
||||
= high_chart("charts.activity_by_year", charts.activity_by_year(author))
|
||||
|
||||
.tab-pane{id: "year-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :year.t
|
||||
= high_chart("charts.activity_by_year-#{author.hash}", charts.activity_by_year(author))
|
||||
|
||||
|
||||
.tab-pane{id: "year_month-#{author.hash}"}
|
||||
.page-header
|
||||
%h1.pagination-centered= :year_month.t
|
||||
- elsif page == :year_month
|
||||
%table{:class => "table table-bordered table-condensed"}
|
||||
%tr
|
||||
%th
|
1
templates/activity/by_date.haml
Normal file
1
templates/activity/by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :activity_by_date, author: author)
|
1
templates/activity/day_of_week.haml
Normal file
1
templates/activity/day_of_week.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :day_of_week, author: author)
|
1
templates/activity/hour_of_day.haml
Normal file
1
templates/activity/hour_of_day.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :hour_of_day, author: author)
|
1
templates/activity/hour_of_week.haml
Normal file
1
templates/activity/hour_of_week.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :hour_of_week, author: author)
|
1
templates/activity/month_of_year.haml
Normal file
1
templates/activity/month_of_year.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :month_of_year, author: author)
|
1
templates/activity/year.haml
Normal file
1
templates/activity/year.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :year, author: author)
|
1
templates/activity/year_month.haml
Normal file
1
templates/activity/year_month.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('activity/_activity', page: :year_month, author: author)
|
|
@ -1,112 +0,0 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li.active
|
||||
%a{:href => '#best_authors', 'data-toogle' => 'tab'}= :best_authors.t
|
||||
%li
|
||||
%a{:href => '#commits_count_by_author', 'data-toogle' => 'tab'}= :commits_count_by_author.t
|
||||
%li
|
||||
%a{:href => '#changed_lines_by_author', 'data-toogle' => 'tab'}= :changed_lines_by_author.t
|
||||
%li
|
||||
%a{:href => '#insertions_by_author', 'data-toogle' => 'tab'}= :insertions_by_author.t
|
||||
%li
|
||||
%a{:href => '#deletions_by_author', 'data-toogle' => 'tab'}= :deletions_by_author.t
|
||||
%li
|
||||
%a{:href => '#commits_sum_by_author_by_date', 'data-toogle' => 'tab'}= :commits_sum_by_author_by_date.t
|
||||
%li
|
||||
%a{:href => '#changed_lines_by_author_by_date', 'data-toogle' => 'tab'}= :changed_lines_by_author_by_date.t
|
||||
%li
|
||||
%a{:href => '#insertions_by_author_by_date', 'data-toogle' => 'tab'}= :insertions_by_author_by_date.t
|
||||
%li
|
||||
%a{:href => '#deletions_by_author_by_date', 'data-toogle' => 'tab'}= :deletions_by_author_by_date.t
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active{id: 'best_authors'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :best_authors.t
|
||||
%table{:class => "table table-bordered table-condensed table-hover"}
|
||||
%tr
|
||||
%th= :author.t
|
||||
%th= :commits.t
|
||||
%th= :insertions.t
|
||||
%th= :deletions.t
|
||||
%th= :first_commit.t
|
||||
%th= :last_commit.t
|
||||
%th
|
||||
- sorted_authors = repo.authors.sort_by { |a| -a.commits.size}
|
||||
- sorted_authors.each_with_index do |author, i|
|
||||
%tr
|
||||
%th= author.name
|
||||
%td= author.commits.size
|
||||
%td= author.insertions
|
||||
%td= author.deletions
|
||||
%td= author.commits.first.try(:date).try(:to_formatted_s, :long)
|
||||
%td= author.commits.last.try(:date).try(:to_formatted_s, :long)
|
||||
%td
|
||||
- if i <= 4
|
||||
%a.btn{:href => "##{author.hash}-modal", :role => "button", 'data-toggle'=>"modal"}= :show_more.t
|
||||
- else
|
||||
= :more_data_not_available.t
|
||||
- sorted_authors[0..4].each do |author|
|
||||
.modal.hide{:id => "#{author.hash}-modal", :role => "dialog", :style => "width: 1140px; margin-left:-570px; top: 35%; "}
|
||||
.modal-header
|
||||
%h1.pagination-centered= "#{author.name} <#{author.email}>"
|
||||
.modal-body{:style => "height: 620px; max-height: 80%;"}
|
||||
= render '_activity', author: author
|
||||
.modal-footer
|
||||
%a.btn{'data-dismiss' => "modal"}= :close.t
|
||||
|
||||
.tab-pane{id: 'commits_count_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :commits_count_by_author.t
|
||||
= high_chart("charts.commits_count_by_author", charts.commits_count_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'changed_lines_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :changed_lines_by_author.t
|
||||
= high_chart("charts.changed_lines_by_author", charts.changed_lines_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'insertions_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :insertions_by_author.t
|
||||
= high_chart("charts.insertions_by_author", charts.insertions_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'deletions_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :deletions_by_author.t
|
||||
= high_chart("charts.deletions_by_author", charts.deletions_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'commits_sum_by_author_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :commits_sum_by_author_by_date.t
|
||||
= high_stock("charts.commits_sum_by_author_by_date", charts.commits_sum_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'insertions_by_author_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :insertions_by_author_by_date.t
|
||||
= high_stock("charts.insertions_by_author_by_date", charts.insertions_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'changed_lines_by_author_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :changed_lines_by_author_by_date.t
|
||||
= high_stock("charts.changed_lines_by_author_by_date", charts.changed_lines_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'deletions_by_author_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :deletions_by_author_by_date.t
|
||||
= high_stock("charts.deletions_by_author_by_date", charts.deletions_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
87
templates/authors/_authors.haml
Normal file
87
templates/authors/_authors.haml
Normal file
|
@ -0,0 +1,87 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li{class: page == :best_authors ? "active" : ""}
|
||||
%a{href: 'best_authors.html'}= :best_authors.t
|
||||
%li{class: page == :commits_count_by_author ? "active" : ""}
|
||||
%a{href: 'commits_count_by_author.html'}= :commits_count_by_author.t
|
||||
%li{class: page == :changed_lines_by_author ? "active" : ""}
|
||||
%a{href: 'changed_lines_by_author.html'}= :changed_lines_by_author.t
|
||||
%li{class: page == :insertions_by_author ? "active" : ""}
|
||||
%a{href: 'insertions_by_author.html'}= :insertions_by_author.t
|
||||
%li{class: page == :deletions_by_author ? "active" : ""}
|
||||
%a{href: 'deletions_by_author.html'}= :deletions_by_author.t
|
||||
%li{class: page == :commits_sum_by_author_by_date ? "active" : ""}
|
||||
%a{href: 'commits_sum_by_author_by_date.html'}= :commits_sum_by_author_by_date.t
|
||||
%li{class: page == :changed_lines_by_author_by_date ? "active" : ""}
|
||||
%a{href: 'changed_lines_by_author_by_date.html'}= :changed_lines_by_author_by_date.t
|
||||
%li{class: page == :insertions_by_author_by_date ? "active" : ""}
|
||||
%a{href: 'insertions_by_author_by_date.html'}= :insertions_by_author_by_date.t
|
||||
%li{class: page == :deletions_by_author_by_date ? "active" : ""}
|
||||
%a{href: 'deletions_by_author_by_date.html'}= :deletions_by_author_by_date.t
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active
|
||||
.page-header
|
||||
%h1.pagination-centered= page.t
|
||||
|
||||
- if page == :best_authors
|
||||
%table{:class => "table table-bordered table-condensed table-hover"}
|
||||
%tr
|
||||
%th= :author.t
|
||||
%th= :commits.t
|
||||
%th= :insertions.t
|
||||
%th= :deletions.t
|
||||
%th= :first_commit.t
|
||||
%th= :last_commit.t
|
||||
%th
|
||||
- sorted_authors = repo.authors.sort_by { |a| -a.commits.size}
|
||||
- sorted_authors.each_with_index do |author, i|
|
||||
%tr
|
||||
%th= author.name
|
||||
%td= author.commits.size
|
||||
%td= author.insertions
|
||||
%td= author.deletions
|
||||
%td= author.commits.first.try(:date).try(:to_formatted_s, :long)
|
||||
%td= author.commits.last.try(:date).try(:to_formatted_s, :long)
|
||||
%td
|
||||
%a.btn{:href => "#{author.dirname}/activity/by_date.html"}= :show_more.t
|
||||
|
||||
-elsif page == :commits_count_by_author
|
||||
= high_chart("charts.commits_count_by_author", charts.commits_count_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :changed_lines_by_author
|
||||
= high_chart("charts.changed_lines_by_author", charts.changed_lines_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :insertions_by_author
|
||||
= high_chart("charts.insertions_by_author", charts.insertions_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :deletions_by_author
|
||||
= high_chart("charts.deletions_by_author", charts.deletions_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :commits_sum_by_author_by_date
|
||||
= high_stock("charts.commits_sum_by_author_by_date", charts.commits_sum_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :changed_lines_by_author_by_date
|
||||
= high_stock("charts.changed_lines_by_author_by_date", charts.changed_lines_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :insertions_by_author_by_date
|
||||
= high_stock("charts.insertions_by_author_by_date", charts.insertions_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
-elsif page == :deletions_by_author_by_date
|
||||
= high_stock("charts.deletions_by_author_by_date", charts.deletions_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
1
templates/authors/best_authors.haml
Normal file
1
templates/authors/best_authors.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :best_authors)
|
1
templates/authors/changed_lines_by_author.haml
Normal file
1
templates/authors/changed_lines_by_author.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :changed_lines_by_author)
|
1
templates/authors/changed_lines_by_author_by_date.haml
Normal file
1
templates/authors/changed_lines_by_author_by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :changed_lines_by_author_by_date)
|
1
templates/authors/commits_count_by_author.haml
Normal file
1
templates/authors/commits_count_by_author.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :commits_count_by_author)
|
1
templates/authors/commits_sum_by_author_by_date.haml
Normal file
1
templates/authors/commits_sum_by_author_by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :commits_sum_by_author_by_date)
|
1
templates/authors/deletions_by_author.haml
Normal file
1
templates/authors/deletions_by_author.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :deletions_by_author)
|
1
templates/authors/deletions_by_author_by_date.haml
Normal file
1
templates/authors/deletions_by_author_by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :deletions_by_author_by_date)
|
1
templates/authors/insertions_by_author.haml
Normal file
1
templates/authors/insertions_by_author.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :insertions_by_author)
|
1
templates/authors/insertions_by_author_by_date.haml
Normal file
1
templates/authors/insertions_by_author_by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('authors/_authors', page: :insertions_by_author_by_date)
|
|
@ -1,18 +0,0 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li.active
|
||||
%a{:href => '#files_by_date', 'data-toogle' => 'tab'}= :files_by_date.t
|
||||
%li
|
||||
%a{:href => '#files_by_extension', 'data-toogle' => 'tab'}= :files_by_extension.t
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active{id: 'files_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :files_by_date.t
|
||||
= high_stock("charts.files_by_date", charts.files_by_date)
|
||||
|
||||
|
||||
.tab-pane{id: 'files_by_extension'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :files_by_extension.t
|
||||
= high_chart("charts.files_by_extension", charts.files_by_extension)
|
15
templates/files/_files.haml
Normal file
15
templates/files/_files.haml
Normal file
|
@ -0,0 +1,15 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li{class: page == :files_by_date ? "active" : ""}
|
||||
%a{:href => 'by_date.html'}= :files_by_date.t
|
||||
%li{class: page == :files_by_extension ? "active" : ""}
|
||||
%a{:href => 'by_extension.html'}= :files_by_extension.t
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active
|
||||
.page-header
|
||||
%h1.pagination-centered= page.t
|
||||
- if page == :files_by_date
|
||||
= high_stock("files_by_date", charts.files_by_date)
|
||||
- elsif page == :files_by_extension
|
||||
= high_chart("files_by_extension", charts.files_by_extension)
|
1
templates/files/by_date.haml
Normal file
1
templates/files/by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('files/_files', page: :files_by_date)
|
1
templates/files/by_extension.haml
Normal file
1
templates/files/by_extension.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('files/_files', page: :files_by_extension)
|
|
@ -3,30 +3,14 @@
|
|||
%html
|
||||
%head
|
||||
%title= "GitStats - #{repo.project_name}"
|
||||
%link{:rel => "stylesheet", :href => "assets/bootstrap/css/bootstrap.min.css", :type => "text/css"}
|
||||
%link{:rel => "stylesheet", :href => asset_path('bootstrap/css/bootstrap.min.css', active_page), :type => "text/css"}
|
||||
%style
|
||||
:plain
|
||||
body { padding-top: 60px; }
|
||||
%link{:rel => "stylesheet", :href => "assets/bootstrap/css/bootstrap-responsive.min.css", :type => "text/css"}
|
||||
%script{:src => "assets/jquery.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
|
||||
:plain
|
||||
$(function() {
|
||||
$('.tabbable ul a').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).tab('show');
|
||||
var ev = document.createEvent('Event');
|
||||
ev.initEvent('resize', true, true);
|
||||
window.dispatchEvent(ev);
|
||||
});
|
||||
$('.modal').on('shown', function (e) {
|
||||
var ev = document.createEvent('Event');
|
||||
ev.initEvent('resize', true, true);
|
||||
window.dispatchEvent(ev);
|
||||
});
|
||||
});
|
||||
%link{:rel => "stylesheet", :href => asset_path('bootstrap/css/bootstrap-responsive.min.css', active_page), :type => "text/css"}
|
||||
%script{:src => asset_path('jquery.min.js', active_page), :type => "text/javascript"}
|
||||
%script{:src => asset_path('bootstrap/js/bootstrap.min.js', active_page), :type => "text/javascript"}
|
||||
%script{:src => asset_path('highstock.js', active_page), :type => "text/javascript"}
|
||||
%body
|
||||
%div.navbar.navbar-fixed-top
|
||||
%div.navbar-inner
|
||||
|
@ -35,11 +19,11 @@
|
|||
%span.icon-bar
|
||||
%span.icon-bar
|
||||
%span.icon-bar
|
||||
%a.brand{:href => "index.html"}= "GitStats - #{repo.project_name}"
|
||||
%a.brand{:href => link_to("index.html", active_page)}= "GitStats - #{repo.project_name}"
|
||||
%div.nav-collapse.collapse
|
||||
%ul.nav
|
||||
- all_templates.each do |link|
|
||||
%li{:class => active_page == link ? "active" : ""}
|
||||
%a{:href => "#{link}.html"}= link.capitalize
|
||||
- links.each do |name, href|
|
||||
%li{:class => active_page[name.underscore] ? "active" : ""}
|
||||
%a{:href => link_to(href, active_page)}= name
|
||||
%div.container
|
||||
= yield
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li.active
|
||||
%a{:href => '#lines_by_date', 'data-toogle' => 'tab'}= :lines_by_date.t
|
||||
%li
|
||||
%a{:href => '#lines_by_extension', 'data-toogle' => 'tab'}= :lines_by_extension.t
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active{id: 'lines_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :lines_by_date.t
|
||||
= high_stock("charts.lines_by_date", charts.lines_by_date)
|
||||
|
||||
|
||||
.tab-pane{id: 'lines_by_extension'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :lines_by_extension.t
|
||||
= high_chart("charts.lines_by_extension", charts.lines_by_extension)
|
15
templates/lines/_lines.haml
Normal file
15
templates/lines/_lines.haml
Normal file
|
@ -0,0 +1,15 @@
|
|||
.tabbable.tabs-left
|
||||
%ul.nav.nav-tabs
|
||||
%li{class: page == :lines_by_date ? "active" : ""}
|
||||
%a{:href => 'by_date.html'}= :lines_by_date.t
|
||||
%li{class: page == :lines_by_extension ? "active" : ""}
|
||||
%a{:href => 'by_extension.html'}= :lines_by_extension.t
|
||||
|
||||
.tab-content
|
||||
.tab-pane.active
|
||||
.page-header
|
||||
%h1.pagination-centered= page.t
|
||||
- if page == :lines_by_date
|
||||
= high_stock("lines_by_date", charts.lines_by_date)
|
||||
- elsif page == :lines_by_extension
|
||||
= high_chart("lines_by_extension", charts.lines_by_extension)
|
1
templates/lines/by_date.haml
Normal file
1
templates/lines/by_date.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('lines/_lines', page: :lines_by_date)
|
1
templates/lines/by_extension.haml
Normal file
1
templates/lines/by_extension.haml
Normal file
|
@ -0,0 +1 @@
|
|||
= render_partial('lines/_lines', page: :lines_by_extension)
|
Loading…
Reference in a new issue