add diff status bar to commi...
|
1 |
<% |
2 |
my $diff_tree = stash('diff_tree'); |
|
3 |
my $fragment = stash('fragment'); |
|
4 |
my $add_line_count = $diff_tree->{add_line_count} || 0; |
|
5 |
my $delete_line_count = $diff_tree->{delete_line_count} || 0; |
|
6 |
my $diff_line_count = $add_line_count + $delete_line_count; |
|
improve first commit
|
7 |
my $diff_count_text; |
improve rename commit
|
8 |
my $status = $diff_tree->{status}; |
improved diff status bar des...
|
9 |
|
imprve file mode change
|
10 |
$diff_count_text = "$add_line_count additions"; |
11 |
$diff_count_text .= " & $delete_line_count deletions" if $delete_line_count > 0; |
|
add diff status bar to commi...
|
12 |
my $tag = $fragment ? 'a' : 'span'; |
13 |
my $add_block_count = $diff_tree->{add_block_count} || 0; |
|
14 |
my $delete_block_count = $diff_tree->{delete_block_count} || 0; |
|
improve diff status bar feat...
|
15 |
|
16 |
if ($diff_tree->{status} eq 'A') { |
|
17 |
$add_block_count = 5; |
|
18 |
$delete_block_count = 0; |
|
19 |
} |
|
improve rename commit
|
20 |
elsif ($diff_tree->{status} eq 'R' && $add_line_count == 0 && $delete_line_count == 0) { |
21 |
$add_block_count = 5; |
|
22 |
} |
|
improve diff status bar feat...
|
23 |
if ($diff_tree->{status} eq 'D') { |
24 |
$add_block_count = 0; |
|
25 |
$delete_block_count = 5; |
|
26 |
} |
|
improved diff status bar des...
|
27 |
|
improved diff status bar des...
|
28 |
if ($diff_line_count <= 5) { |
29 |
$add_block_count = $add_line_count; |
|
30 |
$delete_block_count = $delete_line_count; |
|
improved diff status bar des...
|
31 |
} |
improved diff status bar des...
|
32 |
if ($diff_tree->{binary}) { |
33 |
$add_block_count = 5; |
|
improved diff status bar des...
|
34 |
} |
add diff status bar to commi...
|
35 |
%> |
36 | ||
37 | ||
improve commit page design
|
38 |
<<%= $tag %> title="<%= $diff_count_text %>" style="text-decoration:none;color:#666" href="#<%= $fragment %>"> |
39 |
% if ($diff_tree->{binary}) { |
|
40 |
BIN |
|
41 |
% } else { |
|
42 |
% if ($add_line_count) { |
|
43 |
<span style="color:green">+<%= $add_line_count %></span> |
|
44 |
% } |
|
45 |
% if ($delete_line_count) { |
|
46 |
<span style="color:red">-<%= $delete_line_count %></span> |
|
47 |
% } |
|
48 |
% } |
|
49 |
</<%= $tag %>> |
|
add diff status bar to commi...
|
50 | |
51 |
<<%= $tag %> title="<%= $diff_count_text %>" style="text-decoration:none;display:inline-block;overflow:none;" href="#<%= $fragment %>"> |
|
52 |
% for (my $i = 0; $i < $add_block_count; $i++) { |
|
improve commit diff design
|
53 |
<div style="display:inline-block;background:#6cc644;width:8px;height:9px;float:left;margin:1px"></div> |
add diff status bar to commi...
|
54 |
% } |
55 |
% for (my $i = 0; $i < $delete_block_count; $i++) { |
|
56 |
<div style="display:inline-block;background:#bd2c00;width:8px;height:9px;float:left;margin:1px"></div> |
|
57 |
% } |
|
58 |
% for (my $i = 0; $i < 5 - $add_block_count - $delete_block_count; $i++) { |
|
improve commit page design
|
59 |
<div style="display:inline-block;background:#ddd;;width:8px;height:9px;float:left;margin:1px"></div> |
add diff status bar to commi...
|
60 |
% } |
61 |
</<%= $tag %>> |