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

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

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

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

            
improve commit page design
Yuki Kimoto authored on 2016-02-02
79
<div class="commit-changes">
80
  <div>
81
    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
82
    with
83
    <b><%= $total_add_line_count %> additions</b>
84
    and
85
    <b><%= $total_delete_line_count %> deletions</b>
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
86
  </div>
87
</div>
improve commit page design
Yuki Kimoto authored on 2016-02-02
88

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

            
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
94
% my $num = 0;
95
% for my $file (sort keys %$diff_trees_h) {
96
  <div id="diff-<%= $num %>">
97
    % my $blob_diff = $blob_diffs_h->{$file};
improve first commit
Yuki Kimoto authored on 2013-05-31
98
    %= 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
99
  </div>
100
  % $num++;
101
% }
102
</div>