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