1 contributor
<%
# API
my $api = Gitprep::API->new($self);
# Parameters
my $user = param('user');
my $project = param('project');
my $rev = param('rev');
my $blob = param('blob');
my $page = param('page') || 0;
my $root_ns = $api->root_ns(config->{root});
my $rep_ns = "$root_ns/$user/$project.git";
my $rep = "/$rep_ns";
# Git
my $git = $self->app->git;
# Commit
my $commit = $git->parse_commit($rep, $rev);
# Commits
my $page_count = 30;
my $commits = $git->parse_commits(
$rep, $commit->{id}, $page_count, $page_count * $page, $blob);
my $commits_count = @$commits;
my $commits_date = {};
for my $commit (@$commits) {
my $date = $commit->{age_string_date};
$commits_date->{$date} ||= [];
push @{$commits_date->{$date}}, $commit;
}
# Global variable
stash(user => $user, project => $project);
%>
% layout 'common';
%= include '/css/common';
%= stylesheet begin
/* Commit history */
.commit_history {
font-weight:bold;
margin: 1em 0;
}
.commit_history a {
color:#4183C4;
}
/* Commit */
.commit {
border:1px solid gray;
border-bottom:none;
margin-bottom:15px;
}
.commit .cdate {
border-bottom:1px solid gray;
padding:5px;
background-color:#E6F1F6;
color:#3A505B;
font-weight:bold;
}
.commit .cfirst {
overflow:hidden;
padding:8px;
padding-bottom:1px;
}
.commit .cfirst_left {
float:left;
color:black;
}
.commit .cfirst_left a {
color:black;
font-weight:bold;
}
.commit .cfirst_right {
float:right;
}
.commit .cfirst_right a {
color:#4183C4;
}
.commit .csecond {
overflow:hidden;
border-bottom:1px solid gray;
padding:8px;
padding-top:1px;
}
.commit .csecond_left {
float:left;
}
.commit .csecond_right {
float:right;
}
.commit .csecond_right a {
color:#4183C4;
}
/* Pagenation */
.pagination {
overflow:hidden;
border-radius:3px;
border:1px solid gray;
display:inline-block;
color:black
}
.pagination .pleft {
border-right:1px solid gray;
padding:5px;
display:block;
float:left
}
.pagination .pright {
padding:5px;
display:block;
float:left;
}
.pagination a {
color:black;
height:100%;
}
.pagination a:hover {
background-color:#4183C4;
}
.pagination .pdisable {
color:gray;
cursor:default;
}
% end
%= include '/include/header';
<div class="main_panel">
%= include '/include/sub_header';
%= include '/include/code_menu', display => 'commits';
<div class="commit_history">
% if (defined $blob) {
History for
%= include '/include/page_path', type => 'blob', Path => $blob, operation => 'commits';
% } else {
<a class="ubar" href="<%= url_for("/$user/$project") %>">
<%= $project %>
</a>
/
Commit History
% }
</div>
% for my $date (reverse sort keys %$commits_date) {
<div class="commit">
% my $commits = $commits_date->{$date};
<div class="cdate"><%= $date %></div>
% for my $commit (sort {$a->{author_epoch} <=> $b->{author_epoch}} @$commits) {
<div class="ccontent">
<div class="cfirst">
<div class="cfirst_left">
<a class="ubar" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
<%= $commit->{title_short} %>
</a>
</div>
<div class="cfirst_right a_dec_on a_blue">
<a class="ubar" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
<%= substr($commit->{id}, 0, 10) %>
</a>
</div>
</div>
<div class="csecond">
<div class="csecond_left">yuki-kimoto authored 7 days ago</div>
<div class="csecond_right">
<a class="ubar" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
Browse code
</a>
</div>
</div>
</div>
% }
</div>
% }
<div class="pagination">
% if ($page == 0) {
<span class="pleft pdisable">« Newer</span>
% } else {
% my $newer_page = $page - 1;
<a class="pleft" href="<%= url_for("/$user/$project/commits/$rev?page=$newer_page") %>">« Newer</a>
% }
% if ($commits_count < $page_count) {
<span class="pright pdisable">Older »</span>
% } else {
% my $older_page = $page + 1;
<a class="pright" href="<%= url_for("/$user/$project/commits/$rev?page=$older_page") %>">Older »</a>
% }
</div>
</div>
%= include '/include/footer';