Showing 1 changed files with 23 additions and 21 deletions
+23 -21
templates/pull.html.ep
... ...
@@ -3,12 +3,10 @@
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 8
   my $row_id = param('row_id');
9 9
   
10
-  my $user_row_id = app->dbi->model('user')->select('row_id', where => {id => $user})->value;
11
-  
12 10
   # Git
13 11
   my $git = $self->app->git;
14 12
   
... ...
@@ -21,11 +19,11 @@
21 19
     where => {'pull_request.row_id' => $row_id}
22 20
   )->one;
23 21
   
24
-  my $from_rev = $pull_request->{branch1};
25
-  my $rev = $pull_request->{branch2};
22
+  my $branch1 = $pull_request->{branch1};
23
+  my $branch2 = $pull_request->{branch2};
26 24
   
27 25
   # Commits
28
-  my $commits = $git->forward_commits(app->rep_info($user, $project), $from_rev, $rev);
26
+  my $commits = $git->forward_commits(app->rep_info($user_id, $project_id), $branch1, $branch2);
29 27
   my $commits_count = @$commits;
30 28
   my $commits_date = {};
31 29
   my $authors = {};
... ...
@@ -38,17 +36,12 @@
38 36
   my $authors_count = keys %$authors;
39 37
 
40 38
   # Start commit
41
-  my $start_commit = $git->separated_commit(app->rep_info($user, $project), $from_rev, $rev);
39
+  my $start_commit = $git->separated_commit(app->rep_info($user_id, $project_id), $branch1, $branch2);
42 40
 
43 41
   # 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};
42
+  my $end_commit = $git->get_commit(app->rep_info($user_id, $project_id), $branch2);
51 43
   
44
+  # Pull request first message 
52 45
   my $pull_request_message_first = app->dbi->model('pull_request_message')->select(
53 46
     [
54 47
       {__MY__ => '*'},
... ...
@@ -56,9 +49,17 @@
56 49
     ],
57 50
     where => {pull_request => $row_id, number => 1}
58 51
   )->one;
52
+  
53
+  # Commit body arguments
54
+  my %commit_body_args = (
55
+    id => $end_commit->{id},
56
+    from_id => $start_commit->{id},
57
+    rev => $end_commit->{id},
58
+    from_rev => $start_commit->{id}
59
+  );
59 60
 %>
60 61
 
61
-% layout 'common', title => "Pull Requests Tags \x{30fb} $user/$project";
62
+% layout 'common', title => "Pull Requests Tags \x{30fb} $user_id/$project_id";
62 63
   
63 64
   %= include '/include/header';
64 65
   
... ...
@@ -154,12 +155,12 @@
154 155
                   </span>
155 156
                 </div>
156 157
                 <div class="compare-commits-commit-title">
157
-                  <a style="color:#333" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
158
+                  <a style="color:#333" href="<%= url_for("/$user_id/$project_id/commit/$commit->{id}") %>">
158 159
                     <%= $commit->{title_short} %>
159 160
                   </a>
160 161
                 </div>
161 162
                 <div class="compare-commits-commit-id">
162
-                  <a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
163
+                  <a href="<%= url_for("/$user_id/$project_id/commit/$commit->{id}") %>">
163 164
                     <%= substr($commit->{id}, 0, 7) %>
164 165
                   </a>
165 166
                 </div>
... ...
@@ -168,10 +169,11 @@
168 169
           </ul>
169 170
         % }
170 171
       </div>
172
+
173
+  
174
+      %= include '/include/commit_body', %commit_body_args;
171 175
       
172
-      %= include '/include/commit_body';
173
-      
174
-      % if (session('user_row_id') eq $user_row_id) {
176
+      % if ($api->logined($user_id)) {
175 177
         <form action="<%= url_for %>" method="post">
176 178
           <div class="pull-request-form">
177 179
             <div style="overflow:hidden">