| ... | ... | @@ -116,6 +116,10 @@ | 
| 116 | 116 | } | 
| 117 | 117 |  .pulls-body li { | 
| 118 | 118 | padding:10px; | 
| 119 | + border-top: 1px solid #d8d8d8; | |
| 120 | +} | |
| 121 | +.pulls-body li:first-child { | |
| 122 | + border-top:none; | |
| 119 | 123 | } | 
| 120 | 124 |  .pulls-no-request { | 
| 121 | 125 | padding:30px; | 
| ... | ... | @@ -201,82 +201,90 @@ | 
| 201 | 201 | </span> | 
| 202 | 202 | </span> | 
| 203 | 203 | </div> | 
| 204 | - <div> | |
| 205 | - <ul class="compare-header"> | |
| 206 | - <li> | |
| 207 | - <b><%= @$commits %></b> <span>commit</span> | |
| 208 | - </li> | |
| 209 | - <li> | |
| 210 | - <b><%= $authors_count %></b> <span>contributor</span> | |
| 211 | - </li> | |
| 212 | - <li> | |
| 213 | - | |
| 214 | - </li> | |
| 215 | - <li> | |
| 216 | - | |
| 217 | - </li> | |
| 218 | - </ul> | |
| 219 | - <div class="pull-comment"> | |
| 220 | - <div class="pull-comment-header"> | |
| 221 | -          <b><%= $pull_request_message_first->{'user.id'} %></b> | |
| 222 | - <span style="color:#767676"> | |
| 223 | - commented | |
| 224 | -            <%= $api->age_string($pull_request_message_first->{update_time}) %></b> | |
| 225 | - </span> | |
| 226 | - </div> | |
| 227 | - <div class="pull-comment-body"> | |
| 228 | -          <%= $pull_request_message_first->{message} %> | |
| 204 | +    % if (!$commits_count) { | |
| 205 | + <div class="compare-nothing" style="margin-top:10px"> | |
| 206 | + <div> | |
| 207 | + <b><big>There isn't anything to compare.</big></b> | |
| 229 | 208 | </div> | 
| 230 | 209 | </div> | 
| 231 | - | |
| 232 | - <div class="commits"> | |
| 233 | -        % for my $date (reverse sort keys %$commits_date) { | |
| 234 | -          % my $commits = $commits_date->{$date}; | |
| 235 | - | |
| 236 | - <div class="commit-date"> | |
| 237 | - <i class="icon-off"></i><span>Commits on <%= $date %></span> | |
| 210 | +    % } else { | |
| 211 | + <div> | |
| 212 | + <ul class="compare-header"> | |
| 213 | + <li> | |
| 214 | + <b><%= @$commits %></b> <span>commit</span> | |
| 215 | + </li> | |
| 216 | + <li> | |
| 217 | + <b><%= $authors_count %></b> <span>contributor</span> | |
| 218 | + </li> | |
| 219 | + <li> | |
| 220 | + | |
| 221 | + </li> | |
| 222 | + <li> | |
| 223 | + | |
| 224 | + </li> | |
| 225 | + </ul> | |
| 226 | + <div class="pull-comment"> | |
| 227 | + <div class="pull-comment-header"> | |
| 228 | +            <b><%= $pull_request_message_first->{'user.id'} %></b> | |
| 229 | + <span style="color:#767676"> | |
| 230 | + commented | |
| 231 | +              <%= $api->age_string($pull_request_message_first->{update_time}) %></b> | |
| 232 | + </span> | |
| 238 | 233 | </div> | 
| 239 | - | |
| 240 | - <ul class="compare-commits-date-container"> | |
| 241 | -            % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) { | |
| 242 | - <% | |
| 243 | -                my $commit_author_email = $commit->{author_email}; | |
| 244 | -                my $commit_author_id = app->dbi->model('user')->select( | |
| 245 | - 'id', | |
| 246 | -                  where => {email => $commit_author_email} | |
| 247 | - )->value; | |
| 248 | - %> | |
| 249 | - <li> | |
| 250 | - <div class="compare-commits-author"> | |
| 251 | -                  <span title="<%= $commit->{author_email} %>"> | |
| 252 | -                    % if (defined $commit_author_id) { | |
| 253 | -                      <a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> | |
| 254 | -                    % } else { | |
| 255 | -                      <%= $commit->{author_name} %> | |
| 256 | - % } | |
| 257 | - </span> | |
| 258 | - </div> | |
| 259 | - <div class="compare-commits-commit-title"> | |
| 260 | -                  <a style="color:#333" href="<%= url_for("/$user_id/$project_id/commit/$commit->{id}") %>"> | |
| 261 | -                    <%= $commit->{title_short} %> | |
| 262 | - </a> | |
| 263 | - </div> | |
| 264 | - <div class="compare-commits-commit-id"> | |
| 265 | -                  <a href="<%= url_for("/$user_id/$project_id/commit/$commit->{id}") %>"> | |
| 266 | -                    <%= substr($commit->{id}, 0, 7) %> | |
| 267 | - </a> | |
| 268 | - </div> | |
| 269 | - </li> | |
| 270 | - % } | |
| 271 | - </ul> | |
| 272 | - % } | |
| 273 | - </div> | |
| 234 | + <div class="pull-comment-body"> | |
| 235 | +            <%= $pull_request_message_first->{message} %> | |
| 236 | + </div> | |
| 237 | + </div> | |
| 238 | + | |
| 239 | + <div class="commits"> | |
| 240 | +          % for my $date (reverse sort keys %$commits_date) { | |
| 241 | +            % my $commits = $commits_date->{$date}; | |
| 242 | + | |
| 243 | + <div class="commit-date"> | |
| 244 | + <i class="icon-off"></i><span>Commits on <%= $date %></span> | |
| 245 | + </div> | |
| 246 | + | |
| 247 | + <ul class="compare-commits-date-container"> | |
| 248 | +              % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) { | |
| 249 | + <% | |
| 250 | +                  my $commit_author_email = $commit->{author_email}; | |
| 251 | +                  my $commit_author_id = app->dbi->model('user')->select( | |
| 252 | + 'id', | |
| 253 | +                    where => {email => $commit_author_email} | |
| 254 | + )->value; | |
| 255 | + %> | |
| 256 | + <li> | |
| 257 | + <div class="compare-commits-author"> | |
| 258 | +                    <span title="<%= $commit->{author_email} %>"> | |
| 259 | +                      % if (defined $commit_author_id) { | |
| 260 | +                        <a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a> | |
| 261 | +                      % } else { | |
| 262 | +                        <%= $commit->{author_name} %> | |
| 263 | + % } | |
| 264 | + </span> | |
| 265 | + </div> | |
| 266 | + <div class="compare-commits-commit-title"> | |
| 267 | +                    <a style="color:#333" href="<%= url_for("/$user_id/$project_id/commit/$commit->{id}") %>"> | |
| 268 | +                      <%= $commit->{title_short} %> | |
| 269 | + </a> | |
| 270 | + </div> | |
| 271 | + <div class="compare-commits-commit-id"> | |
| 272 | +                    <a href="<%= url_for("/$user_id/$project_id/commit/$commit->{id}") %>"> | |
| 273 | +                      <%= substr($commit->{id}, 0, 7) %> | |
| 274 | + </a> | |
| 275 | + </div> | |
| 276 | + </li> | |
| 277 | + % } | |
| 278 | + </ul> | |
| 279 | + % } | |
| 280 | + </div> | |
| 274 | 281 |  | 
| 275 | 282 |  | 
| 276 | - %= include '/include/commit_body', %commit_body_args; | |
| 283 | + %= include '/include/commit_body', %commit_body_args; | |
| 284 | + % } | |
| 277 | 285 |  | 
| 278 | 286 |        % if ($api->can_write_access($session_user_id, $user_id, $project_id)) { | 
| 279 | -        % if ($merge_success && $pull_request->{open}) { | |
| 287 | +        % if ($commits_count && $merge_success && $pull_request->{open}) { | |
| 280 | 288 | <form action="<%= url_for %>" method="post"> | 
| 281 | 289 | <%= hidden_field op => 'merge' %> | 
| 282 | 290 | <div class="pull-request-form"> | 
| ... | ... | @@ -3,8 +3,12 @@ | 
| 3 | 3 | my $api = gitprep_api; | 
| 4 | 4 |  | 
| 5 | 5 | # Parameters | 
| 6 | -  my $user = param('user'); | |
| 7 | -  my $project = param('project'); | |
| 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; | |
| 8 | 12 |  | 
| 9 | 13 | # Git | 
| 10 | 14 | my $git = $self->app->git; | 
| ... | ... | @@ -15,7 +19,7 @@ | 
| 15 | 19 |        {__MY__ => '*'}, | 
| 16 | 20 |        {user => ['id']} | 
| 17 | 21 | ], | 
| 18 | -    where => {open => 1} | |
| 22 | +    where => {open => $open} | |
| 19 | 23 | )->all; | 
| 20 | 24 |  | 
| 21 | 25 | # Open count | 
| ... | ... | @@ -25,17 +29,25 @@ | 
| 25 | 29 |    my $close_count = app->dbi->model('pull_request')->select('count(*)', where => {open => 0})->value; | 
| 26 | 30 | %> | 
| 27 | 31 |  | 
| 28 | -% layout 'common', title => "Pull Requests Tags \x{30fb} $user/$project"; | |
| 32 | +% layout 'common', title => "Pull Requests Tags \x{30fb} $user_id/$project_id"; | |
| 29 | 33 |  | 
| 30 | 34 | %= include '/include/header'; | 
| 31 | 35 |  | 
| 32 | 36 | <div class="container"> | 
| 33 | 37 | <div class="pulls-button-container"> | 
| 34 | -      <a href="<%= url_for("/$user/$project/compare") %>" class="btn btn-success">New pull request</a> | |
| 38 | +      <a href="<%= url_for("/$user_id/$project_id/compare") %>" class="btn btn-success">New pull request</a> | |
| 35 | 39 | </div> | 
| 36 | 40 | <div class="pulls"> | 
| 37 | 41 | <div class="pulls-header"> | 
| 38 | -        <b><%= $open_count %> Open</b> <span style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</span> | |
| 42 | +        % if ($open) { | |
| 43 | + <b><%= $open_count %> Open</b> | |
| 44 | +          <a href="<%= url_with->query([is => 'closed']) %>" style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</a> | |
| 45 | +        % } else { | |
| 46 | + <a style="margin-left:5px;color:#767676" href="<%= url_with->query([is => undef]) %>"><%= $open_count %> Open</a> | |
| 47 | + <b> | |
| 48 | +            <span style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</span> | |
| 49 | + </b> | |
| 50 | + % } | |
| 39 | 51 | </div> | 
| 40 | 52 | <div class="pulls-body"> | 
| 41 | 53 |          % if (@$pull_requests) { | 
| ... | ... | @@ -43,14 +55,14 @@ | 
| 43 | 55 |              % for my $pull_request (@$pull_requests) { | 
| 44 | 56 | <% | 
| 45 | 57 |                  my $branch2 = $pull_request->{branch2}; | 
| 46 | - my $commit = app->git->get_commit(app->rep_info($user, $project), $branch2); | |
| 58 | + my $commit = app->git->get_commit(app->rep_info($user_id, $project_id), $branch2); | |
| 47 | 59 |                  my $open_time = $pull_request->{open_time}; | 
| 48 | 60 | my $open_time_age = Time::Moment->now->epoch - $open_time; | 
| 49 | 61 | my $open_time_age_string = $self->app->git->_age_string($open_time_age); | 
| 50 | 62 | %> | 
| 51 | 63 | <li> | 
| 52 | 64 | <div class="pulls-title"> | 
| 53 | -                  <a href="<%= "/$user/$project/pull/$pull_request->{row_id}" %>"> | |
| 65 | +                  <a href="<%= "/$user_id/$project_id/pull/$pull_request->{row_id}" %>"> | |
| 54 | 66 |                      <b><%= $pull_request->{title} %></b> | 
| 55 | 67 | </a> | 
| 56 | 68 | </div> |