cleanup
|
1 |
<% |
cleanup commit_body logic
|
2 |
my $user_id = stash('user'); |
3 |
my $project_id = stash('project'); |
|
cleanup
|
4 |
my $rev = stash('rev'); |
5 |
my $from_rev = stash('from_rev'); |
|
impved merge commit logic
|
6 |
|
revert encoding support
|
7 |
my $git = app->git; |
binary data not shown
|
8 |
|
add diff status bar to commi...
|
9 |
my $diff_tree = stash('diff_tree'); |
improve first commit
|
10 |
my $blob_diff = stash('blob_diff'); |
imprve file mode change
|
11 |
my $from_mode_str = $diff_tree->{from_mode_str}; |
12 |
my $to_mode_str = $diff_tree->{to_mode_str}; |
|
improve rename commit
|
13 |
my $lines = $blob_diff->{lines} || []; |
improve first commit
|
14 |
my $file = $blob_diff->{file}; |
improve rename commit
|
15 |
$file = '' unless defined $file; |
improve first commit
|
16 |
my $from_file = $blob_diff->{from_file}; |
17 |
$from_file = $file unless defined $from_file; |
|
imprve file mode change
|
18 |
my $status = $diff_tree->{status} || ''; |
binary data not shown
|
19 |
|
20 |
my $binary_rev_shown; |
|
21 |
my $binary_from_rev_shown; |
|
22 |
my $binary_not_shown; |
|
23 |
|
|
24 |
if ($blob_diff->{binary}) { |
|
25 |
if ($status eq 'A') { |
|
cleanup commit_body logic
|
26 |
if ($git->blob_is_image(app->rep_info($user_id, $project_id), $rev, $file)) { |
binary data not shown
|
27 |
$binary_rev_shown = 1; |
28 |
} |
|
29 |
else { |
|
30 |
$binary_not_shown = 1; |
|
31 |
} |
|
32 |
} elsif ($status eq 'D') { |
|
cleanup commit_body logic
|
33 |
if ($git->blob_is_image(app->rep_info($user_id, $project_id), $from_rev, $file)) { |
binary data not shown
|
34 |
$binary_from_rev_shown = 1; |
35 |
} |
|
36 |
else { |
|
37 |
$binary_not_shown = 1; |
|
38 |
} |
|
39 |
} else { |
|
cleanup commit_body logic
|
40 |
if ($git->blob_is_image(app->rep_info($user_id, $project_id), $from_rev, $file) |
41 |
&& $git->blob_is_image(app->rep_info($user_id, $project_id), $from_rev, $file)) { |
|
binary data not shown
|
42 |
$binary_from_rev_shown = 1; |
43 |
$binary_rev_shown = 1; |
|
44 |
} |
|
45 |
else { |
|
46 |
$binary_not_shown = 1; |
|
47 |
} |
|
48 |
} |
|
49 |
} |
|
cleanup
|
50 |
%> |
51 | ||
improve commit page design
|
52 |
<div class="commit-diff"> |
53 |
<div class="commit-diff-header"> |
|
54 |
<div> |
|
55 |
%= include '/include/diff_status_bar', diff_tree => $diff_tree; |
|
56 |
% if ($status eq 'R' || $status eq 'C') { |
|
57 |
<%= $from_file %> → <%= $file %> |
|
58 |
% } else { |
|
59 |
<%= $file %> |
|
60 |
% } |
|
61 |
% if ($status ne 'A' && $status ne 'D' && $from_mode_str ne $to_mode_str) { |
|
62 |
<%= "100$from_mode_str → 100$to_mode_str" %> |
|
63 |
% } |
|
64 |
</div> |
|
65 |
<div class="last-child"> |
|
66 |
% if ($status eq 'D') { |
|
cleanup commit_body logic
|
67 |
<a class="btn" href="<%= url_for("/$user_id/$project_id/blob/$from_rev/$file") %>"> |
improve commit page design
|
68 |
<b>View</b> |
69 |
</a> |
|
70 |
% } else { |
|
cleanup commit_body logic
|
71 |
<a class="btn" href="<%= url_for("/$user_id/$project_id/blob/$rev/$file") %>"> |
improve commit page design
|
72 |
<b>View</b> |
73 |
</a> |
|
74 |
% } |
|
improve first commit
|
75 |
</div> |
76 |
</div> |
|
improve commit page design
|
77 |
<div class="commit-diff-body"> |
78 |
<% |
|
79 |
my $not_shown; |
|
80 |
my $from_rev_shown; |
|
81 |
my $rev_shown; |
|
82 |
%> |
|
83 |
|
|
binary data not shown
|
84 | |
improve commit page design
|
85 |
% if ($blob_diff->{binary}) { |
86 |
% if ($binary_not_shown) { |
|
87 |
<div class="commit-diff-plain"> |
|
88 |
Binary file not shown. |
|
89 |
</div> |
|
90 |
% } else { |
|
91 |
<div class="commit-diff-image"> |
|
92 |
% if ($binary_from_rev_shown) { |
|
cleanup commit_body logic
|
93 |
<a href="<%= url_for("/$user_id/$project_id/blob/$from_rev/$file") %>"> |
94 |
<img src="<%= url_for("/$user_id/$project_id/raw/$from_rev/$file") %>" style="border:1px solid red;padding:1px;margin-right:20px"> |
|
improve commit page design
|
95 |
</a> |
96 |
% } |
|
97 |
|
|
98 |
% if ($binary_rev_shown) { |
|
cleanup commit_body logic
|
99 |
<a href="<%= url_for("/$user_id/$project_id/blob/$rev/$file") %>"> |
100 |
<img src="<%= url_for("/$user_id/$project_id/raw/$rev/$file") %>" style="border:1px solid green;padding:1px;margin-left:20px"> |
|
improve commit page design
|
101 |
</a> |
102 |
% } |
|
103 |
</div> |
|
104 |
% } |
|
105 |
% } elsif (@$lines) { |
|
106 |
<table> |
|
107 | ||
108 |
% for my $line (@$lines) { |
|
109 |
% my $class = $line->{class}; |
|
110 |
% my $value = $line->{value}; |
|
111 | ||
112 |
<% |
|
113 |
my $bk_color_line = ''; |
|
114 |
my $bk_color = ''; |
|
115 |
my $border_color; |
|
116 |
if ($value =~ /^@/) { |
|
117 |
$bk_color_line = '#f3f3ff'; |
|
118 |
$border_color = '#e4e4ff'; |
|
119 |
$bk_color = '#f8f8ff'; |
|
120 |
} elsif ($value =~ /^\+/) { |
|
121 |
$bk_color_line = '#ceffce'; |
|
122 |
$border_color = '#b4e2b4'; |
|
123 |
$bk_color = '#dfd'; |
|
124 |
} elsif ($value =~ /^-/) { |
|
125 |
$bk_color_line = '#f7c8c8'; |
|
126 |
$border_color = '#e9aeae'; |
|
127 |
$bk_color = '#fdd'; |
|
128 |
} else { |
|
129 |
$border_color = '#e5e5e5'; |
|
130 |
} |
|
131 |
%> |
|
132 |
<tr > |
|
133 |
<td style="font-size:12px;color:#aaa;padding:0 7px;border-right:1px <%= $border_color %> solid;background:<%= $bk_color_line %>;"> |
|
134 |
<%= $line->{before_line_num} %> |
|
135 |
</td> |
|
136 |
<td style="font-size:12px;color:#aaa;padding:0 7px;border-right:1px <%= $border_color %> solid;background:<%= $bk_color_line %>;"> |
|
137 |
<%= $line->{after_line_num} %> |
|
138 |
</td> |
|
139 |
<td style="width:100%;padding-left:7px;background:<%= $bk_color %>;"> |
|
140 |
<pre style="border:none;background:none;padding:0;margin:0"><%= $value %></pre> |
|
141 |
</td> |
|
142 |
</tr> |
|
binary data not shown
|
143 |
% } |
improve commit page design
|
144 |
</table> |
145 |
% } else { |
|
146 |
<div class="commit-diff-plain"> |
|
147 |
% if ($status eq 'R') { |
|
148 |
File renamed without changes. |
|
149 |
% } elsif ($status eq 'A' || $status eq 'D') { |
|
150 |
No changes. |
|
151 |
% } elsif ($from_mode_str ne $to_mode_str) { |
|
152 |
File mode changed. |
|
binary data not shown
|
153 |
% } |
154 |
</div> |
|
155 |
% } |
|
improve commit page design
|
156 |
</div> |
improve first commit
|
157 |
</div> |