... | ... |
@@ -121,14 +121,12 @@ |
121 | 121 |
Code |
122 | 122 |
</a> |
123 | 123 |
</li> |
124 |
- <!-- |
|
125 | 124 |
<li class="<%= $tab eq 'issues' ? 'active' : '' %>"> |
126 | 125 |
<a href="<%= url_for("/$user_id/$project_id/issues") %>"> |
127 | 126 |
<i class="icon-tasks"></i> |
128 | 127 |
Issue |
129 | 128 |
</a> |
130 | 129 |
</li> |
131 |
- --> |
|
132 | 130 |
<li class="<%= $tab eq 'pulls' ? 'active' : '' %>"> |
133 | 131 |
<a href="<%= url_for("/$user_id/$project_id/pulls") %>"> |
134 | 132 |
<i class="icon-retweet"></i> |
... | ... |
@@ -6,7 +6,42 @@ |
6 | 6 |
my $user_id = param('user'); |
7 | 7 |
my $project_id = param('project'); |
8 | 8 |
|
9 |
+ my $is = param('is') // ''; |
|
9 | 10 |
|
11 |
+ my $open = $is eq 'closed' ? 0 : 1; |
|
12 |
+ |
|
13 |
+ # Git |
|
14 |
+ my $git = $self->app->git; |
|
15 |
+ |
|
16 |
+ # Issues(which don't have pull request) |
|
17 |
+ my $issues = app->dbi->model('issue')->select( |
|
18 |
+ [ |
|
19 |
+ {__MY__ => '*'}, |
|
20 |
+ {open_user => ['id']}, |
|
21 |
+ ], |
|
22 |
+ where => [ |
|
23 |
+ ['and', ':issue.open{=}', ':pull_request{=}', ':project.id{=}'], |
|
24 |
+ {'issue.open' => $open, pull_request => 0, 'project.id' => $project_id} |
|
25 |
+ ] |
|
26 |
+ )->all; |
|
27 |
+ |
|
28 |
+ # Open count |
|
29 |
+ my $open_count = app->dbi->model('issue')->select( |
|
30 |
+ 'count(*)', |
|
31 |
+ where => [ |
|
32 |
+ ['and', ':issue.open{=}', ':pull_request{=}', ':project.id{=}'], |
|
33 |
+ {'issue.open' => 1, pull_request => 0, 'project.id' => $project_id} |
|
34 |
+ ] |
|
35 |
+ )->value; |
|
36 |
+ |
|
37 |
+ # Close count |
|
38 |
+ my $close_count = app->dbi->model('issue')->select( |
|
39 |
+ 'count(*)', |
|
40 |
+ where => [ |
|
41 |
+ ['and', ':issue.open{=}', ':pull_request{=}', ':project.id{=}'], |
|
42 |
+ {'issue.open' => 0, pull_request => 0, 'project.id' => $project_id} |
|
43 |
+ ] |
|
44 |
+ )->value; |
|
10 | 45 |
%> |
11 | 46 |
|
12 | 47 |
% layout 'common', title => "Pull Requests Tags \x{30fb} $user_id/$project_id"; |
... | ... |
@@ -14,7 +49,51 @@ |
14 | 49 |
%= include '/include/header'; |
15 | 50 |
|
16 | 51 |
<div class="container"> |
17 |
- <h1>Issues</h1> |
|
52 |
+ <div class="pulls-button-container"> |
|
53 |
+ <a href="<%= url_for("/$user_id/$project_id/compare") %>" class="btn btn-success">New issue</a> |
|
54 |
+ </div> |
|
55 |
+ <div class="pulls"> |
|
56 |
+ <div class="pulls-header"> |
|
57 |
+ % if ($open) { |
|
58 |
+ <b><%= $open_count %> Open</b> |
|
59 |
+ <a href="<%= url_with->query([is => 'closed']) %>" style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</a> |
|
60 |
+ % } else { |
|
61 |
+ <a style="margin-left:5px;color:#767676" href="<%= url_with->query([is => undef]) %>"><%= $open_count %> Open</a> |
|
62 |
+ <b> |
|
63 |
+ <span style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</span> |
|
64 |
+ </b> |
|
65 |
+ % } |
|
66 |
+ </div> |
|
67 |
+ <div class="pulls-body"> |
|
68 |
+ % if (@$issues) { |
|
69 |
+ <ul> |
|
70 |
+ % for my $issue (@$issues) { |
|
71 |
+ <% |
|
72 |
+ my $open_time = $issue->{open_time}; |
|
73 |
+ my $open_time_age = Time::Moment->now->epoch - $open_time; |
|
74 |
+ my $open_time_age_string = $self->app->git->_age_string($open_time_age); |
|
75 |
+ %> |
|
76 |
+ <li> |
|
77 |
+ <div class="pulls-title"> |
|
78 |
+ <a href="<%= "/$user_id/$project_id/pull/$issue->{number}" %>"> |
|
79 |
+ <b><%= $issue->{title} %></b> |
|
80 |
+ </a> |
|
81 |
+ </div> |
|
82 |
+ <div class="pulls-description"> |
|
83 |
+ #<%= $issue->{number} %> <%= $issue->{open} ? 'opened' : 'closed' %> |
|
84 |
+ <%= $open_time_age_string %> |
|
85 |
+ by <%= $issue->{'open_user.id'} %> |
|
86 |
+ </div> |
|
87 |
+ </li> |
|
88 |
+ % } |
|
89 |
+ </ul> |
|
90 |
+ % } else { |
|
91 |
+ <div class="pulls-no-request"> |
|
92 |
+ <div style="font-size:18px"><b>There aren’t any issues.</b></div> |
|
93 |
+ </div> |
|
94 |
+ % } |
|
95 |
+ </div> |
|
96 |
+ </div> |
|
18 | 97 |
</div> |
19 | 98 |
|
20 | 99 |
%= include '/include/footer'; |