improve pull page design
|
1 |
<% |
2 |
# API |
|
3 |
my $api = gitprep_api; |
|
4 | ||
5 |
# Parameters |
|
fix pull_request table bug
|
6 |
my $base_user_id = param('user'); |
7 |
my $base_project_id = param('project'); |
|
fix issue number bug
|
8 |
my $issue_number = param('number'); |
fix pull page
|
9 |
|
10 |
# Issue |
|
11 |
my $issue = app->dbi->model('issue')->select( |
|
implement pull request
|
12 |
[ |
13 |
{__MY__ => '*'}, |
|
remove table __ prefix
|
14 |
{open_user => ['id']} |
implement pull request
|
15 |
], |
fix issue number bug
|
16 |
where => { |
17 |
'project.id' => $base_project_id, |
|
18 |
'issue.number' => $issue_number |
|
19 |
} |
|
fix pull page
|
20 |
)->one; |
21 |
|
|
22 |
# Pull requests |
|
23 |
my $pull_request = app->dbi->model('pull_request')->select( |
|
24 |
where => {row_id => $issue->{pull_request}} |
|
implement pull request
|
25 |
)->one; |
26 |
|
|
fix pull_request table bug
|
27 |
# Base information |
28 |
my $base_project_row_id = $pull_request->{base_project}; |
|
29 |
my $base_project = app->dbi->model('project')->select( |
|
30 |
[ |
|
31 |
{__MY__ => '*'}, |
|
remove table __ prefix
|
32 |
{user => ['id']} |
fix pull_request table bug
|
33 |
], |
34 |
where => {'project.row_id' => $base_project_row_id} |
|
35 |
)->one; |
|
36 |
my $base_branch = $pull_request->{base_branch}; |
|
37 |
|
|
38 |
Carp::croak "pull_request invalid user id" |
|
remove table __ prefix
|
39 |
if $base_user_id ne $base_project->{'user.id'}; |
fix pull_request table bug
|
40 |
Carp::croak "pull_request invalid project id" |
41 |
if $base_project_id ne $base_project->{id}; |
|
42 |
|
|
43 |
# Target information |
|
44 |
my $target_project_row_id = $pull_request->{target_project}; |
|
45 |
my $target_project = app->dbi->model('project')->select( |
|
46 |
[ |
|
47 |
{__MY__ => '*'}, |
|
remove table __ prefix
|
48 |
{user => ['id']} |
fix pull_request table bug
|
49 |
], |
50 |
where => {'project.row_id' => $target_project_row_id} |
|
51 |
)->one; |
|
52 |
my $target_branch = $pull_request->{target_branch}; |
|
remove table __ prefix
|
53 |
my $target_user_id = $target_project->{'user.id'}; |
add http command
|
54 |
my $target_project_id = $target_project->{id}; |
fix pull_request table bug
|
55 |
|
56 |
# Session |
|
complete pull request logic
|
57 |
my $session_user_row_id = $api->session_user_row_id; |
fix pull_request table bug
|
58 |
my $session_user_id = $api->session_user_id; |
59 |
|
|
60 |
# Base repository information |
|
61 |
my $base_rep_info = app->rep_info($base_user_id, $base_project_id); |
|
62 |
|
|
63 |
# Target repository information |
|
64 |
my $target_rep_info = app->rep_info($target_user_id, $base_project_id); |
|
65 |
|
|
66 |
# Working repository information |
|
67 |
my $work_rep_info = app->work_rep_info($base_user_id, $base_project_id); |
|
add patch feature
|
68 | |
69 |
# Display patch |
|
70 |
if (stash('patch')) { |
|
71 |
# Lock working repository |
|
72 |
my $lock_fh = $self->app->manager->lock_rep($work_rep_info); |
|
73 |
|
|
74 |
# Prepare merge |
|
75 |
$self->app->manager->prepare_merge( |
|
76 |
$work_rep_info, |
|
77 |
$base_rep_info, |
|
78 |
$base_branch, |
|
79 |
$target_rep_info, |
|
80 |
$target_branch |
|
81 |
); |
|
82 |
|
|
83 |
# Create patch |
|
84 |
my $patch = $self->app->manager->get_patch( |
|
85 |
$work_rep_info, |
|
86 |
$target_rep_info, |
|
87 |
$target_branch |
|
88 |
); |
|
89 |
|
|
90 |
$self->res->headers->content_type('text/plain; charset=utf-8'); |
|
91 |
$self->render(text => $patch); |
|
92 |
return; |
|
93 |
} |
|
94 | ||
fix pull_request table bug
|
95 |
# Git |
96 |
my $git = $self->app->git; |
|
improve pull page design
|
97 |
|
improve pull request. add co...
|
98 |
my $op = param('op') // ''; |
99 |
|
|
100 |
my $errors; |
|
change is_collaborator argum...
|
101 |
if (lc $self->req->method eq 'post') { |
102 |
|
|
implement close and reopen
|
103 |
# Close pull request |
104 |
my $op = param('op'); |
|
improve pull request. add co...
|
105 |
if ($op eq 'close-issue') { |
fix pull page
|
106 |
app->dbi->model('issue')->update( |
complete pull request logic
|
107 |
{ |
fix issue number bug
|
108 |
open => 0 |
complete pull request logic
|
109 |
}, |
fix issue number bug
|
110 |
where => {row_id => $issue->{row_id}} |
implement close and reopen
|
111 |
); |
112 |
$self->redirect_to('current'); |
|
113 |
return; |
|
114 |
} |
|
improve pull request. add co...
|
115 |
elsif ($op eq 'reopen-issue') { |
implement close and reopen
|
116 |
my $open_time = time; |
fix pull page
|
117 |
app->dbi->model('issue')->update( |
implement close and reopen
|
118 |
{ |
119 |
open => 1, |
|
complete pull request logic
|
120 |
open_time => $open_time, |
121 |
open_user => $session_user_row_id |
|
implement close and reopen
|
122 |
}, |
fix issue number bug
|
123 |
where => { |
fix issue number bug
|
124 |
row_id => $issue->{row_id} |
fix issue number bug
|
125 |
} |
implement close and reopen
|
126 |
); |
127 |
$self->redirect_to('current'); |
|
128 |
return; |
|
change is_collaborator argum...
|
129 |
} |
implement pull request
|
130 |
elsif ($op eq 'merge') { |
improve pull request. add co...
|
131 | |
132 |
# Access controll |
|
133 |
unless ($api->can_write_access($session_user_id, $base_user_id, $base_project_id)) { |
|
134 |
$self->reply->exception('Forbbiden'); |
|
135 |
return; |
|
136 |
} |
|
implement pull request
|
137 |
|
138 |
# Lock working repository |
|
139 |
my $lock_fh = $self->app->manager->lock_rep($work_rep_info); |
|
140 | ||
141 |
# Prepare merge |
|
142 |
$self->app->manager->prepare_merge( |
|
143 |
$work_rep_info, |
|
fix pull_request table bug
|
144 |
$base_rep_info, |
145 |
$base_branch, |
|
146 |
$target_rep_info, |
|
147 |
$target_branch |
|
implement pull request
|
148 |
); |
149 |
|
|
cleanup merge and push logic
|
150 |
# Merge |
151 |
my $merge_success = $self->app->manager->merge( |
|
implement pull request
|
152 |
$work_rep_info, |
fix pull_request table bug
|
153 |
$target_rep_info, |
154 |
$target_branch |
|
implement pull request
|
155 |
); |
156 |
|
|
fix merge pull request bug
|
157 |
|
cleanup merge and push logic
|
158 |
if ($merge_success) { |
159 |
# Push |
|
fix pull_request table bug
|
160 |
app->manager->push($work_rep_info, $base_branch); |
implement pull request
|
161 |
|
fix issue number bug
|
162 |
# Close |
fix pull page
|
163 |
app->dbi->model('issue')->update( |
complete pull request logic
|
164 |
{ |
fix pull page
|
165 |
open => 0 |
complete pull request logic
|
166 |
}, |
fix issue number bug
|
167 |
where => {row_id => $issue->{row_id}} |
implement pull request
|
168 |
); |
169 |
|
|
fix pull_request table bug
|
170 |
$self->redirect_to("/$base_user_id/$base_project_id/tree/$base_branch"); |
implement pull request
|
171 |
} |
172 |
} |
|
improve pull request. add co...
|
173 |
elsif ($op eq 'add-comment') { |
174 | ||
175 |
# Parameters |
|
176 |
my $message = param('message'); |
|
177 |
|
|
178 |
# Validation |
|
179 |
my $vc = app->vc; |
|
180 |
my $validation = $vc->validation; |
|
181 |
|
|
182 |
# Check Message |
|
183 |
if (!length $message) { |
|
184 |
$validation->add_failed(message => 'message is empty'); |
|
185 |
} |
|
186 |
elsif (length $message > 1000) { |
|
187 |
$validation->add_failed(message => 'message is too long'); |
|
188 |
} |
|
189 |
|
|
190 |
if ($validation->is_valid) { |
|
191 | ||
192 |
$api->add_issue_message($base_user_id, $base_project_id, $issue_number, $message); |
|
193 |
|
|
194 |
$self->redirect_to; |
|
195 |
return; |
|
196 |
} |
|
197 |
else { |
|
198 |
$errors = $validation->messages; |
|
199 |
} |
|
200 |
} |
|
add issue message delete fea...
|
201 |
elsif ($op eq 'api-delete-issue-message') { |
202 |
my $issue_message_row_id = param('issue_message_row_id'); |
|
203 |
|
|
204 |
my $json = $api->api_delete_issue_message($issue_message_row_id, $base_user_id); |
|
205 |
|
|
implement issue comment upda...
|
206 |
$self->render(json => $json); |
207 |
return; |
|
208 |
} |
|
209 |
elsif ($op eq 'api-update-issue-message') { |
|
210 |
|
|
211 |
my $issue_message_row_id = param('issue_message_row_id'); |
|
212 |
my $message = param('message'); |
|
213 |
|
|
214 |
my $json = $api->api_update_issue_message($issue_message_row_id, $message, $base_user_id); |
|
215 |
|
|
add issue message delete fea...
|
216 |
$self->render(json => $json); |
217 |
return; |
|
218 |
} |
|
change is_collaborator argum...
|
219 |
} |
220 |
|
|
improve pull page design
|
221 |
# Commits |
fix compare page from forke...
|
222 |
my $commits = $git->forward_commits( |
223 |
$work_rep_info, |
|
224 |
$base_rep_info, |
|
225 |
$base_branch, |
|
226 |
$target_rep_info, |
|
227 |
$target_branch |
|
228 |
); |
|
improve pull page design
|
229 |
my $commits_count = @$commits; |
230 |
my $commits_date = {}; |
|
231 |
my $authors = {}; |
|
232 |
for my $commit (@$commits) { |
|
233 |
my $date = $commit->{age_string_date_local}; |
|
234 |
$commits_date->{$date} ||= []; |
|
235 |
$authors->{$commit->{author}} = 1; |
|
236 |
push @{$commits_date->{$date}}, $commit; |
|
237 |
} |
|
238 |
my $authors_count = keys %$authors; |
|
239 | ||
240 |
# Start commit |
|
fix compare page from forke...
|
241 |
my $start_commit_id = app->git->ref_to_object_id($base_rep_info, $base_branch); |
improve pull page design
|
242 | |
243 |
# End commit |
|
fix compare page from forke...
|
244 |
my $end_commit_id = app->git->ref_to_object_id($target_rep_info, $target_branch); |
user can only merge pull req...
|
245 |
|
improve pull request. add co...
|
246 |
# Issue messages |
247 |
my $issue_messages = app->dbi->model('issue_message')->select( |
|
add pull request message
|
248 |
[ |
249 |
{__MY__ => '*'}, |
|
remove table __ prefix
|
250 |
{user => ['id']} |
add pull request message
|
251 |
], |
improve pull request. add co...
|
252 |
where => {issue => $issue->{row_id}} |
253 |
)->all; |
|
cleanup
|
254 |
|
improve pull request. add co...
|
255 |
# Issue message count |
256 |
my $issue_messages_count = app->dbi->model('issue_message')->select( |
|
257 |
'count(*)', |
|
258 |
where => {issue => $issue->{row_id}}, |
|
259 |
)->value; |
|
260 | ||
cleanup prepare merge
|
261 |
# Check merge automatically |
cleanup merge and push logic
|
262 |
my $merge_success; |
fix pull page
|
263 |
if ($api->can_write_access($session_user_id, $base_user_id, $base_project_id) && $issue->{open}) { |
fix pull_request table bug
|
264 |
|
implement pull request
|
265 |
my $lock_fh = $self->app->manager->lock_rep($work_rep_info); |
266 |
|
|
267 |
# Prepare merge |
|
268 |
$self->app->manager->prepare_merge( |
|
269 |
$work_rep_info, |
|
fix pull_request table bug
|
270 |
$base_rep_info, |
271 |
$base_branch, |
|
272 |
$target_rep_info, |
|
273 |
$target_branch |
|
implement pull request
|
274 |
); |
275 |
|
|
276 |
# Check merge automatical |
|
cleanup merge and push logic
|
277 |
$merge_success = $self->app->manager->merge( |
implement pull request
|
278 |
$work_rep_info, |
fix pull_request table bug
|
279 |
$target_rep_info, |
280 |
$target_branch |
|
cleanup prepare merge
|
281 |
); |
282 |
} |
|
complete command line merge
|
283 |
|
284 |
# HTTP repository URL |
|
285 |
my $http_rep_url = url_for("$target_user_id/$target_project_id.git")->to_abs; |
|
286 |
|
|
287 |
# SSH repository URL |
|
288 |
my $url = url_for->to_abs; |
|
289 |
$url->base(undef); |
|
290 |
my $ssh_port = config->{basic}{ssh_port}; |
|
291 |
my $rep_home = app->rep_home; |
|
292 |
my $execute_user = getpwuid($>); |
|
293 |
my $ssh_rep_url_base = defined app->config->{basic}{'ssh_rep_url_base'} |
|
294 |
? app->config->{basic}{'ssh_rep_url_base'} : $rep_home; |
|
295 |
my $ssh_rep_url = "ssh://$execute_user\@" . $url->host |
|
296 |
. ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user/$project.git"; |
|
cleanup prepare merge
|
297 | |
fix issue number bug
|
298 |
my $patch_url = url_for("/$base_user_id/$base_project_id/pull/$issue->{number}.patch")->to_abs; |
complete command line merge
|
299 | |
300 |
my $pre_content_base = "git checkout -b $target_user_id-$target_branch $base_branch"; |
|
301 |
my $pre_content_http = "git pull $http_rep_url $target_branch"; |
|
302 |
my $pre_content_ssh = "git pull $ssh_rep_url $target_branch"; |
|
303 |
|
|
cleanup
|
304 |
# Commit body arguments |
305 |
my %commit_body_args = ( |
|
fix compare page from forke...
|
306 |
rep_info => $work_rep_info, |
307 |
rev => $end_commit_id, |
|
308 |
from_rev => $start_commit_id |
|
cleanup
|
309 |
); |
improve pull request. add co...
|
310 | |
311 |
layout 'common', title => "Pull Requests Tags \x{30fb} $base_user_id/$base_project_id"; |
|
improve pull page design
|
312 |
%> |
313 | ||
improve pull request. add co...
|
314 | |
315 |
%= javascript begin |
|
316 |
$(document).ready(function() { |
|
cleanup issue and pull page
|
317 |
%= include '/include/js/issue'; |
improve pull request. add co...
|
318 |
}); |
319 |
% end |
|
320 | ||
improve pull page design
|
321 |
%= include '/include/header'; |
322 |
|
|
323 |
<div class="container"> |
|
improve pull request. add co...
|
324 |
%= include '/include/errors', errors => $errors; |
improve pull page design
|
325 |
<div style="font-size:23px;margin-top:20px;margin-bottom:9px;"> |
326 |
<% |
|
cleanup join table
|
327 |
my $pull_title = $pull_request->{target_branch}; |
improve pull page design
|
328 |
$pull_title =~ s/_/ /g; |
329 |
$pull_title = ucfirst $pull_title; |
|
330 |
%> |
|
331 |
|
|
fix issue number bug
|
332 |
<%= $pull_title %> <span style="color:#767676;">#<%= $issue->{number} %></span> |
improve pull page design
|
333 |
</div> |
334 |
<div> |
|
335 |
<div style="display:inline-block;color:white;margin-right:4px;"> |
|
fix pull page
|
336 |
% if ($issue->{open}) { |
improve pull page design
|
337 |
<div style="background:#6cc644;padding:4px 8px;border-radius:3px;"> |
338 |
Open |
|
339 |
</div> |
|
340 |
% } else { |
|
implement close and reopen
|
341 |
<div style="background:#bd2c00;padding:4px 8px;border-radius:3px;"> |
improve pull page design
|
342 |
Closed |
343 |
</div> |
|
344 |
% } |
|
345 |
</div> |
|
remove table __ prefix
|
346 |
% my $open_user_id = $issue->{'open_user.id'}; |
improve pull page design
|
347 |
<a style="color:#333333;font-weight:bold" href="<%= url_for("/$open_user_id") %>"><%= $open_user_id %></a> |
348 |
<span style="color:#767676"> |
|
349 |
wants to merge <%= $commits_count %> commits |
|
improve pull page design
|
350 |
into |
351 |
<span style="display:inline-block;padding:2px 4px;background:#e8f0f8;color:#336479;border-radius:3px;"> |
|
fix pull_request table bug
|
352 |
<%= $pull_request->{base_branch} %> |
improve pull page design
|
353 |
</span> |
354 |
from |
|
355 |
<span style="display:inline-block;padding:2px 4px;background:#e8f0f8;color:#336479;border-radius:3px;"> |
|
fix pull_request table bug
|
356 |
% if ($base_user_id ne $target_user_id) { |
357 |
<%= $target_user_id %> |
|
358 |
/ |
|
359 |
% } |
|
360 |
<%= $pull_request->{target_branch} %> |
|
improve pull page design
|
361 |
</span> |
improve pull page design
|
362 |
</span> |
363 |
</div> |
|
don't show pull request on n...
|
364 |
% if (!$commits_count) { |
365 |
<div class="compare-nothing" style="margin-top:10px"> |
|
366 |
<div> |
|
367 |
<b><big>There isn't anything to compare.</big></b> |
|
add pull request message
|
368 |
</div> |
369 |
</div> |
|
don't show pull request on n...
|
370 |
% } else { |
371 |
<div> |
|
372 |
<ul class="compare-header"> |
|
373 |
<li> |
|
374 |
<b><%= @$commits %></b> <span>commit</span> |
|
375 |
</li> |
|
376 |
<li> |
|
377 |
<b><%= $authors_count %></b> <span>contributor</span> |
|
378 |
</li> |
|
379 |
<li> |
|
380 |
|
|
381 |
</li> |
|
382 |
<li> |
|
383 |
|
|
384 |
</li> |
|
385 |
</ul> |
|
improve pull request. add co...
|
386 | |
387 |
<div class="issue-panel" style="margin-top:10px;"> |
|
388 |
<div> |
|
389 |
% for my $issue_message (@$issue_messages) { |
|
cleanup isseu and pull reque...
|
390 |
<% |
391 |
my %issue_message_param = ( |
|
392 |
user_id => $base_user_id, |
|
393 |
issue_message => $issue_message |
|
394 |
); |
|
395 |
%> |
|
396 |
|
|
397 |
%= include '/include/issue_message', %issue_message_param; |
|
improve pull request. add co...
|
398 |
% } |
don't show pull request on n...
|
399 |
</div> |
400 |
</div> |
|
improve pull request. add co...
|
401 | |
don't show pull request on n...
|
402 |
<div class="commits"> |
403 |
% for my $date (reverse sort keys %$commits_date) { |
|
404 |
% my $commits = $commits_date->{$date}; |
|
405 |
|
|
406 |
<div class="commit-date"> |
|
407 |
<i class="icon-off"></i><span>Commits on <%= $date %></span> |
|
408 |
</div> |
|
409 |
|
|
410 |
<ul class="compare-commits-date-container"> |
|
411 |
% for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) { |
|
412 |
<% |
|
413 |
my $commit_author_email = $commit->{author_email}; |
|
414 |
my $commit_author_id = app->dbi->model('user')->select( |
|
415 |
'id', |
|
416 |
where => {email => $commit_author_email} |
|
417 |
)->value; |
|
418 |
%> |
|
419 |
<li> |
|
420 |
<div class="compare-commits-author"> |
|
421 |
<span title="<%= $commit->{author_email} %>"> |
|
422 |
% if (defined $commit_author_id) { |
|
423 |
<a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> |
|
424 |
% } else { |
|
425 |
<%= $commit->{author_name} %> |
|
426 |
% } |
|
427 |
</span> |
|
428 |
</div> |
|
429 |
<div class="compare-commits-commit-title"> |
|
fix pull_request table bug
|
430 |
<a style="color:#333" href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>"> |
don't show pull request on n...
|
431 |
<%= $commit->{title_short} %> |
432 |
</a> |
|
433 |
</div> |
|
434 |
<div class="compare-commits-commit-id"> |
|
fix pull_request table bug
|
435 |
<a href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>"> |
don't show pull request on n...
|
436 |
<%= substr($commit->{id}, 0, 7) %> |
437 |
</a> |
|
438 |
</div> |
|
439 |
</li> |
|
440 |
% } |
|
441 |
</ul> |
|
442 |
% } |
|
443 |
</div> |
|
cleanup
|
444 | |
445 |
|
|
don't show pull request on n...
|
446 |
%= include '/include/commit_body', %commit_body_args; |
447 |
% } |
|
improve pull page design
|
448 |
|
fix pull_request table bug
|
449 |
% if ($api->can_write_access($session_user_id, $base_user_id, $base_project_id)) { |
fix pull page
|
450 |
% if ($commits_count && $merge_success && $issue->{open}) { |
add pull request command lin...
|
451 |
<div class="pull-request-form"> |
complete command line merge
|
452 |
<div style="overflow:hidden"> |
453 |
<div style="float:left;padding:10px;padding-right:0"> |
|
454 |
<div style="width:30px;height:30px;text-align:center;border-radius:15px;background:#95c97e;color:white;padding-top:5px;"><%= "\x{2714}" %></div> |
|
improve pull page design
|
455 |
</div> |
complete command line merge
|
456 |
<div style="float:left"> |
457 |
<div class="pull-request-form-title"> |
|
add pull request command lin...
|
458 |
<div> |
complete command line merge
|
459 |
<b>This branch has no conflicts with the base branch</b> |
add pull request command lin...
|
460 |
</div> |
complete command line merge
|
461 |
<div> |
462 |
<span style="color:#767676">Merging can be performed automatically.</span> |
|
add pull request command lin...
|
463 |
</div> |
complete command line merge
|
464 |
</div> |
465 |
</div> |
|
466 |
</div> |
|
467 |
<div class="pull-request-form-button"> |
|
468 |
<form action="<%= url_for %>" method="post"> |
|
469 |
<%= hidden_field op => 'merge' %> |
|
470 |
<%= submit_button 'Merge pull request', class => "btn btn-success" %> |
|
471 |
<span style="margin-left:5px"> |
|
472 |
You can also view <a href="javascript:void(0)" onclick="$('#command-line-instructions').toggle()" >command line instructions</a>. |
|
473 |
</span> |
|
474 |
</form> |
|
475 |
|
|
476 |
<div id="command-line-instructions" style="display:none"> |
|
477 |
<div style="font-size:18px;padding:10px 0"> |
|
478 |
Merging via command line |
|
479 |
</div> |
|
add pull request command lin...
|
480 | |
complete command line merge
|
481 |
<div> |
482 |
If you do not want to use the merge button or an automatic merge cannot be performed, you can perform a manual merge on the command line. |
|
483 |
</div> |
|
484 |
%= javascript begin |
|
485 |
$(document).ready(function () { |
|
486 |
var http_rep_url = "<%= $http_rep_url %>"; |
|
487 |
|
|
488 |
var ssh_rep_url = "<%= $ssh_rep_url %>"; |
|
489 |
var patch_url = "<%= $patch_url %>"; |
|
490 |
|
|
491 |
var pre_content_base = "<%= $pre_content_base %>"; |
|
492 |
var pre_content_http = "<%= $pre_content_http %>"; |
|
493 |
var pre_content_ssh = "<%= $pre_content_ssh %>"; |
|
494 |
|
|
495 |
var pre_content_http_all = pre_content_base + "\n" + pre_content_http; |
|
496 |
var pre_content_ssh_all = pre_content_base + "\n" + pre_content_ssh; |
|
497 |
|
|
498 |
$('#http-btn').on('click', function () { |
|
499 |
$('[name=clone_url]').val(http_rep_url); |
|
500 |
$('#step1').text(pre_content_http_all); |
|
501 |
}); |
|
502 |
$('#ssh-btn').on('click', function () { |
|
503 |
$('[name=clone_url]').val(ssh_rep_url); |
|
504 |
$('#step1').text(pre_content_ssh_all); |
|
505 |
}); |
|
506 |
$('#patch-btn').on('click', function () { |
|
507 |
$('[name=clone_url]').val(patch_url); |
|
508 |
}); |
|
509 |
}); |
|
510 |
% end |
|
511 |
|
|
512 |
<div style="margin-top:10px"> |
|
513 |
<button id="http-btn" class="btn btn-small" style="border-radius:3px 0 0 3px">HTTPS</button><button id="ssh-btn" class="btn btn-small" style="border-radius:0">SSH</button><button id="patch-btn" class="btn btn-small" style="border-radius:0">Patch</button><%= text_field clone_url => $http_rep_url, style => "width:600px;padding:4px 7px 5px 7px;border-radius:0 3px 3px 0" %> |
|
514 |
</div> |
|
add pull request command lin...
|
515 | |
complete command line merge
|
516 |
<div style="margin-top:15px;margin-bottom:5px;"> |
517 |
<b>Step 1:</b> From your project repository, check out a new branch and test the changes. |
|
518 |
</div> |
|
519 | ||
520 |
<pre id="step1" style="background:#f2f2f2; padding:10px; border-radius:3px"> |
|
add http command
|
521 |
git checkout -b <%= $target_user_id %>-<%= $target_branch %> <%= $base_branch %> |
522 |
git pull <%= url_for("$target_user_id/$target_project_id.git")->to_abs %> <%= $target_branch %> |
|
add pull request command lin...
|
523 |
</pre> |
524 | ||
complete command line merge
|
525 |
<div style="margin-top:15px;margin-bottom:5px;"> |
526 |
<b>Step 2:</b> Merge the changes and update on GitPrep. |
|
527 |
</div> |
|
add pull request command lin...
|
528 | |
529 |
<pre style="background:#f2f2f2; padding:10px; border-radius:3px"> |
|
add http command
|
530 |
git checkout <%= $base_branch %> |
531 |
git merge --no-ff <%= $target_user_id %>-<%= $target_branch %> |
|
532 |
git push origin <%= $base_branch %> |
|
add pull request command lin...
|
533 |
</pre> |
implement close and reopen
|
534 |
</div> |
improve pull page design
|
535 |
</div> |
add pull request command lin...
|
536 |
</div> |
implement close and reopen
|
537 |
% } |
improve pull request. add co...
|
538 |
% } |
539 | ||
540 |
% if ($api->logined) { |
|
541 |
<div class="issue-add-comment"> |
|
542 |
<form action="<%= url_for %>" method="post"> |
|
543 |
<%= hidden_field 'op' %> |
|
544 |
<div class="issue-add-comment-header"> |
|
cleanup issue preview
|
545 |
<div class="issue-message-write-tab issue-add-comment-header-tab"><a href="javascript:void(0)">Write</a></div> |
546 |
<div class="issue-message-preview-tab issue-add-comment-header-tab"><a class="disable" href="javascript:void(0)">Preview</a></div> |
|
547 |
%= include '/include/issue_comment_icon'; |
|
improve pull request. add co...
|
548 |
</div> |
549 |
<div class="issue-add-comment-body"> |
|
cleanup issue preview
|
550 |
<div class="issue-message-write-area issue-add-comment-message"> |
improve pull request. add co...
|
551 |
<%= text_area 'message' %> |
552 |
</div> |
|
cleanup issue preview
|
553 |
<div class="issue-message-preview-area issue-add-comment-preview markdown-body" style="padding:10px"> |
improve pull request. add co...
|
554 |
</div> |
555 |
<div class="issue-add-comment-bottom"> |
|
556 |
<div class="issue-add-comment-button-left"> |
|
557 |
Styling with Markdown is supported |
|
558 |
</div> |
|
559 |
<div class="issue-add-comment-button"> |
|
560 |
% if ($issue->{open}) { |
|
561 |
<input type="submit" value="Close pull request" onclick="$(this).closest('form').find('[name=op]').val('close-issue'); $(this).closest('form').submit();" class="btn"> |
|
562 |
% } else { |
|
563 |
<input type="submit" value="Reopen pull request" onclick="$(this).closest('form').find('[name=op]').val('reopen-issue'); $(this).closest('form').submit();" class="btn"> |
|
564 |
% } |
|
565 |
<input type="submit" value="Comment" onclick="$(this).closest('form').find('[name=op]').val('add-comment'); $(this).closest('form').submit();" class="btn btn-success"> |
|
566 |
</div> |
|
567 |
</div> |
|
568 |
</div> |
|
569 |
</form> |
|
570 |
</div> |
|
user can only merge pull req...
|
571 |
% } |
improve pull page design
|
572 |
</div> |
573 |
</div> |
|
574 | ||
575 |
%= include '/include/footer'; |