... | ... |
@@ -91,7 +91,8 @@ sub startup { |
91 | 91 |
$r->get('/:user/:repository/commit/:id')->to('#commit'); |
92 | 92 |
|
93 | 93 |
# Commits |
94 |
- $r->get('/:user/:repository/commits/(:id)', {id => 'HEAD'})->to('#commits'); |
|
94 |
+ $r->get('/:user/:repository/commits/:id', {id => 'HEAD'})->to('#commits'); |
|
95 |
+ $r->get('/:user/:repository/commits/:id/(*file)')->to('#commits'); |
|
95 | 96 |
|
96 | 97 |
# Branches |
97 | 98 |
$r->get('/:user/:repository/branches')->to('#branches'); |
... | ... |
@@ -1,4 +1,10 @@ |
1 | 1 |
% use File::Basename 'basename'; |
2 |
+<% |
|
3 |
+ my $operation = stash('operation') // 'tree'; |
|
4 |
+ unless ($operation eq 'commits' || $operation eq 'tree') { |
|
5 |
+ $operation = 'tree'; |
|
6 |
+ } |
|
7 |
+%> |
|
2 | 8 |
|
3 | 9 |
%= stylesheet begin |
4 | 10 |
.page_path { |
... | ... |
@@ -11,8 +17,10 @@ |
11 | 17 |
} |
12 | 18 |
% end |
13 | 19 |
|
14 |
-<div class="page_path"> |
|
15 |
- <a href="<%= url_for("/$user/$repository") %>"><b><%= $repository %></b></a> / |
|
20 |
+<span class="page_path"> |
|
21 |
+ <a href="<%= url_for("/$user/$repository" . ($operation eq 'commits' ? '/commits' : '')) %>"> |
|
22 |
+ <b><%= $repository %></b> |
|
23 |
+ </a> / |
|
16 | 24 |
% my @parts = split('/', $Path); |
17 | 25 |
% my $path; |
18 | 26 |
% for (my $i = 0; $i < @parts; $i++) { |
... | ... |
@@ -23,7 +31,7 @@ |
23 | 31 |
<b><%= $part %></b> |
24 | 32 |
% } else { |
25 | 33 |
<a href= |
26 |
- "<%= url_for("/$user/$repository/tree/$id/$path") %>"> |
|
34 |
+ "<%= url_for("/$user/$repository/$operation/$id/$path") %>"> |
|
27 | 35 |
<%= $part %> |
28 | 36 |
</a> |
29 | 37 |
% $path .= '/'; |
... | ... |
@@ -32,4 +40,4 @@ |
32 | 40 |
/ |
33 | 41 |
% } |
34 | 42 |
% } |
35 |
-</div> |
|
43 |
+</span> |
... | ... |
@@ -5,6 +5,7 @@ |
5 | 5 |
my $user = param('user'); |
6 | 6 |
my $repository = param('repository'); |
7 | 7 |
my $id = param('id'); |
8 |
+ my $file = param('file'); |
|
8 | 9 |
my $page = param('page') || 0; |
9 | 10 |
|
10 | 11 |
my $root_ns = $api->root_ns(config->{root}); |
... | ... |
@@ -153,11 +154,16 @@ |
153 | 154 |
% end |
154 | 155 |
|
155 | 156 |
<div class="commit_history"> |
156 |
- <a class="ubar" href="<%= url_for("/$user/$repository") %>"> |
|
157 |
- <%= $repository %> |
|
158 |
- </a> |
|
159 |
- / |
|
160 |
- Commit History |
|
157 |
+ % if (defined $file) { |
|
158 |
+ History for |
|
159 |
+ %= include '/include/page_path', type => 'blob', Path => $file, operation => 'commits'; |
|
160 |
+ % } else { |
|
161 |
+ <a class="ubar" href="<%= url_for("/$user/$repository") %>"> |
|
162 |
+ <%= $repository %> |
|
163 |
+ </a> |
|
164 |
+ / |
|
165 |
+ Commit History |
|
166 |
+ % } |
|
161 | 167 |
</div> |
162 | 168 |
|
163 | 169 |
% for my $date (sort keys %$commits_date) { |