Showing 2 changed files with 37 additions and 43 deletions
+2 -2
lib/Gitprep.pm
... ...
@@ -91,8 +91,8 @@ sub startup {
91 91
   $r->get('/:user/:project/commit/:id')->to('#commit');
92 92
   
93 93
   # Commits
94
-  $r->get('/:user/:project/commits/:id', {id => 'HEAD'})->to('#commits');
95
-  $r->get('/:user/:project/commits/:id/(*file)')->to('#commits');
94
+  $r->get('/:user/:project/commits/:rev', {id => 'HEAD'})->to('#commits');
95
+  $r->get('/:user/:project/commits/:rev/(*blob)')->to('#commits');
96 96
   
97 97
   # Branches
98 98
   $r->get('/:user/:project/branches')->to('#branches');
+35 -41
templates/main/commits.html.ep
... ...
@@ -1,31 +1,27 @@
1 1
 <%
2 2
   # API
3 3
   my $api = Gitprep::API->new($self);
4
-  
4
+
5
+  # Parameters
5 6
   my $user = param('user');
6 7
   my $project = param('project');
7
-  my $id = param('id');
8
-  my $file = param('file');
8
+  my $rev = param('rev');
9
+  my $blob = param('blob');
9 10
   my $page = param('page') || 0;
10
-
11 11
   my $root_ns = $api->root_ns(config->{root});
12
-  
13
-  # Parameters
14
-  my $project_ns = "$root_ns/$user/$project.git";
15
-  my $project = "/$project_ns";
16
-  my $home_ns = $api->dirname($project_ns);
17
-  my $home = "/$home_ns";
12
+  my $rep_ns = "$root_ns/$user/$project.git";
13
+  my $rep = "/$rep_ns";
18 14
   
19 15
   # Git
20 16
   my $git = $self->app->git;
21 17
   
22 18
   # Commit
23
-  my $commit = $git->parse_commit($project, $id);
19
+  my $commit = $git->parse_commit($rep, $rev);
24 20
   
25 21
   # Commits
26 22
   my $page_count = 30;
27 23
   my $commits = $git->parse_commits(
28
-    $project, $commit->{id}, $page_count, $page_count * $page, $file);
24
+    $rep, $commit->{id}, $page_count, $page_count * $page, $blob);
29 25
   my $commits_count = @$commits;
30 26
   my $commits_date = {};
31 27
   for my $commit (@$commits) {
... ...
@@ -58,47 +54,45 @@
58 54
       border-bottom:none;
59 55
       margin-bottom:15px;
60 56
     }
