add diff status bar to commi...
|
1 |
<% |
2 |
# Parameters |
|
cleanup commit_body logic
|
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
|
6 |
my $rev = stash('rev'); |
7 |
my $from_rev = stash('from_rev'); |
|
add --ignore-space-change fe...
|
8 | |
9 |
my $param_ignore_space_change = param('w'); |
|
remove [basic]show_ignore_sp...
|
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
|
17 |
where => {user_id => $user_id, name => $project_id} |
remove [basic]show_ignore_sp...
|
18 |
)->value; |
19 |
} |
|
add diff status bar to commi...
|
20 |
|
21 |
# Git |
|
revert encoding support
|
22 |
my $git = app->git; |
add diff status bar to commi...
|
23 |
|
24 |
# Diff tree |
|
25 |
my $diff_trees = $git->diff_tree( |
|
fix compare page from forke...
|
26 |
$rep_info, |
cleanup
|
27 |
$rev, |
28 |
$from_rev, |
|
add --ignore-space-change fe...
|
29 |
{ignore_space_change => $ignore_space_change} |
add diff status bar to commi...
|
30 |
); |
improve rename commit
|
31 | |
add diff status bar to commi...
|
32 |
my $diff_trees_h = {}; |
33 |
for my $diff_tree (@$diff_trees) { |
|
improve rename commit
|
34 |
my $file = $diff_tree->{to_file}; |
35 |
$file = $diff_tree->{from_file} unless defined $file; |
|
add diff status bar to commi...
|
36 |
$diff_trees_h->{$file} = $diff_tree if defined $file; |
37 |
} |
|
38 |
|
|
39 |
# Get blob diffs |
|
add --ignore-space-change fe...
|
40 |
my $blob_diffs = $git->blob_diffs( |
fix compare page from forke...
|
41 |
$rep_info, |
cleanup rep_info
|
42 |
$from_rev, |
43 |
$rev, |
|
44 |
$diff_trees, |
|
45 |
{ignore_space_change => $ignore_space_change} |
|
add --ignore-space-change fe...
|
46 |
) || []; |
47 |
|
|
add diff status bar to commi...
|
48 |
my $blob_diffs_h = {}; |
add total add and delete lin...
|
49 |
my $total_add_line_count = 0; |
50 |
my $total_delete_line_count = 0; |
|
add diff status bar to commi...
|
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...
|
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...
|
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
|
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
|
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...
|
86 |
</div> |
87 |
</div> |
|
improve commit page design
|
88 | |
89 |
<div id="diff_tree" style="display:none"> |
|
cleanup
|
90 |
<%= include '/include/diff_tree', id => $rev, from_id => $from_rev, |
impved merge commit logic
|
91 |
diff_trees => $diff_trees %> |
add diff status bar to commi...
|
92 |
</div> |
improve commit page design
|
93 | |
add diff status bar to commi...
|
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
|
98 |
%= include '/include/blob_diff_body', blob_diff => $blob_diff, diff_tree => $diff_trees_h->{$file}; |
add diff status bar to commi...
|
99 |
</div> |
100 |
% $num++; |
|
101 |
% } |
|
102 |
</div> |