added Commits link
|
1 |
<% |
2 |
# API |
|
cleanup
|
3 |
my $api = gitprep_api; |
cleanup commits page
|
4 | |
added branch long name featu...
|
5 |
# Git |
revert encoding support
|
6 |
my $git = $self->app->git; |
added branch long name featu...
|
7 | |
cleanup commits page
|
8 |
# Parameters |
added Commits link
|
9 |
my $user = param('user'); |
cleanup, rename repository t...
|
10 |
my $project = param('project'); |
added branch long name featu...
|
11 |
my $rev_file = param('rev_file'); |
add atom feed part
|
12 |
|
support atom feed of commits...
|
13 |
my $render_atom_feed = $rev_file =~ s/\.atom$// ? 1 : 0; |
add atom feed part
|
14 |
|
cleanup parse_rev_path
|
15 |
my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file); |
added commits page pagenatio...
|
16 |
my $page = param('page') || 0; |
added Commits link
|
17 |
|
18 |
# Commit |
|
cleanup methods
|
19 |
my $commit = $git->get_commit(app->rep_info($user, $project), $rev); |
add atom feed part
|
20 | |
21 |
# Not found |
|
22 |
unless ($commit) { |
|
do success xt tests
|
23 |
$self->reply->not_found; |
add atom feed part
|
24 |
return; |
25 |
} |
|
fix mail bug
|
26 |
my $commit_author_email = $commit->{author_email}; |
add user page link from user...
|
27 |
my $commit_author_id = app->dbi->model('user')->select( |
28 |
'id', |
|
fix mail bug
|
29 |
where => {email => $commit_author_email} |
add user page link from user...
|
30 |
)->value; |
add atom feed part
|
31 |
|
added Commits link
|
32 |
# Commits |
improved commits page design
|
33 |
my $page_count = 30; |
cleanup
|
34 |
my $commits = $git->get_commits( |
cleanup import_branch
|
35 |
app->rep_info($user, $project), |
cleanup
|
36 |
$commit->{id}, |
37 |
$page_count, |
|
38 |
$page_count * $page, |
|
added branch long name featu...
|
39 |
$file |
cleanup
|
40 |
); |
added commits page pagenatio...
|
41 |
my $commits_count = @$commits; |
improved commits page design
|
42 |
my $commits_date = {}; |
added Commits link
|
43 |
for my $commit (@$commits) { |
support time zone
|
44 |
my $date = $commit->{age_string_date_local}; |
improved commits page design
|
45 |
$commits_date->{$date} ||= []; |
46 |
push @{$commits_date->{$date}}, $commit; |
|
added Commits link
|
47 |
} |
48 |
|
|
added commits page header an...
|
49 |
# Global variable |
added branch long name featu...
|
50 |
stash(user => $user, project => $project, rev => $rev); |
add atom feed part
|
51 |
|
add time zone to commit time
|
52 |
# Render atom xml feed |
support atom feed of commits...
|
53 |
if ($render_atom_feed) { |
54 |
# Add updated date time |
|
55 |
for my $commit (@$commits) { |
|
56 |
my $committer_epoch = $commit->{committer_epoch}; |
|
57 |
my $committer_tz = $commit->{committer_tz}; |
|
58 |
|
|
59 |
my $time_zone_second; |
|
60 |
my $time_zone; |
|
61 |
if ($committer_tz =~ /^(\+|\-)([0-9]{2})([0-9]{2})$/) { |
|
62 |
my $time_zone_sign = $1; |
|
63 |
my $time_zone_hour = $2; |
|
64 |
my $time_zone_min = $3; |
|
65 |
$time_zone_second = $time_zone_sign . ($time_zone_hour * (60 * 60) + $time_zone_min * 60); |
|
66 |
$time_zone = sprintf("$time_zone_sign%02d:%02d", $time_zone_hour, $time_zone_min); |
|
67 |
} |
|
68 | ||
69 |
# updated datetime |
|
70 |
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($committer_epoch + $time_zone_second); |
|
71 |
my $updated = sprintf('%4d-%02d-%02dT%02d:%02d:%02d', 1900 + $year, $mon + 1, $mday, $hour, $min, $sec); |
|
72 |
$updated .= $time_zone; |
|
73 |
|
|
74 |
$commit->{updated} = $updated; |
|
75 |
} |
|
fix atom bug(order, escape, ...
|
76 |
} |
add commits atom alternate t...
|
77 |
|
78 |
# Set stash |
|
79 |
stash( |
|
80 |
user => $user, |
|
81 |
project => $project, |
|
82 |
rev => $rev |
|
83 |
); |
|
fix atom bug(order, escape, ...
|
84 |
#%> |
85 |
% if ($render_atom_feed) { |
|
86 |
<% |
|
fix atom feed content type t...
|
87 |
$self->res->headers->content_type('application/atom+xml;charset=UTF-8'); |
fix atom bug(order, escape, ...
|
88 |
# Create atom feed |
fix atom feed url bug
|
89 |
my $alternate_url = url_with; |
90 |
my $alternate_url_path_parts = $alternate_url->path->parts; |
|
91 |
$alternate_url_path_parts->[-1] =~ s/\.atom$//; |
|
fix atom bug(order, escape, ...
|
92 |
#%> |
add space before ?>
|
93 |
<?xml version="1.0" encoding="UTF-8" ?> |
add atom feed part
|
94 |
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US"> |
fix atom feed bug
|
95 |
<id>tag:gitprep,2008:/<%= $user %>/<%= $project %>/commits/<%= $rev_file %></id> |
fix atom feed url bug
|
96 |
<link type="text/html" rel="alternate" href="<%= $alternate_url->to_abs %>"/> |
97 |
<link type="application/atom+xml" rel="self" href="<%= url_with->to_abs %>"/> |
|
fix atom bug(order, escape, ...
|
98 |
<title>Recent Commits to <%= "$project:$rev" %></title> |
99 |
<updated><%= $commits->[0]->{updated} %></updated> |
|
add atom feed part
|
100 | |
fix atom bug(order, escape, ...
|
101 |
% for my $commit (@$commits) { |
support atom feed of commits...
|
102 |
<entry> |
fix atom bug(order, escape, ...
|
103 |
<id>tag:gitprep,2008:Grit::Commit/<%= $commit->{id} %></id> |
cleanup commits atom page
|
104 |
<link type="text/html" rel="alternate" href="<%= url_for("/$user/$project/commit/$commit->{id}")->to_abs %>" /> |
support atom feed of commits...
|
105 |
<title> |
fix atom bug(order, escape, ...
|
106 |
<%= $commit->{title} %> |
support atom feed of commits...
|
107 |
</title> |
fix atom bug(order, escape, ...
|
108 |
<updated><%= $commit->{updated} %></updated> |
support atom feed of commits...
|
109 |
<author> |
fix atom bug(order, escape, ...
|
110 |
<name><%= $user %></name> |
cleanup commits atom page
|
111 |
<uri><%= url_for("/$user")->to_abs %></uri> |
support atom feed of commits...
|
112 |
</author> |
113 |
<content type="html"> |
|
fix atom bug(order, escape, ...
|
114 |
<%= "<pre style='white-space:pre-wrap;width:81ex'>$commit->{title}</pre>" %> |
support atom feed of commits...
|
115 |
</content> |
116 |
</entry> |
|
fix atom bug(order, escape, ...
|
117 |
% } |
add atom feed part
|
118 |
</feed> |
fix atom bug(order, escape, ...
|
119 |
% } else { |
120 |
% layout 'common', title => "Commit History \x{30fb} $user/$project"; |
|
add atom feed part
|
121 |
|
fix atom bug(order, escape, ...
|
122 |
%= include '/include/header'; |
added commits page header an...
|
123 | |
fix atom bug(order, escape, ...
|
124 |
<div class="container"> |
improve commits page design
|
125 |
<div> |
improve branch_select design
|
126 |
%= include '/include/branch_select', display => 'commits'; |
127 |
</div> |
|
improve commits page design
|
128 |
|
129 |
<div class="commits"> |
|
130 |
% for my $date (reverse sort keys %$commits_date) { |
|
fix atom bug(order, escape, ...
|
131 |
% my $commits = $commits_date->{$date}; |
improve commits page design
|
132 |
<div class="commit-date"> |
133 |
<i class="icon-off"></i><span>Commits on <%= $date %></span> |
|
fix atom bug(order, escape, ...
|
134 |
</div> |
improve commits page design
|
135 | |
136 |
<ul class="commits-date-container"> |
|
137 |
% my $num = 0; |
|
138 |
% for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) { |
|
139 |
<li> |
|
140 |
<div class="commit-left"> |
|
141 |
<div class="commit-left-title"> |
|
142 |
<a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
|
143 |
<b><%= $commit->{title_short} %></b> |
|
144 |
</a> |
|
145 |
</div> |
|
146 |
<div class="commit-left-author"> |
|
add user page link from user...
|
147 |
<span title="<%= $commit->{author_email} %>"> |
148 |
% if (defined $commit_author_id) { |
|
149 |
<a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> |
|
150 |
% } else { |
|
151 |
<%= $commit->{author_name} %> |
|
152 |
% } |
|
153 |
</span> |
|
improve commits page design
|
154 |
<span class="muted" title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string} %></span> |
155 |
</div> |
|
fix atom bug(order, escape, ...
|
156 |
</div> |
improve commits page design
|
157 |
<div class="commit-right"> |
158 |
<div class="commit-right-container"> |
|
159 |
<div class="commit-right-commit-id"> |
|
160 |
<a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
|
161 |
<%= substr($commit->{id}, 0, 7) %> |
|
162 |
</a> |
|
163 |
</div> |
|
164 |
<div class="commit-right-browse-repository"> |
|
165 |
<a title="Browse the repository at this point in the history" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
|
166 |
<> |
|
167 |
</a> |
|
168 |
</div> |
|
169 |
</div> |
|
fix atom bug(order, escape, ...
|
170 |
</div> |
improve commits page design
|
171 |
% $num++; |
172 |
</li> |
|
173 |
% } |
|
174 |
</ul> |
|
175 |
% } |
|
176 |
</div> |
|
177 |
|
|
improve pagenation design
|
178 |
<div class="pagenation-container"> |
179 |
<ul class="pagenation"> |
|
180 |
% if ($page == 0) { |
|
181 |
<li><span>Newer</span></li> |
|
182 |
% } else { |
|
183 |
% my $newer_page = $page - 1; |
|
184 |
<li> |
|
185 |
<a href="<%= url_for("/$user/$project/commits/$rev?page=$newer_page") %>">Newer</a> |
|
186 |
</li> |
|
187 |
% } |
|
188 |
% if ($commits_count < $page_count) { |
|
189 |
<li><span>Older</span></li> |
|
190 |
% } else { |
|
191 |
% my $older_page = $page + 1; |
|
192 |
<li> |
|
193 |
<a href="<%= url_for("/$user/$project/commits/$rev?page=$older_page") %>">Older</a> |
|
194 |
</li> |
|
195 |
% } |
|
196 |
</ul> |
|
197 |
</div> |
|
fix atom bug(order, escape, ...
|
198 |
</div> |
199 |
|
|
200 |
%= include '/include/footer'; |
|
201 |
% } |