Showing 6 changed files with 59 additions and 53 deletions
+8 -8
lib/Gitprep.pm
... ...
@@ -189,7 +189,7 @@ sub startup {
189 189
       $r->any('/branches/*base_branch', {base_branch => undef})->name('branches');
190 190
 
191 191
       # Tags
192
-      $r->get('/tags')->name('tags');
192
+      $r->get('/tags');
193 193
 
194 194
       # Tree
195 195
       $r->get('/tree/*rev_dir', {dir => undef})->name('tree');
... ...
@@ -201,26 +201,26 @@ sub startup {
201 201
       $r->get('/raw/*rev_file', {file => undef})->name('raw');
202 202
       
203 203
       # Archive
204
-      $r->get('/archive/(*rev).tar.gz')->name('archive')->to(archive_type => 'tar');
205
-      $r->get('/archive/(*rev).zip')->name('archive')->to(archive_type => 'zip');
204
+      $r->get('/archive/(*rev).tar.gz')->to(archive_type => 'tar')->name('archive');
205
+      $r->get('/archive/(*rev).zip')->to(archive_type => 'zip')->name('archive');
206 206
       
207 207
       # Compare
208 208
       $r->get('/compare/(*rev1)...(*rev2)')->name('compare');
209 209
       
210 210
       # Settings
211
-      $r->any('/settings')->name('project-settings');
211
+      $r->any('/settings');
212 212
       
213 213
       # Fork
214
-      $r->any('/fork')->name('fork');
214
+      $r->any('/fork');
215 215
 
216 216
       # Network
217
-      $r->get('/network')->name('network');
217
+      $r->get('/network');
218 218
 
219 219
       # Network Graph
220
-      $r->get('/network/graph')->name('network_graph');
220
+      $r->get('/network/graph/(*rev1)...(*rev2_abs)')->name('network/graph');
221 221
       
222 222
       # Get branches and tags
223
-      $r->get('/api/revs')->name('api_revs');
223
+      $r->get('/api/revs')->name('api/revs');
224 224
     }
225 225
   }
226 226
   
templates/api_revs.html.ep → templates/api/revs.html.ep
File renamed without changes.
+32 -35
templates/network.html.ep
... ...
@@ -25,9 +25,15 @@
25 25
   %= javascript begin
