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