improve pull page design
|
1 |
<% |
2 |
# API |
|
3 |
my $api = gitprep_api; |
|
4 | ||
5 |
# Parameters |
|
6 |
my $user = param('user'); |
|
7 |
my $project = param('project'); |
|
8 |
my $row_id = param('row_id'); |
|
9 |
|
|
user can only merge pull req...
|
10 |
my $user_row_id = app->dbi->model('user')->select('row_id', where => {id => $user})->value; |
11 |
|
|
improve pull page design
|
12 |
# Git |
13 |
my $git = $self->app->git; |
|
14 |
|
|
15 |
# Pull requests |
|
16 |
my $pull_request = app->dbi->model('pull_request')->select( |
|
17 |
[ |
|
18 |
{__MY__ => '*'}, |
|
19 |
{user => ['id']} |
|
20 |
], |
|
21 |
where => {'pull_request.row_id' => $row_id} |
|
22 |
)->one; |
|
23 |
|
|
24 |
my $from_rev = $pull_request->{branch1}; |
|
25 |
my $rev = $pull_request->{branch2}; |
|
26 |
|
|
27 |
# Commits |
|
28 |
my $commits = $git->forward_commits(app->rep_info($user, $project), $from_rev, $rev); |
|
29 |
my $commits_count = @$commits; |
|
30 |
my $commits_date = {}; |
|
31 |
my $authors = {}; |
|
32 |
for my $commit (@$commits) { |
|
33 |
my $date = $commit->{age_string_date_local}; |
|
34 |
$commits_date->{$date} ||= []; |
|
35 |
$authors->{$commit->{author}} = 1; |
|
36 |
push @{$commits_date->{$date}}, $commit; |
|
37 |
} |
|
38 |
my $authors_count = keys %$authors; |
|
39 | ||
40 |
# Start commit |
|
41 |
my $start_commit = $git->separated_commit(app->rep_info($user, $project), $from_rev, $rev); |
|
42 | ||
43 |
# End commit |
|
44 |
my $end_commit = $git->get_commit(app->rep_info($user, $project), $rev); |
|
45 | ||
46 |
# Variables |
|
47 |
stash id => $end_commit->{id}; |
|
48 |
stash from_id => $start_commit->{id}; |
|
49 |
stash rev => $end_commit->{id}; |
|
50 |
stash from_rev => $start_commit->{id}; |
|
user can only merge pull req...
|
51 |
|
52 |
# Allow pull request |
|
53 |
|
|
improve pull page design
|
54 |
%> |
55 | ||
56 |
% layout 'common', title => "Pull Requests Tags \x{30fb} $user/$project"; |
|
57 |
|
|
58 |
%= include '/include/header'; |
|
59 |
|
|
60 |
<div class="container"> |
|
61 |
<div style="font-size:23px;margin-top:20px;margin-bottom:9px;"> |
|
62 |
<% |
|
63 |
my $pull_title = $pull_request->{branch2}; |
|
64 |
$pull_title =~ s/_/ /g; |
|
65 |
$pull_title = ucfirst $pull_title; |
|
66 |
%> |
|
67 |
|
|
68 |
<%= $pull_title %> <span style="color:#767676;">#<%= $pull_request->{row_id} %></span> |
|
69 |
</div> |
|
70 |
<div> |
|
71 |
<div style="display:inline-block;color:white;margin-right:4px;"> |
|
72 |
% if ($pull_request->{open}) { |
|
73 |
<div style="background:#6cc644;padding:4px 8px;border-radius:3px;"> |
|
74 |
Open |
|
75 |
</div> |
|
76 |
% } else { |
|
77 |
<div style="background:red;padding:4px 8px;border-radius:3px;"> |
|
78 |
Closed |
|
79 |
</div> |
|
80 |
% } |
|
81 |
</div> |
|
82 |
% my $open_user_id = $pull_request->{'user.id'}; |
|
83 |
<a style="color:#333333;font-weight:bold" href="<%= url_for("/$open_user_id") %>"><%= $open_user_id %></a> |
|
84 |
<span style="color:#767676"> |
|
85 |
wants to merge <%= $commits_count %> commits |
|
86 |
into <%= $pull_request->{branch1} %> from <%= $pull_request->{branch2} %> |
|
87 |
</span> |
|
88 |
</div> |
|
89 |
<div> |
|
90 |
<ul class="compare-header"> |
|
91 |
<li> |
|
92 |
<b><%= @$commits %></b> <span>commit</span> |
|
93 |
</li> |
|
94 |
<li> |
|
95 |
<b><%= $authors_count %></b> <span>contributor</span> |
|
96 |
</li> |
|
97 |
<li> |
|
98 |
|
|
99 |
</li> |
|
100 |
<li> |
|
101 |
|
|
102 |
</li> |
|
103 |
</ul> |
|
104 |
|
|
105 |
<div class="commits"> |
|
106 |
% for my $date (reverse sort keys %$commits_date) { |
|
107 |
% my $commits = $commits_date->{$date}; |
|
108 |
|
|
109 |
<div class="commit-date"> |
|
110 |
<i class="icon-off"></i><span>Commits on <%= $date %></span> |
|
111 |
</div> |
|
112 |
|
|
113 |
<ul class="compare-commits-date-container"> |
|
114 |
% for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) { |
|
115 |
<% |
|
fix mail bug
|
116 |
my $commit_author_email = $commit->{author_email}; |
improve pull page design
|
117 |
my $commit_author_id = app->dbi->model('user')->select( |
118 |
'id', |
|
fix mail bug
|
119 |
where => {email => $commit_author_email} |
improve pull page design
|
120 |
)->value; |
121 |
%> |
|
122 |
<li> |
|
123 |
<div class="compare-commits-author"> |
|
124 |
<span title="<%= $commit->{author_email} %>"> |
|
125 |
% if (defined $commit_author_id) { |
|
126 |
<a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> |
|
127 |
% } else { |
|
128 |
<%= $commit->{author_name} %> |
|
129 |
% } |
|
130 |
</span> |
|
131 |
</div> |
|
132 |
<div class="compare-commits-commit-title"> |
|
133 |
<a style="color:#333" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
|
134 |
<%= $commit->{title_short} %> |
|
135 |
</a> |
|
136 |
</div> |
|
137 |
<div class="compare-commits-commit-id"> |
|
138 |
<a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
|
139 |
<%= substr($commit->{id}, 0, 7) %> |
|
140 |
</a> |
|
141 |
</div> |
|
142 |
</li> |
|
143 |
% } |
|
144 |
</ul> |
|
145 |
% } |
|
146 |
</div> |
|
147 |
|
|
148 |
%= include '/include/commit_body'; |
|
user can only merge pull req...
|
149 |
|
150 |
% if (session('user_row_id') eq $user_row_id) { |
|
151 |
<form action="<%= url_for %>" method="post"> |
|
152 |
<div class="pull-request-form"> |
|
153 |
<div style="overflow:hidden"> |
|
154 |
<div style="float:left;padding:10px;padding-right:0"> |
|
155 |
<div style="width:30px;height:30px;text-align:center;border-radius:15px;background:#95c97e;color:white;padding-top:5px;"><%= "\x{2714}" %></div> |
|
156 |
</div> |
|
157 |
<div style="float:left"> |
|
158 |
<div class="pull-request-form-title"> |
|
159 |
<div> |
|
160 |
<b>This branch has no conflicts with the base branch</b> |
|
161 |
</div> |
|
162 |
<div> |
|
163 |
<span style="color:#767676">Merging can be performed automatically.</span> |
|
164 |
</div> |
|
improve pull page design
|
165 |
</div> |
166 |
</div> |
|
167 |
</div> |
|
user can only merge pull req...
|
168 |
<div class="pull-request-form-button"> |
169 |
<%= submit_button 'Merge pull request', class => "btn btn-success" %> |
|
170 |
</div> |
|
improve pull page design
|
171 |
</div> |
172 |
</div> |
|
user can only merge pull req...
|
173 |
% } |
improve pull page design
|
174 |
</div> |
175 |
</div> |
|
176 | ||
177 |
|
|
178 |
%= include '/include/footer'; |