61
-    .commit_date {
57
+    .commit .cdate {
62 58
       border-bottom:1px solid gray;
63 59
       padding:5px;
64 60
       background-color:#E6F1F6;
65 61
       color:#3A505B;
66 62
       font-weight:bold;
67 63
     }
68
-    .commit_content {
69
-    }
70
-    .commit_first {
64
+    .commit .cfirst {
71 65
       overflow:hidden;
72 66
       padding:8px;
73 67
       padding-bottom:1px;
74 68
     }
75
-    .commit_first_left {
69
+    .commit .cfirst_left {
76 70
       float:left;
77 71
       color:black;
78 72
     }
79
-    .commit_first_left a {
73
+    .commit .cfirst_left a {
80 74
       color:black;
81 75
       font-weight:bold;
82 76
     }
83
-    .commit_first_right {
77
+    .commit .cfirst_right {
84 78
       float:right;
85 79
     }
86
-    .commit_first_right a {
80
+    .commit .cfirst_right a {
87 81
       color:#4183C4;
88 82
     }
89
-    .commit_second {
83
+    .commit .csecond {
90 84
       overflow:hidden;
91 85
       border-bottom:1px solid gray;
92 86
       padding:8px;
93 87
       padding-top:1px;
94 88
     }
95
-    .commit_second_left {
89
+    .commit .csecond_left {
96 90
       float:left;
97 91
     }
98
-    .commit_second_right {
92
+    .commit .csecond_right {
99 93
       float:right;
100 94
     }
101
-    .commit_second_right a {
95
+    .commit .csecond_right a {
102 96
       color:#4183C4;
103 97
     }
104 98
     
... ...
@@ -110,13 +104,13 @@
110 104
       display:inline-block;
111 105
       color:black
112 106
     }
113
-    .pagination .left {
107
+    .pagination .pleft {
114 108
       border-right:1px solid gray;
115 109
       padding:5px;
116 110
       display:block;
117 111
       float:left
118 112
     }
119
-    .pagination .right {
113
+    .pagination .pright {
120 114
       padding:5px;
121 115
       display:block;
122 116
       float:left;
... ...
@@ -128,7 +122,7 @@
128 122
     .pagination a:hover {
129 123
       background-color:#4183C4;
130 124
     }
131
-    .pagination .disable {
125
+    .pagination .pdisable {
132 126
       color:gray;
133 127
       cursor:default;
134 128
     }    
... ...
@@ -154,9 +148,9 @@
154 148
     % end
155 149
         
156 150
     <div class="commit_history">
157
-      % if (defined $file) {
151
+      % if (defined $blob) {
158 152
         History for
159
-        %= include '/include/page_path', type => 'blob', Path => $file, operation => 'commits';
153
+        %= include '/include/page_path', type => 'blob', Path => $blob, operation => 'commits';
160 154
       % } else {
161 155
         <a class="ubar" href="<%= url_for("/$user/$project") %>">
162 156
           <%= $project %>
... ...
@@ -170,24 +164,24 @@
170 164
       <div class="commit">
171 165
         % my $commits = $commits_date->{$date};
172 166
         
173
-        <div class="commit_date"><%= $date %></div>
167
+        <div class="cdate"><%= $date %></div>
174 168
         % for my $commit (sort {$a->{author_epoch} <=> $b->{author_epoch}} @$commits) {
175
-          <div class="commit_content">
176
-            <div class="commit_first">
177
-              <div class="commit_first_left">
169
+          <div class="ccontent">
170
+            <div class="cfirst">
171
+              <div class="cfirst_left">
178 172
                 <a class="ubar" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
179 173
                   <%= $commit->{title_short} %>
180 174
                 </a>
181 175
               </div>
182
-              <div class="commit_first_right a_dec_on a_blue">
176
+              <div class="cfirst_right a_dec_on a_blue">
183 177
                 <a class="ubar" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
184 178
                   <%= substr($commit->{id}, 0, 10) %>
185 179
                 </a>
186 180
               </div>
187 181
             </div>
188
-            <div class="commit_second">
189
-              <div class="commit_second_left">yuki-kimoto authored 7 days ago</div>
190
-              <div class="commit_second_right">
182
+            <div class="csecond">
183
+              <div class="csecond_left">yuki-kimoto authored 7 days ago</div>
184
+              <div class="csecond_right">
191 185
                 <a class="ubar" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
192 186
                   Browse code
193 187
                 </a>
... ...
@@ -199,16 +193,16 @@
199 193
     % }
200 194
     <div class="pagination">
201 195
       % if ($page == 0) {
202
-        <span class="left disable">&laquo; Newer</span>
196
+        <span class="pleft pdisable">&laquo; Newer</span>
203 197
       % } else {
204 198
         % my $newer_page = $page - 1;
205
-        <a class="left" href="<%= url_for("/$user/$project/commits/$id?page=$newer_page") %>">&laquo; Newer</a>
199
+        <a class="pleft" href="<%= url_for("/$user/$project/commits/$rev?page=$newer_page") %>">&laquo; Newer</a>
206 200
       % }
207 201
       % if ($commits_count < $page_count) {
208
-        <span class="right disable">Older &raquo;</span>
202
+        <span class="pright pdisable">Older &raquo;</span>
209 203
       % } else {
210 204
         % my $older_page = $page + 1;
211
-        <a class="right" href="<%= url_for("/$user/$project/commits/$id?page=$older_page") %>">Older &raquo;</a>
205
+        <a class="pright" href="<%= url_for("/$user/$project/commits/$rev?page=$older_page") %>">Older &raquo;</a>
212 206
       % }
213 207
     </div>
214 208
   </div>