gitprep / templates / include / diff_status_bar.html.ep /
Newer Older
61 lines | 2.186kb
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
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
Yuki Kimoto authored on 2013-05-31
7
  my $diff_count_text;
improve rename commit
Yuki Kimoto authored on 2013-06-01
8
  my $status = $diff_tree->{status};
improved diff status bar des...
Yuki Kimoto authored on 2013-06-02
9
  
imprve file mode change
Yuki Kimoto authored on 2013-06-01
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...
Yuki Kimoto authored on 2013-05-30
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...
Yuki Kimoto authored on 2013-05-30
15
  
16
  if ($diff_tree->{status} eq 'A') {
17
    $add_block_count = 5;
18
    $delete_block_count = 0;
19
  }
improve rename commit
Yuki Kimoto authored on 2013-06-01
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...
Yuki Kimoto authored on 2013-05-30
23
  if ($diff_tree->{status} eq 'D') {
24
    $add_block_count = 0;
25
    $delete_block_count = 5;
26
  }
improved diff status bar des...
Yuki Kimoto authored on 2013-06-02
27
  
improved diff status bar des...
Yuki Kimoto authored on 2013-06-02
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...
Yuki Kimoto authored on 2013-06-02
31
  }
improved diff status bar des...
Yuki Kimoto authored on 2013-06-02
32
  if ($diff_tree->{binary}) {
33
    $add_block_count = 5;
improved diff status bar des...
Yuki Kimoto authored on 2013-06-02
34
  }
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
35
%>
36

            
37

            
improve commit page design
Yuki Kimoto authored on 2016-02-02
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...
Yuki Kimoto authored on 2013-05-30
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
Yuki Kimoto authored on 2016-11-30
53
    <div style="display:inline-block;background:#6cc644;width:8px;height:9px;float:left;margin:1px"></div>
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
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
Yuki Kimoto authored on 2016-02-02
59
    <div style="display:inline-block;background:#ddd;;width:8px;height:9px;float:left;margin:1px"></div>
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
60
  % }
61
</<%= $tag %>>