cleanup
|
1 |
<% |
improve commits header desig...
|
2 |
my $state; |
3 | ||
cleanup
|
4 |
# API |
cleanup
|
5 |
my $api = gitprep_api; |
added branch long name featu...
|
6 | |
7 |
# Git |
|
revert encoding support
|
8 |
my $git = app->git; |
cleanup
|
9 |
|
10 |
# Parameters |
|
add website URL settings. yo...
|
11 |
my $user_id = param('user'); |
12 |
my $project_id = param('project'); |
|
13 |
|
|
14 |
my $project_row_id = $api->get_project_row_id($user_id, $project_id); |
|
improve commits header desig...
|
15 |
|
16 |
my $rev; |
|
17 |
my $dir; |
|
added branch long name featu...
|
18 |
my $rev_dir = param('rev_dir'); |
improve commits header desig...
|
19 |
if (defined $rev_dir) { |
add website URL settings. yo...
|
20 |
($rev, $dir) = $git->parse_rev_path(app->rep_info($user_id, $project_id), $rev_dir); |
improve commits header desig...
|
21 |
} |
22 |
else { |
|
add website URL settings. yo...
|
23 |
$rev = app->manager->default_branch($user_id, $project_id); |
improve commits header desig...
|
24 |
} |
25 |
|
|
add website URL settings. yo...
|
26 |
unless (app->manager->exists_project($user_id, $project_id)) { |
do success xt tests
|
27 |
$self->reply->not_found; |
improve commits header desig...
|
28 |
return; |
29 |
} |
|
30 | ||
31 |
# Repository description |
|
add website URL settings. yo...
|
32 |
my $desc = $git->description(app->rep_info($user_id, $project_id)); |
33 |
my $website_url = app->dbi->model('project')->select('website_url', where => {row_id => $project_row_id})->value; |
|
improve commits header desig...
|
34 |
|
35 |
# Check exsitence |
|
36 |
my $commits_number; |
|
add website URL settings. yo...
|
37 |
if ($git->exists_branch(app->rep_info($user_id, $project_id))) { |
improve commits header desig...
|
38 |
# Commit |
add website URL settings. yo...
|
39 |
my $commit = $git->get_commit(app->rep_info($user_id, $project_id), $rev); |
improve commits header desig...
|
40 |
|
41 |
# Tree |
|
fix tree bug and improve tre...
|
42 |
my $trees; |
43 |
if (defined $dir && length $dir) { |
|
add website URL settings. yo...
|
44 |
$trees = $git->trees(app->rep_info($user_id, $project_id), $rev, $dir); |
fix tree bug and improve tre...
|
45 |
} |
46 |
else { |
|
add website URL settings. yo...
|
47 |
$trees = $git->trees(app->rep_info($user_id, $project_id), $rev); |
fix tree bug and improve tre...
|
48 |
} |
improve commits header desig...
|
49 |
# Commits number |
add website URL settings. yo...
|
50 |
$commits_number = $git->commits_number(app->rep_info($user_id, $project_id), $rev); |
improve commits header desig...
|
51 |
|
52 |
# Variable for included template |
|
53 |
stash( |
|
54 |
commit => $commit, |
|
55 |
trees => $trees, |
|
56 |
rev => $rev, |
|
add website URL settings. yo...
|
57 |
title => "$user_id/$project_id", |
improve commits header desig...
|
58 |
); |
59 |
|
|
60 |
$state = 'display'; |
|
61 |
} |
|
62 |
else { $state = 'init' } |
|
add website URL settings. yo...
|
63 |
|
64 |
my $is_project_top_page = !(defined $dir && length $dir); |
|
improve commits header desig...
|
65 | |
66 |
my $url = url_for->to_abs; |
|
67 |
$url->base(undef); |
|
68 |
my $ssh_port = config->{basic}{ssh_port}; |
|
cleanup ->rep_home
|
69 |
my $rep_home = app->rep_home; |
improve commits header desig...
|
70 |
my $execute_user = getpwuid($>); |
71 |
my $ssh_rep_url_base = defined app->config->{basic}{'ssh_rep_url_base'} |
|
72 |
? app->config->{basic}{'ssh_rep_url_base'} : $rep_home; |
|
73 |
my $ssh_rep_url = "ssh://$execute_user\@" . $url->host |
|
add website URL settings. yo...
|
74 |
. ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user_id/$project_id.git"; |
improve commits header desig...
|
75 | |
76 |
my $branches = stash('branches'); |
|
add website URL settings. yo...
|
77 |
my $branches_count = app->git->branches_count($self->app->rep_info($user_id, $project_id)); |
78 |
my $default_branch_name = app->manager->default_branch($user_id, $project_id); |
|
79 |
my $tags_count = app->git->tags_count(app->rep_info($user_id, $project_id)); |
|
improve commits header desig...
|
80 |
|
81 |
my $logined = $api->logined; |
|
82 |
|
|
add website URL settings. yo...
|
83 |
layout 'common', title => "$user_id/$project_id"; |
cleanup
|
84 |
%> |
85 |
|
|
86 |
%= include '/include/header'; |
|
improve commits header desig...
|
87 |
|
cleanup tree page
|
88 |
<div class="container"> |
improve commits header desig...
|
89 |
%= include '/include/message', message => flash('message'); |
improve CGI performace and d...
|
90 |
|
add website URL settings. yo...
|
91 |
% if ($is_project_top_page) { |
improve project header color
|
92 |
<h3 class="tree-description"> |
improve commits header desig...
|
93 |
<%= $desc %> |
add website URL settings. yo...
|
94 |
% if (defined $website_url && length $website_url) { |
improve project header color
|
95 |
<a href="<%= $website_url %>">website</a> |
add website URL settings. yo...
|
96 |
% } |
improve commits header desig...
|
97 |
</h3> |
98 |
% } |
|
99 |
% if ($state eq 'display') { |
|
add website URL settings. yo...
|
100 |
% if ($is_project_top_page) { |
improve commits header desig...
|
101 |
<ul class="commits-count"> |
102 |
<li> |
|
add website URL settings. yo...
|
103 |
% my $commits_url = "/$user_id/$project_id/commits/" . ((defined $rev && length $rev) ? $rev : $default_branch_name); |
improve commits header desig...
|
104 |
<a href="<%= url_for($commits_url) %>"> |
105 |
<span class="commits-count-number"> |
|
improve tree page design
|
106 |
<i class="icon-repeat" style="position:relative;top:-1px"></i> |
improve commits header desig...
|
107 |
<%= $commits_number %> |
108 |
</span> |
|
109 |
<span class="commits-count-type"> |
|
110 |
commits |
|
111 |
</span> |
|
112 |
</a> |
|
113 |
</li> |
|
114 |
<li> |
|
add website URL settings. yo...
|
115 |
<a href="<%= url_for("/$user_id/$project_id/branches") %>"> |
improve commits header desig...
|
116 |
<span class="commits-count-number"> |
improve tree page design
|
117 |
<i class="icon-indent-left" style="position:relative;top:-1px"></i> |
improve commits header desig...
|
118 |
<%= $branches_count %> |
119 |
</span> |
|
120 |
<span class="commits-count-type"> |
|
121 |
branches |
|
122 |
</span> |
|
123 |
</a> |
|
124 |
</li> |
|
125 |
<li> |
|
add website URL settings. yo...
|
126 |
<a href="<%= url_for("/$user_id/$project_id/tags") %>"> |
improve commits header desig...
|
127 |
<span class="commits-count-number"> |
improve tree page design
|
128 |
<i class="icon-tags" style="position:relative;top:-1px"></i> |
improve commits header desig...
|
129 |
<%= $tags_count %> |
130 |
</span> |
|
131 |
<span class="commits-count-type"> |
|
132 |
releases |
|
133 |
</span> |
|
134 |
</a> |
|
135 |
</li> |
|
136 |
</ul> |
|
137 |
% } |
|
138 | ||
139 |
<div style="margin-bottom:5px;"> |
|
improve branch select design
|
140 |
% my $display = defined $dir && length $dir ? 'tree' : 'tree_top'; |
improve branch select design
|
141 |
%= include '/include/branch_select', display => $display, Path => $dir, ssh_rep_url => $ssh_rep_url; |
improve commits header desig...
|
142 |
</div> |
143 |
|
|
144 |
<div style="margin-bottom:30px"> |
|
fix tree page link bug
|
145 |
%= include '/include/tree', dir => $dir; |
improve commits header desig...
|
146 |
</div> |
147 |
|
|
fix readme bug
|
148 |
%= include '/include/readme', dir => $dir; |
improve commits header desig...
|
149 |
|
add website URL settings. yo...
|
150 |
% } elsif ($state eq 'init' && $api->logined($user_id)) { |
improve commits header desig...
|
151 |
|
improve design
|
152 |
<h4 class="topic1">SSH</h4> |
improve commits header desig...
|
153 |
|
154 |
<div class="text-center" style="margin-bottom:10px"> |
|
155 |
<b>Create a new repository on the command line via ssh</b> |
|
156 |
</div> |
|
157 |
|
|
improve design
|
158 |
<pre class="command-line"> |
improve commits header desig...
|
159 |
touch README |
160 |
git init |
|
161 |
git add README |
|
162 |
git commit -m "first commit" |
|
163 |
git remote add origin <%= $ssh_rep_url %> |
|
164 |
git push -u origin master</pre> |
|
165 |
|
|
166 |
<div class="text-center" style="margin-bottom:10px"> |
|
167 |
<b>Push an existing repository from the command line via ssh</b> |
|
168 |
</div> |
|
169 |
|
|
improve design
|
170 |
<pre class="command-line"> |
improve commits header desig...
|
171 |
git remote add origin <%= $ssh_rep_url %> |
172 |
git push -u origin master</pre> |
|
173 | ||
174 |
<hr> |
|
175 | ||
add website URL settings. yo...
|
176 |
% my $http_rep_url = url_for("$user_id/$project_id.git")->to_abs; |
improve design
|
177 |
<h4 class="topic1"><%= uc url_for->to_abs->scheme %></h4> |
improve commits header desig...
|
178 | |
179 |
<div class="text-center" style="margin-bottom:10px"> |
|
180 |
<b>Create a new repository on the command line via <%= url_for->to_abs->scheme %></b> |
|
181 |
</div> |
|
182 |
|
|
improve design
|
183 |
<pre class="command-line"> |
improve commits header desig...
|
184 |
touch README |
185 |
git init |
|
186 |
git add README |
|
187 |
git commit -m "first commit" |
|
188 |
git remote add origin <%= $http_rep_url %> |
|
189 |
git push -u origin master</pre> |
|
190 |
|
|
191 |
<div class="text-center" style="margin-bottom:10px"> |
|
192 |
<b>Push an existing repository from the command line via <%= url_for->to_abs->scheme %></b> |
|
193 |
</div> |
|
194 |
|
|
improve design
|
195 |
<pre class="command-line"> |
improve commits header desig...
|
196 |
git remote add origin <%= $http_rep_url %> |
197 |
git push -u origin master</pre> |
|
198 |
% } else { |
|
improve design
|
199 |
<div class="not-yet-created"> |
improve commits header desig...
|
200 |
<b>Repository is not yet created.</b> |
201 |
</div> |
|
202 |
% } |
|
cleanup
|
203 |
</div> |
204 |
|
|
205 |
%= include '/include/footer'; |