26 26
     $(document).ready(function () {
27 27
       // Update user and project hidden field
28
-      $('[type="submit"]').on('click', function () {
29
-        $('input[name="branch"]').val($('select[name="branch"]').val());
30
-        return true;
28
+      $('[name=remote-btn]').on('click', function () {
29
+        var branch = $('[name=branch]').val();
30
+        var remote = $(this).closest('[name=remote]');
31
+        var remote_member = remote.find('[name=remote-member]').text();
32
+        var remote_project = remote.find('[name=remote-project]').text();
33
+        var remote_branch = remote.find('[name=remote-branch]').val();
34
+        
35
+        location.href = '<%= url_for("/$user/$project/network/graph/") %>' + branch + '...'
36
+          + remote_member + '/' + remote_project + '/' + remote_branch;
31 37
       });
32 38
     });
33 39
   % end
... ...
@@ -36,46 +42,37 @@
36 42
   
37 43
   <div class="container" style="min-heigth:500px">
38 44
     <h3>Members of the <%= $project %> Network</h3>
39
-    <div style="padding-left:10px">
45
+    <div class="well" style="padding:5px 10px 0 10px;margin-bottom:20px">
40 46
       <%= "$user / $project" %> /
41 47
       % param('branch', $default_branch);
42 48
       %= select_field 'branch' => $branches, style => 'margin-top:5px;width:150px';
49
+      <span class="label label-info">My branch</span>
43 50
     </div>
44
-    % if (@$members) {
45
-      <table class="table" style="font-size:130%">
51
+    <div style="margin-bottom:30px">
52
+      % if (@$members) {
46 53
         % for my $member (@$members) {
47
-          <form action="<%= url_for("/$user/$project/network/graph") %>" method="get">
54
+          <div class="border-gray" name="remote" class="row" style="font-size:18px;border-top:none;border-left:none;border-right:none;padding-bottom:10px">
48 55
             % my $mid = $member->{id};
49 56
             % my $mproject = $member->{project};
50 57
             % my $mbranches = $member->{branches};
51
-            <tr>
52
-              <td>
53
-                <a href="<%= url_for("/$mid") %>">
54
-                  <%= $mid %>
55
-                </a>
56
-                <span>/</span>
57
-                <a href="<%= url_for("/$mid/$mproject") %>">
58
-                  <%= $mproject %>
59
-                </a>
60
-                <span>/</span>
61
-                %= select_field 'remote_branch' => $mbranches, style => 'margin-top:5px;margin-bottom:7px;width:150px';
62
-              </td>
63
-              <td style="text-align:right">
64
-                <input class="btn" type="submit" value="Graph" style="margin-top:5px">
65
-              </td>
66
-            </tr>
67
-            %= hidden_field user => $user;
68
-            %= hidden_field project => $project;
69
-            %= hidden_field remote_user => $mid;
70
-            %= hidden_field remote_project => $mproject;
71
-            %= hidden_field 'branch' => $default_branch;
72
-          </form>
58
+            <div class="span8">
59
+              <a name="remote-member" href="<%= url_for("/$mid") %>"><%= $mid %></a>
60
+              <span>/</span>
61
+              <a name="remote-project" href="<%= url_for("/$mid/$mproject") %>"><%= $mproject %></a>
62
+              <span>/</span>
63
+              %= select_field 'remote-branch' => $mbranches, style => 'margin-top:5px;margin-bottom:7px;width:150px';
64
+              <span class="label label-success">Member branch</span>
65
+            </div>
66
+            <div style="text-align:right">
67
+              <button name="remote-btn" class="btn" style="margin-top:5px">Compare</button>
68
+            </div>
69
+          </div>
73 70
         % }
74
-      </table>
75
-    % } else {
76
-      <div class="well">
77
-        No Members.
78
-      </div>
79
-    % }
71
+      % } else {
72
+        <div class="well">
73
+          No Members.
74
+        </div>
75
+      % }
76
+    </div>
80 77
   </div>
81 78
   %= include '/include/footer';
+11 -9
templates/network_graph.html.ep → templates/network/graph.html.ep
... ...
@@ -1,10 +1,9 @@
1 1
 <%
2 2
   my $user = param('user');
3 3
   my $project = param('project');
4
-  my $branch = param('branch');
5
-  my $remote_user = param('remote_user');
6
-  my $remote_project = param('remote_project');
7
-  my $remote_branch = param('remote_branch');
4
+  my $branch = param('rev1');
5
+  my $rev2_abs = param('rev2_abs');
6
+  my ($remote_user, $remote_project, $remote_branch) = split /\//, $rev2_abs, 3;
8 7
   
9 8
   my $commits = app->git->get_commits($user, $project, $branch, 100);
10 9
   my $remote_commits = app->git->get_commits(
... ...
@@ -19,6 +18,7 @@
19 18
     my $id = $commit->{id};
20 19
     $merged_commits_h->{$id} ||= {};
21 20
     $merged_commits_h->{$id}{age} = $commit->{age};
21
+    $merged_commits_h->{$id}{age_string_date} = $commit->{age_string_date};
22 22
     $merged_commits_h->{$id}{title} = $commit->{title};
23 23
     $merged_commits_h->{$id}{type} = 'local';
24 24
   }
... ...
@@ -30,6 +30,7 @@
30 30
     else {
31 31
       $merged_commits_h->{$id} ||= {};
32 32
       $merged_commits_h->{$id}{age} = $commit->{age};
33
+      $merged_commits_h->{$id}{age_string_date} = $commit->{age_string_date};
33 34
       $merged_commits_h->{$id}{title} = $commit->{title};
34 35
       $merged_commits_h->{$id}{type} = 'remote';
35 36
     }
... ...
@@ -58,11 +59,9 @@
58 59
   
59 60
   <div class="container">
60 61
     <h3>Graph</h3>
62
+    <div style="margin-bottom:20px">Compare 100 commits.</div>
61 63
     <div style="margin-bottom:10px">
62
-      <span style="color:blue"><b><big><%= "$user/$project/$branch" %></big></b></span>
63
-      <i class="icon-resize-horizontal"></i>
64
-      <span style="color:green"><b><big><%= "$remote_user/$remote_project/$remote_branch" %></big></b></span>
65
-      (Compared 100 commits)
64
+      <span style="color:blue;font-size:22px"><b><%= "$user / $project / $branch" %></big></span>
66 65
     </div>
67 66
     <div id="graph" class="well" style="width:800px;overflow:auto;padding-left:10px;padding-right:10px">
68 67
       <table>
... ...
@@ -77,7 +76,7 @@
77 76
 
78 77
               % if ($commit->{type} eq $type) {
79 78
                 <td>
80
-                  <a style="color:<%= $color %>" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>" title="<%= $commit->{title} %>">●</a>
79
+                  <a style="color:<%= $color %>" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>" title="<%= "$commit->{title}($commit->{age_string_date})" %>">●</a>
81 80
                 </td>
82 81
               % } else {
83 82
                 <td></td>
... ...
@@ -88,6 +87,9 @@
88 87
         % }
89 88
       </table>
90 89
     </div>
90
+    <div style="margin-bottom:30px">
91
+      <span style="color:green;font-size:18px"><b><big><%= "$remote_user / $remote_project / $remote_branch" %></big></b></span>
92
+    </div>
91 93
   </div>
92 94
   
93 95
   %= include '/include/footer';
templates/project-settings.html.ep → templates/settings.html.ep
File renamed without changes.
+8 -1
xt/basic.t
... ...
@@ -310,4 +310,11 @@ note 'API References';
310 310
   my $content = $t->tx->res->body;
311 311
   like($content, qr/branch_names/);
312 312
   like($content, qr/tag_names/);
313
-}
313
+}
314
+
315
+note 'Network page';
316
+{
317
+  # Page access
318
+  $t->get_ok("/$user/$project/network");
319
+  $t->content_like(qr/Network/);
320
+}