Skip to content

Commit

Permalink
add commits page
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-kimoto committed May 23, 2017
1 parent 4082cae commit cd6facc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions lib/Gitprep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,9 @@ sub startup {

# Edit wiki page
$r->any('/:title/_edit')->to(edit => 1);

# Wiki commits
$r->get('/commits/*rev_file' => sub { shift->render_maybe('/commits') })->to(wiki => 1);
}

# Commit
Expand Down
9 changes: 6 additions & 3 deletions templates/commits.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
my $user = param('user');
my $project = param('project');
my $rev_file = param('rev_file');
my $wiki = param('wiki');

my $render_atom_feed = $rev_file =~ s/\.atom$// ? 1 : 0;

my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file);
my $rep_info = $wiki ? app->wiki_rep_info($user, $project) : app->rep_info($user, $project);

my ($rev, $file) = $git->parse_rev_path($rep_info, $rev_file);
my $page = param('page') || 0;

# Latest commit
my $latest_commit = $git->get_commit(app->rep_info($user, $project), $rev);
my $latest_commit = $git->get_commit($rep_info, $rev);

# Authors
my %author_id_of = map { $_->{email} => $_->{id} }
Expand All @@ -25,7 +28,7 @@
# Commits
my $page_count = 30;
my $commits = $git->get_commits(
app->rep_info($user, $project),
$rep_info,
$latest_commit->{id},
$page_count,
$page_count * $page,
Expand Down
2 changes: 1 addition & 1 deletion templates/wiki.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
</a>
</li>
<li>
<a href="<%= url_for("/$user_id/$project_id/branches") %>">
<a href="<%= url_for("/$user_id/$project_id/commits/master") %>">
<span class="wiki-count-number">
<i class="icon-repeat" style="position:relative;top:-1px"></i>
<%= 15 %>
Expand Down

0 comments on commit cd6facc

Please sign in to comment.