add pulls page
|
1 |
<% |
2 |
# API |
|
create pull request list
|
3 |
my $api = gitprep_api; |
add pulls page
|
4 | |
5 |
# Parameters |
|
don't show pull request on n...
|
6 |
my $user_id = param('user'); |
7 |
my $project_id = param('project'); |
|
8 |
|
|
9 |
my $is = param('is'); |
|
10 |
|
|
11 |
my $open = $is eq 'closed' ? 0 : 1; |
|
add pulls page
|
12 |
|
13 |
# Git |
|
14 |
my $git = $self->app->git; |
|
15 |
|
|
fix pulls page bug
|
16 |
my $project_row_id = $api->get_project_row_id($user_id, $project_id); |
17 |
|
|
fix pulls page
|
18 |
# Issues which have pull request |
fix pulls page bug
|
19 |
my $issue_where = [ |
20 |
['and', ':issue.open{=}', ':pull_request{<>}', ':project{=}'], |
|
21 |
{'issue.open' => $open, pull_request => 0, project => $project_row_id} |
|
22 |
]; |
|
23 |
|
|
fix pulls page
|
24 |
my $issues = app->dbi->model('issue')->select( |
add pulls description
|
25 |
[ |
26 |
{__MY__ => '*'}, |
|
remove table __ prefix
|
27 |
{open_user => ['id']}, |
28 |
{pull_request => ['target_branch']} |
|
add pulls description
|
29 |
], |
fix pulls page bug
|
30 |
where => $issue_where |
add pulls description
|
31 |
)->all; |
create pull request list
|
32 |
|
33 |
# Open count |
|
add pull request count to he...
|
34 |
my $open_count = $api->get_open_pull_request_count($user_id, $project_id); |
create pull request list
|
35 |
|
36 |
# Close count |
|
add pull request count to he...
|
37 |
my $close_count = $api->get_close_pull_request_count($user_id, $project_id); |
update CHANGES
|
38 |
|
39 |
my $default_branch = app->manager->default_branch($user_id, $project_id); |
|
40 |
|
|
41 |
# Original projcet |
|
42 |
my $original_project = app->manager->original_project($user_id, $project_id); |
|
add pulls page
|
43 |
%> |
44 | ||
don't show pull request on n...
|
45 |
% layout 'common', title => "Pull Requests Tags \x{30fb} $user_id/$project_id"; |
add pulls page
|
46 |
|
47 |
%= include '/include/header'; |
|
48 |
|
|
49 |
<div class="container"> |
|
hide new pull reqeust button...
|
50 |
% if ($api->logined) { |
51 |
<div class="pulls-button-container"> |
|
52 |
% if ($original_project) { |
|
improve button design
|
53 |
<a href="<%= url_for("/$original_project->{'user.id'}/$original_project->{id}/compare/$original_project->{default_branch}...$user_id:$default_branch") %>" class="btn btn-green btn-new">New pull request</a> |
hide new pull reqeust button...
|
54 |
% } else { |
improve button design
|
55 |
<a href="<%= url_for("/$user_id/$project_id/compare") %>" class="btn btn-green btn-new">New pull request</a> |
hide new pull reqeust button...
|
56 |
% } |
57 |
</div> |
|
58 |
% } |
|
add pulls page
|
59 |
<div class="pulls"> |
60 |
<div class="pulls-header"> |
|
don't show pull request on n...
|
61 |
% if ($open) { |
62 |
<b><%= $open_count %> Open</b> |
|
63 |
<a href="<%= url_with->query([is => 'closed']) %>" style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</a> |
|
64 |
% } else { |
|
65 |
<a style="margin-left:5px;color:#767676" href="<%= url_with->query([is => undef]) %>"><%= $open_count %> Open</a> |
|
66 |
<b> |
|
67 |
<span style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</span> |
|
68 |
</b> |
|
69 |
% } |
|
add pulls page
|
70 |
</div> |
71 |
<div class="pulls-body"> |
|
fix pulls page
|
72 |
% if (@$issues) { |
create pull request list
|
73 |
<ul> |
fix pulls page
|
74 |
% for my $issue (@$issues) { |
add pulls description
|
75 |
<% |
remove table __ prefix
|
76 |
my $target_branch = $issue->{'pull_request.target_branch'}; |
cleanup join table
|
77 |
my $commit = app->git->get_commit(app->rep_info($user_id, $project_id), $target_branch); |
fix pulls page
|
78 |
my $open_time = $issue->{open_time}; |
cleanup
|
79 |
my $open_time_age = Time::Moment->now->epoch - $open_time; |
add pulls description
|
80 |
my $open_time_age_string = $self->app->git->_age_string($open_time_age); |
81 |
%> |
|
create pull request list
|
82 |
<li> |
83 |
<div class="pulls-title"> |
|
fix issue number bug
|
84 |
<a href="<%= "/$user_id/$project_id/pull/$issue->{number}" %>"> |
fix pulls page
|
85 |
<b><%= $issue->{title} %></b> |
improve pull page design
|
86 |
</a> |
create pull request list
|
87 |
</div> |
88 |
<div class="pulls-description"> |
|
fix issue number bug
|
89 |
#<%= $issue->{number} %> <%= $issue->{open} ? 'opened' : 'closed' %> |
add pulls description
|
90 |
<%= $open_time_age_string %> |
remove table __ prefix
|
91 |
by <%= $issue->{'open_user.id'} %> |
create pull request list
|
92 |
</div> |
93 |
</li> |
|
94 |
% } |
|
95 |
</ul> |
|
96 |
% } else { |
|
97 |
<div class="pulls-no-request"> |
|
98 |
<div style="font-size:18px"><b>There aren’t any open pull requests.</b></div> |
|
99 |
</div> |
|
100 |
% } |
|
add pulls page
|
101 |
</div> |
102 |
</div> |
|
103 |
</div> |
|
104 |
|
|
105 |
%= include '/include/footer'; |