You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/02/18 23:38:20 UTC

git commit: [#7128] Fixed test and paging

Repository: incubator-allura
Updated Branches:
  refs/heads/cj/7128 33fa75608 -> bc3e86e4a


[#7128] Fixed test and paging

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bc3e86e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bc3e86e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bc3e86e4

Branch: refs/heads/cj/7128
Commit: bc3e86e4a5d9d498dc0ff19fe0beaf521bc69ce0
Parents: 33fa756
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue Feb 18 22:38:04 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue Feb 18 22:38:04 2014 +0000

----------------------------------------------------------------------
 .../lib/widgets/resources/js/commit_browser.js       | 15 ++++++++-------
 ForgeSVN/forgesvn/svn_main.py                        |  4 ++--
 .../forgesvn/tests/functional/test_controllers.py    | 12 ++++++------
 3 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc3e86e4/Allura/allura/lib/widgets/resources/js/commit_browser.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js
index e288800..f09d656 100644
--- a/Allura/allura/lib/widgets/resources/js/commit_browser.js
+++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js
@@ -69,7 +69,7 @@ if($('#commit_graph')){
     var offset = 1;
     var selected_commit = -1;
     var y_offset = offset * y_space;
-    var tree, next_column, max_x_pos, max_row = 0, last_row = 0;
+    var tree, next_column, max_x_pos, max_row = 0, last_row = 0, max_visible_row;
 
     var $graph_holder = $('#graph_holder');
     var $scroll_placeholder = $('#graph_scroll_placeholder');
@@ -111,11 +111,12 @@ if($('#commit_graph')){
             next_column = data['next_column'];
             max_x_pos = x_space*next_column;
             max_row += data['max_row']
+            max_visible_row = max_row + (data['next_commit'] ? 1 : 0);
             for (var c in new_data['built_tree']) {
                 tree[c].row += last_row;
             }
             last_row = max_row;
-            setHeight(max_row);
+            setHeight(max_visible_row);
 
             // Calculate the (x,y) positions of all the commits
             for(var c in tree){
@@ -142,8 +143,8 @@ if($('#commit_graph')){
     get_data(true);
 
     function selectCommit(index) {
-      if (index < 0 || index > max_row) return;
-      if (index == max_row) {
+      if (index < 0 || index > max_visible_row) return;
+      if (index == max_visible_row) {
           if (data['next_commit']) {
               get_data();
           }
@@ -235,7 +236,7 @@ if($('#commit_graph')){
             canvas_ctx.fillText(commit.short_id + " " + commit.message, (1+next_column) * x_space, y_pos);
         }
         if (data['next_commit']) {
-            var y_pos = y_space+((max_row-offset)*y_space);
+            var y_pos = y_space+((max_visible_row-offset)*y_space);
             canvas_ctx.fillStyle = 'rgb(0,0,256)';
             canvas_ctx.fillText('Show more', (1+next_column) * x_space, y_pos);
         }
@@ -245,8 +246,8 @@ if($('#commit_graph')){
       offset = Math.round(x);
       if (offset < 1)
         offset = 1;
-      else if (offset > (max_row - page_size))
-        offset = max_row - page_size + 2;
+      else if (offset > (max_visible_row - page_size))
+        offset = max_visible_row - page_size + 2;
       y_offset = offset * y_space;
       drawGraph(offset);
       if (selected_commit >= offset - 1 && selected_commit <= offset + page_size)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc3e86e4/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index 6e2ae00..4f848f0 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -199,13 +199,13 @@ class SVNCommitBrowserController(BaseController):
             data['built_tree'][commit['id']] = {
                 'column': 0,
                 'parents': map(str, commit['parents']),
-                'short_id': '[%s]' % commit['id'],
+                'short_id': '[r%s]' % commit['id'],
                 'message': commit['message'],
                 'oid': str(commit['id']),
                 'row': i,
                 'url': c.app.repo.url_for_commit(commit['id']),
             }
-        data['max_row'] = len(data['commits'])
+        data['max_row'] = len(data['commits']) - 1
         return data
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bc3e86e4/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index ddb4c89..c5bb2ee 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -98,14 +98,14 @@ class TestRootController(SVNTestController):
     def test_commit_browser_data(self):
         resp = self.app.get('/src/commit_browser_data')
         data = json.loads(resp.body)
-        assert data['max_row'] == 5
-        assert data['next_column'] == 1
+        assert_equal(data['max_row'], 5)
+        assert_equal(data['next_column'], 1)
         for val in data['built_tree'].values():
             if val['url'] == '/p/test/src/1/':
-                assert val['short_id'] == '[r1]'
-                assert val['column'] == 0
-                assert val['row'] == 5
-                assert val['message'] == 'Create readme'
+                assert_equal(val['short_id'], '[r1]')
+                assert_equal(val['column'], 0)
+                assert_equal(val['row'], 5)
+                assert_equal(val['message'], 'Create readme')
 
     def test_feed(self):
         for ext in ['', '.rss']: