... | ... |
@@ -178,6 +178,8 @@ sub blame { |
178 | 178 |
# Format lines |
179 | 179 |
my $blame_lines = []; |
180 | 180 |
my $blame_line; |
181 |
+ my $max_author_time; |
|
182 |
+ my $min_author_time; |
|
181 | 183 |
while (my $line = $self->_dec(scalar <$fh>)) { |
182 | 184 |
chomp $line; |
183 | 185 |
|
... | ... |
@@ -190,6 +192,9 @@ sub blame { |
190 | 192 |
} |
191 | 193 |
elsif ($line =~ /^author-time +(.+)/) { |
192 | 194 |
my $author_time = $1; |
195 |
+ $blame_line->{author_time} = $author_time; |
|
196 |
+ $max_author_time = $author_time if !$max_author_time || $author_time > $max_author_time; |
|
197 |
+ $min_author_time = $author_time if !$min_author_time || $author_time < $min_author_time; |
|
193 | 198 |
my $author_age_string_date = $self->_age_string_date($author_time); |
194 | 199 |
$blame_line->{author_age_string_date} = $author_age_string_date; |
195 | 200 |
} |
... | ... |
@@ -216,7 +221,13 @@ sub blame { |
216 | 221 |
} |
217 | 222 |
} |
218 | 223 |
|
219 |
- return $blame_lines; |
|
224 |
+ my $blame = { |
|
225 |
+ lines => $blame_lines, |
|
226 |
+ max_author_time => $max_author_time, |
|
227 |
+ min_author_time => $min_author_time |
|
228 |
+ }; |
|
229 |
+ |
|
230 |
+ return $blame; |
|
220 | 231 |
} |
221 | 232 |
|
222 | 233 |
sub _age_string_date { |
... | ... |
@@ -28,13 +28,30 @@ |
28 | 28 |
my $mime_type = $git->blob_mime_type($user, $project, $rev, $file); |
29 | 29 |
|
30 | 30 |
# Blame |
31 |
- my $blame_lines = $git->blame($user, $project, $rev, $file); |
|
32 |
- |
|
31 |
+ my $blame = $git->blame($user, $project, $rev, $file); |
|
32 |
+ my $blame_lines = $blame->{lines}; |
|
33 |
+ my $blame_min_author_time = $blame->{min_author_time}; |
|
34 |
+ my $blame_max_author_time = $blame->{max_author_time}; |
|
35 |
+ |
|
36 |
+ # Color |
|
37 |
+ my $colors = [ |
|
38 |
+ '#ffeca7', |
|
39 |
+ '#ffdd8c', |
|
40 |
+ '#ffdd7c', |
|
41 |
+ '#fba447', |
|
42 |
+ '#f68736', |
|
43 |
+ '#f37636', |
|
44 |
+ '#ca6632', |
|
45 |
+ '#c0513f', |
|
46 |
+ '#a2503a', |
|
47 |
+ '#793738' |
|
48 |
+ ]; |
|
49 |
+ |
|
33 | 50 |
# Variables for included template |
34 | 51 |
stash(id => $rev, project => $project, rev => $rev); |
35 | 52 |
%> |
36 | 53 |
|
37 |
-% layout 'common' , title => "$project/$file at $rev \x{30fb} $user/$project"; |
|
54 |
+% layout 'common' , title => "$user/$project at $rev"; |
|
38 | 55 |
|
39 | 56 |
%= include '/include/header'; |
40 | 57 |
|
... | ... |
@@ -42,20 +59,13 @@ |
42 | 59 |
%= include '/include/project_header'; |
43 | 60 |
%= include '/include/code_menu', display => 'files'; |
44 | 61 |
%= include '/include/page_path', type => 'blob', Path => $file; |
45 |
- |
|
46 |
- <div class="border-gray" style="margin-bottom:20px"> |
|
47 |
- <div class="bk-blue-light" style="padding:5px"> |
|
48 |
- <a style="color:#333;font-weight:bold" href="#" title="<%= $commit->{author_email} %>"><%= $commit->{author_name} %></a> |
|
49 |
- <span class="muted" title="<%= $commit->{age_string_datetime} %>"><%= $commit->{age_string} %></span> |
|
50 |
- <a style="color:#666" href="<%= url_for("/$user/$project/commit/$rev") %>"> |
|
51 |
- <%= $commit->{title} %> |
|
52 |
- </a> |
|
53 |
- </div> |
|
54 |
- <div style="padding:5px"> |
|
55 |
- <b><%= @$authors %></b> <span class="muted">contributor</span> |
|
56 |
- </div> |
|
62 |
+ <div class="text-right" style="margin-bottom:10px"> |
|
63 |
+ Newer |
|
64 |
+ % for my $color (@$colors) { |
|
65 |
+ <span style="font-size:20px;color:<%= $color %>">■</span> |
|
66 |
+ % } |
|
67 |
+ Older |
|
57 | 68 |
</div> |
58 |
- |
|
59 | 69 |
<div class="border-gray bk-gray-light" style="padding:5px; border-bottom:none"> |
60 | 70 |
<div class="row"> |
61 | 71 |
<div class="span7" style="padding-top:5px"> |
... | ... |
@@ -77,12 +87,16 @@ |
77 | 87 |
% my $blame_commit = $line->{commit}; |
78 | 88 |
% my $summary = $line->{summary}; |
79 | 89 |
% my $summary_short= length $summary > 28 ? substr($summary, 0, 28) . '...' : $summary; |
90 |
+ % my $time_rate = ($blame_max_author_time - $line->{author_time}) / ($blame_max_author_time - $blame_min_author_time); |
|
91 |
+ % my $color_number = int($time_rate * 10); |
|
92 |
+ % $color_number = 9 if $color_number == 10; |
|
93 |
+ % my $hot_color = $colors->[$color_number]; |
|
80 | 94 |
<tr> |
81 | 95 |
% if ($line->{before_same_commit}) { |
82 |
- <td nowrap class="border-gray" style="padding:5px 10px; background:#f7f7f7;vertical-align:middle;border-left:none;border-top:none" > |
|
96 |
+ <td nowrap class="border-gray" style="padding:5px 10px; background:#f7f7f7;vertical-align:middle;border-left:none;border-top:none;border-right:2px solid <%= $hot_color %>" > |
|
83 | 97 |
</td> |
84 | 98 |
% } else { |
85 |
- <td nowrap class="border-gray" style="padding:5px 10px; background:#f7f7f7;vertical-align:middle;border-left:none;border-bottom:none" > |
|
99 |
+ <td nowrap class="border-gray" style="padding:5px 10px; background:#f7f7f7;vertical-align:middle;border-left:none;border-bottom:none;border-right:2px solid <%= $hot_color %>" > |
|
86 | 100 |
<div style="margin-bottom:0;padding-botttom:0"> |
87 | 101 |
<a href="<%= url_for("/$user/$project/commit/$blame_commit") %>" ><%= substr($blame_commit, 0, 8) %></a> |
88 | 102 |
<a href="<%= url_for("/$user/$project/blame/$blame_commit/$file") %>" >»</a> |