Showing 1 changed files with 47 additions and 11 deletions
+47 -11
templates/main/commits.html.ep
... ...
@@ -4,6 +4,8 @@
4 4
   
5 5
   my $user = param('user');
6 6
   my $repository = param('repository');
7
+  my $id = param('id');
8
+  my $page = param('page') || 0;
7 9
 
8 10
   my $root_ns = $api->root_ns(config->{root});
9 11
   
... ...
@@ -12,9 +14,6 @@
12 14
   my $project = "/$project_ns";
13 15
   my $home_ns = $api->dirname($project_ns);
14 16
   my $home = "/$home_ns";
15
-  my $id = param('id');
16
-  my $page = $self->param('page');
17
-  $page = 0 if !defined $page;
18 17
   
19 18
   # Git
20 19
   my $git = $self->app->git;
... ...
@@ -26,6 +25,7 @@
26 25
   my $page_count = 30;
27 26
   my $commits = $git->parse_commits(
28 27
     $project, $commit->{id}, $page_count, $page_count * $page);
28
+  my $commits_count = @$commits;
29 29
   my $commits_date = {};
30 30
   for my $commit (@$commits) {
31 31
     my $date = $commit->{age_string_date};
... ...
@@ -33,9 +33,6 @@
33 33
     push @{$commits_date->{$date}}, $commit;
34 34
   }
35 35
   
36
-  # References
37
-  my $refs = $git->references($project);
38
-  
39 36
   # Global variable
40 37
   stash(user => $user, repository => $repository);
41 38
 %>
... ...
@@ -111,6 +108,36 @@
111 108
       color:#4183C4;
112 109
     }
113 110
     
111
+    /* Pagenation */
112
+    .pagination {
113
+      overflow:hidden;
114
+      border-radius:3px;
115
+      border:1px solid gray;
116
+      display:inline-block;
117
+      color:black
118
+    }
119
+    .pagination .left {
120
+      border-right:1px solid gray;
121
+      padding:5px;
122
+      display:block;
123
+      float:left
124
+    }
125
+    .pagination .right {
126
+      padding:5px;
127
+      display:block;
128
+      float:left;
129
+    }
130
+    .pagination a {
131
+      color:black;
132
+      height:100%;
133
+    }
134
+    .pagination a:hover {
135
+      background-color:#4183C4;
136
+    }
137
+    .pagination .disable {
138
+      color:gray;
139
+      cursor:default;
140
+    }    
114 141
   % end
115 142
   
116 143
   %= include '/include/new_header';
... ...
@@ -159,11 +186,20 @@
159 186
         % }
160 187
       </div>
161 188
     % }
162
-
163
-    <%= include '/include/page_navi2', current => 'log', id => $id,
164
-      page => $page, page_count => $page_count, commits => $commits,
165
-      project_ns => $project_ns;
166
-    %>
189
+    <div class="pagination">
190
+      % if ($page == 0) {
191
+        <span class="left disable">&laquo; Newer</span>
192
+      % } else {
193
+        % my $newer_page = $page - 1;
194
+        <a class="left" href="<%= url_for("/$user/$repository/commits/$id?page=$newer_page") %>">&laquo; Newer</a>
195
+      % }
196
+      % if ($commits_count < $page_count) {
197
+        <span class="right disable">Older &raquo;</span>
198
+      % } else {
199
+        % my $older_page = $page + 1;
200
+        <a class="right" href="<%= url_for("/$user/$repository/commits/$id?page=$older_page") %>">Older &raquo;</a>
201
+      % }
202
+    </div>
167 203
   </div>
168 204
   
169 205
   %= include '/include/footer';