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