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