... | ... |
@@ -599,14 +599,17 @@ EOS |
599 | 599 |
# Create pull_request columns |
600 | 600 |
my @pull_request_columns = ( |
601 | 601 |
"title not null default ''", |
602 |
- "message not null default ''" |
|
602 |
+ "message not null default ''", |
|
603 |
+ "open integer default 0", |
|
604 |
+ "open_time integer default 0'", |
|
605 |
+ "open_user integer default 0" |
|
603 | 606 |
); |
604 | 607 |
for my $column (@pull_request_columns) { |
605 | 608 |
eval { $dbi->execute("alter table pull_request add column $column") }; |
606 | 609 |
} |
607 | 610 |
|
608 | 611 |
# Check pull_request table |
609 |
- eval { $dbi->select([qw/row_id project branch1 branch2 title/], table => 'pull_request') }; |
|
612 |
+ eval { $dbi->select([qw/row_id project branch1 branch2 title message open/], table => 'pull_request') }; |
|
610 | 613 |
if ($@) { |
611 | 614 |
my $error = "Can't create pull_request table properly: $@"; |
612 | 615 |
$self->app->log->error($error); |
... | ... |
@@ -35,6 +35,34 @@ |
35 | 35 |
box-sizing: border-box; |
36 | 36 |
} |
37 | 37 |
|
38 |
+.pulls-button-container { |
|
39 |
+ text-align:right; |
|
40 |
+ margin-bottom:10px; |
|
41 |
+} |
|
42 |
+.pulls-header { |
|
43 |
+ border:1px solid #d8d8d8; |
|
44 |
+ background:#fafafa; |
|
45 |
+ padding:10px; |
|
46 |
+} |
|
47 |
+.pulls-body { |
|
48 |
+ border:1px solid #d8d8d8; |
|
49 |
+ border-top:none; |
|
50 |
+ background:#fafafa; |
|
51 |
+ background:white; |
|
52 |
+} |
|
53 |
+.pulls-body li { |
|
54 |
+ padding:10px; |
|
55 |
+} |
|
56 |
+.pulls-no-request { |
|
57 |
+ padding:30px; |
|
58 |
+ margin:1px auto; |
|
59 |
+ width:600px; |
|
60 |
+ text-align:center; |
|
61 |
+} |
|
62 |
+ |
|
63 |
+.pulls-description { |
|
64 |
+ color:#767676; |
|
65 |
+} |
|
38 | 66 |
.compare-open-pull-request { |
39 | 67 |
border:1px solid #d8d8d8; |
40 | 68 |
border-radius: 3px; |
... | ... |
@@ -68,27 +96,6 @@ |
68 | 96 |
line-height:150%; |
69 | 97 |
} |
70 | 98 |
|
71 |
-.pulls-button-container { |
|
72 |
- text-align:right; |
|
73 |
- margin-bottom:10px; |
|
74 |
-} |
|
75 |
-.pulls-header { |
|
76 |
- border:1px solid #d8d8d8; |
|
77 |
- background:#fafafa; |
|
78 |
- padding:10px; |
|
79 |
-} |
|
80 |
-.pulls-body { |
|
81 |
- border:1px solid #d8d8d8; |
|
82 |
- border-top:none; |
|
83 |
- background:#fafafa; |
|
84 |
- text-align:center; |
|
85 |
-} |
|
86 |
-.pulls-no-request { |
|
87 |
- padding:30px; |
|
88 |
- margin:1px auto; |
|
89 |
- width:600px; |
|
90 |
-} |
|
91 |
- |
|
92 | 99 |
.text-gray { color:#767676 } |
93 | 100 |
|
94 | 101 |
input[type=text], input[type=password] { |
... | ... |
@@ -43,7 +43,8 @@ |
43 | 43 |
branch1 => $from_rev, |
44 | 44 |
branch2 => $rev, |
45 | 45 |
title => $title, |
46 |
- message => $message |
|
46 |
+ message => $message, |
|
47 |
+ open => 1 |
|
47 | 48 |
}; |
48 | 49 |
|
49 | 50 |
app->dbi->model('pull_request')->insert($new_pull_request_params); |
... | ... |
@@ -1,28 +1,25 @@ |
1 | 1 |
<% |
2 | 2 |
# API |
3 |
- my $api = Gitprep::API->new($self); |
|
3 |
+ my $api = gitprep_api; |
|
4 | 4 |
|
5 | 5 |
# Parameters |
6 | 6 |
my $user = param('user'); |
7 | 7 |
my $project = param('project'); |
8 |
- my $page = param('page') || 1; |
|
9 | 8 |
|
10 | 9 |
# Git |
11 | 10 |
my $git = $self->app->git; |
12 | 11 |
|
13 |
- # Ref names |
|
14 |
- my $limit = app->config->{basic}{tags_limit}; |
|
15 |
- my $page_count = 20; |
|
16 |
- my $tags = $git->tags( |
|
17 |
- app->rep_info($user, $project), |
|
18 |
- $limit, |
|
19 |
- $page_count, |
|
20 |
- $page_count * ($page - 1) |
|
21 |
- ); |
|
22 |
- my $tags_count = $git->tags_count(app->rep_info($user, $project)); |
|
12 |
+ # Pull requests |
|
13 |
+ my $pull_requests = app->dbi->model('pull_request')->select(where => {open => 1})->all; |
|
14 |
+ |
|
15 |
+ # Open count |
|
16 |
+ my $open_count = app->dbi->model('pull_request')->select('count(*)', where => {open => 1})->value; |
|
17 |
+ |
|
18 |
+ # Close count |
|
19 |
+ my $close_count = app->dbi->model('pull_request')->select('count(*)', where => {open => 0})->value; |
|
23 | 20 |
%> |
24 | 21 |
|
25 |
-% layout 'common', title => "Tags \x{30fb} $user/$project"; |
|
22 |
+% layout 'common', title => "Pull Requests Tags \x{30fb} $user/$project"; |
|
26 | 23 |
|
27 | 24 |
%= include '/include/header'; |
28 | 25 |
|
... | ... |
@@ -32,12 +29,29 @@ |
32 | 29 |
</div> |
33 | 30 |
<div class="pulls"> |
34 | 31 |
<div class="pulls-header"> |
35 |
- Open Close |
|
32 |
+ <b><%= $open_count %> Open</b> <span style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</span> |
|
36 | 33 |
</div> |
37 | 34 |
<div class="pulls-body"> |
38 |
- <div class="pulls-no-request"> |
|
39 |
- <div style="font-size:18px"><b>There aren’t any open pull requests.</b></div> |
|
40 |
- </div> |
|
35 |
+ % if (@$pull_requests) { |
|
36 |
+ <ul> |
|
37 |
+ % for my $pull_request (@$pull_requests) { |
|
38 |
+ % my $branch2 = $pull_request->{branch2}; |
|
39 |
+ % my $commit = app->git->get_commit(app->rep_info($user, $project), $branch2); |
|
40 |
+ <li> |
|
41 |
+ <div class="pulls-title"> |
|
42 |
+ <b><%= $pull_request->{title} %></b> |
|
43 |
+ </div> |
|
44 |
+ <div class="pulls-description"> |
|
45 |
+ #<%= $pull_request->{row_id} %> <%= $pull_request->{open} ? 'opened' : 'closed' %> |
|
46 |
+ </div> |
|
47 |
+ </li> |
|
48 |
+ % } |
|
49 |
+ </ul> |
|
50 |
+ % } else { |
|
51 |
+ <div class="pulls-no-request"> |
|
52 |
+ <div style="font-size:18px"><b>There aren’t any open pull requests.</b></div> |
|
53 |
+ </div> |
|
54 |
+ % } |
|
41 | 55 |
</div> |
42 | 56 |
</div> |
43 | 57 |
</div> |