gitprep / templates / include / commit_body.html.ep /
Newer Older
100 lines | 2.591kb
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
1
<%
2
  # Parameters
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
3
  my $rep_info = stash('rep_info') // app->rep_info($user, $project);
cleanup
Yuki Kimoto authored on 2013-05-31
4
  my $rev = stash('rev');
5
  my $from_rev = stash('from_rev');
add --ignore-space-change fe...
Yuki Kimoto authored on 2014-12-09
6

            
7
  my $param_ignore_space_change = param('w');
remove [basic]show_ignore_sp...
Yuki Kimoto authored on 2016-04-02
8
  my $ignore_space_change;
9
  if ($param_ignore_space_change) {
10
    $ignore_space_change = 1;
11
  }
12
  else {
13
    $ignore_space_change = app->dbi->model('project')->select(
14
      'ignore_space_change',
15
      where => {user_id => $user, name => $project}
16
    )->value;
17
  }
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
18
  
19
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
20
  my $git = app->git;
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
21
  
22
  # Diff tree
23
  my $diff_trees = $git->diff_tree(
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
24
    $rep_info,
cleanup
Yuki Kimoto authored on 2013-05-31
25
    $rev,
26
    $from_rev,
add --ignore-space-change fe...
Yuki Kimoto authored on 2014-12-09
27
    {ignore_space_change => $ignore_space_change}
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
28
  );
improve rename commit
Yuki Kimoto authored on 2013-06-01
29

            
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
30
  my $diff_trees_h = {};
31
  for my $diff_tree (@$diff_trees) {
improve rename commit
Yuki Kimoto authored on 2013-06-01
32
    my $file = $diff_tree->{to_file};
33
    $file = $diff_tree->{from_file} unless defined $file;
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
34
    $diff_trees_h->{$file} = $diff_tree if defined $file;
35
  }
36
  
37
  # Get blob diffs
add --ignore-space-change fe...
Yuki Kimoto authored on 2014-12-09
38
  my $blob_diffs = $git->blob_diffs(
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
39
    $rep_info,
cleanup rep_info
Yuki Kimoto authored on 2016-04-16
40
    $from_rev,
41
    $rev,
42
    $diff_trees,
43
    {ignore_space_change => $ignore_space_change}
add --ignore-space-change fe...
Yuki Kimoto authored on 2014-12-09
44
  ) || [];
45
  
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
46
  my $blob_diffs_h = {};
add total add and delete lin...
Yuki Kimoto authored on 2013-05-31
47
  my $total_add_line_count = 0;
48
  my $total_delete_line_count = 0;
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
49
  for my $blob_diff (@$blob_diffs) {
50
    my $file = $blob_diff->{file};
51
    $blob_diffs_h->{$file} = $blob_diff;
add total add and delete lin...
Yuki Kimoto authored on 2013-05-31
52
    $total_add_line_count += $blob_diff->{add_line_count};
53
    $total_delete_line_count += $blob_diff->{delete_line_count};
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
54
  }
55
%>
56

            
57
%= javascript begin
58
  $(document).ready(function () {
59
  
60
    // Diff Stats Button
61
    var diff_tree_show = false;
62
    var original_diff_stats_btn_text = $('#diff-stats-btn').text();
63
    
64
    $('#diff-stats-btn').on('click', function () {
65
      if (diff_tree_show) {
66
        $(this).text(original_diff_stats_btn_text);
67
        $('#diff_tree').css('display', 'none');
68
      }
69
      else {
70
        $('#diff_tree').css('display', 'block');
71
      }
72
      diff_tree_show = !diff_tree_show;
73
    });
74
  });
75
% end
76

            
improve commit page design
Yuki Kimoto authored on 2016-02-02
77
<div class="commit-changes">
78
  <div>
79
    Showing <b><a id="diff-stats-btn" href="javascript:void;"><%= @$diff_trees %> changed files</a></b>
improve first commit
Yuki Kimoto authored on 2013-05-31
80
    with
81
    <b><%= $total_add_line_count %> additions</b>
82
    and
83
    <b><%= $total_delete_line_count %> deletions</b>
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
84
  </div>
85
</div>
improve commit page design
Yuki Kimoto authored on 2016-02-02
86

            
87
<div id="diff_tree" style="display:none">
cleanup
Yuki Kimoto authored on 2013-05-31
88
  <%= include '/include/diff_tree', id => $rev, from_id => $from_rev,
impved merge commit logic
Yuki Kimoto authored on 2013-06-01
89
    diff_trees => $diff_trees %>
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
90
</div>
improve commit page design
Yuki Kimoto authored on 2016-02-02
91

            
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
92
% my $num = 0;
93
% for my $file (sort keys %$diff_trees_h) {
94
  <div id="diff-<%= $num %>">
95
    % my $blob_diff = $blob_diffs_h->{$file};
improve first commit
Yuki Kimoto authored on 2013-05-31
96
    %= include '/include/blob_diff_body', blob_diff => $blob_diff, diff_tree => $diff_trees_h->{$file};
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
97
  </div>
98
  % $num++;
99
% }
100
</div>