... | ... |
@@ -89,6 +89,9 @@ sub startup { |
89 | 89 |
|
90 | 90 |
# Commits |
91 | 91 |
$r->get('/:user/:repository/commits/(:id)', {id => 'HEAD'})->to('#commits'); |
92 |
+ |
|
93 |
+ # Branches |
|
94 |
+ $r->get('/:user/:repository/branches')->to('#branches'); |
|
92 | 95 |
|
93 | 96 |
# Projects |
94 | 97 |
$r->get('/(*home)/projects')->to('#projects')->name('projects'); |
... | ... |
@@ -346,6 +346,39 @@ sub heads { |
346 | 346 |
); |
347 | 347 |
} |
348 | 348 |
|
349 |
+sub branches { |
|
350 |
+ my $self = shift; |
|
351 |
+ |
|
352 |
+ # API |
|
353 |
+ my $api = Gitprep::API->new($self); |
|
354 |
+ |
|
355 |
+ my $user = $self->param('user'); |
|
356 |
+ my $repository = $self->param('repository'); |
|
357 |
+ |
|
358 |
+ my $root_ns = $api->root_ns($self->config->{root}); |
|
359 |
+ |
|
360 |
+ # Parameters |
|
361 |
+ my $project_ns = "$root_ns/$user/$repository.git"; |
|
362 |
+ my $project = "/$project_ns"; |
|
363 |
+ my $home_ns = $api->dirname($project_ns); |
|
364 |
+ my $home = "/$home_ns"; |
|
365 |
+ |
|
366 |
+ # Git |
|
367 |
+ my $git = $self->app->git; |
|
368 |
+ |
|
369 |
+ # Ref names |
|
370 |
+ my $heads = $git->heads($project); |
|
371 |
+ |
|
372 |
+ # Render |
|
373 |
+ $self->render( |
|
374 |
+ home => $home, |
|
375 |
+ home_ns => $home_ns, |
|
376 |
+ project => $project, |
|
377 |
+ project_ns => $project_ns, |
|
378 |
+ heads => $heads, |
|
379 |
+ ); |
|
380 |
+} |
|
381 |
+ |
|
349 | 382 |
=pod |
350 | 383 |
sub commits { |
351 | 384 |
my ($self, %opt) = @_; |
... | ... |
@@ -0,0 +1,8 @@ |
1 |
+% layout 'common'; |
|
2 |
+ %= include '/include/header', title => 'Branches', project => $project; |
|
3 |
+ %= include '/include/current_directory', home_ns => $home_ns, home => $home; |
|
4 |
+ %= include '/include/page_navi', project_ns => $project_ns, current => 'heads'; |
|
5 |
+ <div class="header"> |
|
6 |
+ <a class="title" href="<%= url_for('heads', project => $project_ns) %>">Heads</a> |
|
7 |
+ </div> |
|
8 |
+ %= include '/include/heads', project_ns => $project_ns, heads => $heads; |
... | ... |
@@ -282,7 +282,7 @@ |
282 | 282 |
</div> |
283 | 283 |
<a href="<%= url_for %>"><div class="code_menu_files">Files</div></a> |
284 | 284 |
<a href="<%= url_for("/$user/$repository/commits/master") %>"><div class="code_menu_commits">Commits</div></a> |
285 |
- <a href="<%= url_for('/branches') %> %>"><div class="code_menu_branches">Branches</div></a> |
|
285 |
+ <a href="<%= url_for("/$user/$repository/branches") %>"><div class="code_menu_branches">Branches</div></a> |
|
286 | 286 |
</div> |
287 | 287 |
<div class="code_menu_right"> |
288 | 288 |
<a href="<%= url_for('/tags') %>"><div class="code_menu_downloads"><s>Downloads</s></div></a> |