cleanup
|
1 |
<% |
use hoedown for fenced code ...
|
2 |
use Text::Markdown::Hoedown; |
add support normal file mark...
|
3 |
|
cleanup
|
4 |
# API |
cleanup
|
5 |
my $api = gitprep_api; |
added branch long name featu...
|
6 | |
7 |
# Git |
|
revert encoding support
|
8 |
my $git = $self->app->git; |
cleanup
|
9 |
|
added commit page
|
10 |
# Parameters |
cleanup
|
11 |
my $user = param('user'); |
cleanup, rename repository t...
|
12 |
my $project = param('project'); |
added branch long name featu...
|
13 |
my $rev_file = param('rev_file'); |
cleanup parse_rev_path
|
14 |
my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file); |
cleanup
|
15 | |
cleanup
|
16 |
# Commit |
cleanup methods
|
17 |
my $commit = $git->last_change_commit(app->rep_info($user, $project), $rev, $file); |
add user page link from user...
|
18 |
my $commit_author_mail = $commit->{author_email}; |
19 |
my $commit_author_id = app->dbi->model('user')->select( |
|
20 |
'id', |
|
21 |
where => {mail => $commit_author_mail} |
|
22 |
)->value; |
|
remove warning
|
23 | |
added contributer count
|
24 |
# Authors |
cleanup blob_size
|
25 |
my $authors = $git->authors(app->rep_info($user, $project), $rev, $file); |
added contributer count
|
26 |
|
cleanup blob and raw page
|
27 |
# File size |
cleanup blob_size
|
28 |
my $file_size = $git->blob_size(app->rep_info($user, $project), $rev, $file); |
cleanup
|
29 |
|
added blob file type to blob...
|
30 |
# File mode |
cleanup blob_mode
|
31 |
my $mode = $git->blob_mode(app->rep_info($user, $project), $rev, $file); |
added blob file type to blob...
|
32 |
my $file_type = $git->file_type_long($mode); |
33 |
|
|
cleanup blob and raw page
|
34 |
# MIME type |
cleanup rep_info
|
35 |
my $mime_type = $git->blob_mime_type(app->rep_info($user, $project), $rev, $file); |
cleanup blob and raw page
|
36 | |
fix bug that dispaly blog im...
|
37 |
# Blob lines(only text) |
38 |
my $lines; |
|
cleanup rep_info
|
39 |
$lines = $git->blob(app->rep_info($user, $project), $rev, $file) if $mime_type =~ /^text/; |
fix bug that dispaly blog im...
|
40 | |
cleanup blob page
|
41 |
# Variables for included template |
added branch long name featu...
|
42 |
stash(id => $rev, project => $project, rev => $rev); |
cleanup
|
43 |
%> |
44 | ||
add title
|
45 |
<% layout 'common' , title => "$project/$file at $rev \x{30fb} $user/$project", |
46 |
stylesheets => ['/js/google-code-prettify/prettify.css']; %> |
|
cleanup
|
47 | |
add title
|
48 |
% |
cleanup
|
49 |
%= include '/include/header'; |
50 | ||
improved code menu design
|
51 |
<div class="container"> |
improve branch_select design
|
52 |
<div style="margin-bottom:20px;"> |
improve blog page page path
|
53 |
%= include '/include/branch_select', display => 'blob', Path => $file; |
improve branch_select design
|
54 |
</div> |
complete blob page design
|
55 | |
56 |
<div class="commit-summary"> |
|
57 |
<div class="commit-summary-left-container"> |
|
add user page link from user...
|
58 |
<span class="commit-summary-author" title="<%= $commit->{author_email} %>"> |
59 |
% if (defined $commit_author_id) { |
|
60 |
<a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> |
|
61 |
% } else { |
|
62 |
<%= $commit->{author_name} %> |
|
63 |
% } |
|
64 |
</span> |
|
complete blob page design
|
65 |
<a href="<%= url_for("/$user/$project/commit/$rev") %>"> |
improved blob header
|
66 |
<%= $commit->{title} %> |
67 |
</a> |
|
68 |
</div> |
|
complete blob page design
|
69 |
<div class="commit-summary-right-container"> |
70 |
<a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
|
71 |
<%= substr($commit->{id}, 0, 7) %> |
|
72 |
</a> |
|
improve commits page design
|
73 |
<span title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string} %></span> |
cleanup
|
74 |
</div> |
75 |
</div> |
|
complete blob page design
|
76 |
|
77 |
<div class="commit-contributor"> |
|
78 |
<%= @$authors %> contributor |
|
79 |
</div> |
|
desinged blob page source
|
80 | |
complete blob page design
|
81 |
<div> |
82 |
<div class="file-header"> |
|
83 |
<div class="file-header-left"> |
|
fix bug that dispaly blog im...
|
84 |
% if ($lines) { |
85 |
<%= @$lines %> lines |
|
complete blob page design
|
86 |
<span style="color:#dcdcdc">|</span> |
fix bug that dispaly blog im...
|
87 |
% } |
cleanup
|
88 |
<%= $file_size %>kb |
cleanup
|
89 |
</div> |
complete blob page design
|
90 |
<div class="file-header-right"> |
91 |
<ul> |
|
92 |
<li> |
|
93 |
<a class="btn btn-small" href="<%= url_for("/$user/$project/raw/$rev/$file") %>">Raw</a> |
|
94 |
</li> |
|
95 |
% if ($mime_type =~ m#^text/#) { |
|
96 |
<li> |
|
97 |
<a class="btn btn-small" href="<%= url_for("/$user/$project/blame/$rev/$file") %>">Blame</a> |
|
98 |
</li> |
|
99 |
% } |
|
100 |
<li> |
|
101 |
<a class="btn btn-small" href="<%= url_for("/$user/$project/commits/$rev/$file") %>">History</a> |
|
102 |
</li> |
|
103 |
</ul> |
|
added file size to blob page
|
104 |
</div> |
desinged blob page source
|
105 |
</div> |
added google code prettify a...
|
106 |
</div> |
fix bug that dispaly blog im...
|
107 |
% if ($mime_type =~ m#^image/#) { |
complete blob page design
|
108 |
<div class="blob-image"> |
cleanup
|
109 |
<img type="<%= $mime_type %> |
cleanup
|
110 |
% if (defined $file) { |
111 |
alt="<%= $file %>" title="<%= $file %>" |
|
cleanup
|
112 |
% } |
cleanup
|
113 |
src="<%= url_for("/$user/$project/raw/$rev/$file") %>" |
added google code prettify a...
|
114 |
/> |
desinged blob page source
|
115 |
</div> |
not show binary file
|
116 |
% } elsif ($mime_type =~ m#^text/#) { |
fix bug that dispaly blog im...
|
117 |
% if ($file =~ /\.md$/) { |
improve commit page design
|
118 |
<% |
119 |
my $readme = join "\n", @$lines; |
|
fix CGI not display image bu...
|
120 |
$readme =~ s#^(\[.*\]:)(?!\s*https?://)\s*(\S*)#{"$1 " . url_for("/$user/$project/raw/$rev/$2")}#mge; |
121 |
$readme =~ s#^(!\[.*\]\()(?!https?://)(\S*)#{$1 . url_for("/$user/$project/raw/$rev/$2")}#mge; |
|
improve commit page design
|
122 |
my $readme_e = Text::Markdown::Hoedown::markdown($readme, extensions => HOEDOWN_EXT_FENCED_CODE); |
123 |
%> |
|
124 |
<div class="readme-frame"> |
|
125 |
<div class="markdown-body"> |
|
126 |
<%== $readme_e %> |
|
127 |
</div> |
|
fix bug that dispaly blog im...
|
128 |
</div> |
129 |
% } else { |
|
130 |
<pre class="prettyprint linenums"><% for my $line (@$lines) { %><%= "$line\n" %><% } %></pre> |
|
131 |
% } |
|
not show binary file
|
132 |
% } else { |
complete blob page design
|
133 |
<div class="blob-raw"> |
not show binary file
|
134 |
<a href="<%= url_for("/$user/$project/raw/$rev/$file") %>">View raw</a> |
135 |
</div> |
|
added google code prettify a...
|
136 |
% } |
copy gitweblite soruce code
|
137 |
</div> |
improved google-code-prittig...
|
138 |
|
139 |
%= javascript '/js/google-code-prettify/prettify.js'; |
|
140 |
%= javascript begin |
|
141 |
// Google prety print |
|
142 |
prettyPrint(); |
|
143 |
% end |
|
144 |
|
|
cleanup
|
145 |
%= include '/include/footer'; |