Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DAAB910852 for ; Wed, 19 Feb 2014 18:29:37 +0000 (UTC) Received: (qmail 55264 invoked by uid 500); 19 Feb 2014 18:29:36 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 55187 invoked by uid 500); 19 Feb 2014 18:29:35 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 55143 invoked by uid 99); 19 Feb 2014 18:29:34 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Feb 2014 18:29:34 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7B29C8C3EFC; Wed, 19 Feb 2014 18:29:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tvansteenburgh@apache.org To: allura-commits@incubator.apache.org Date: Wed, 19 Feb 2014 18:29:36 -0000 Message-Id: <7ac2ae99b3444c1bb1b0511ca73955ee@git.apache.org> In-Reply-To: <6b79d7a1fc054bb09c4703c1dd0b3f16@git.apache.org> References: <6b79d7a1fc054bb09c4703c1dd0b3f16@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/5] git commit: [#7128] Fixed test and paging [#7128] Fixed test and paging Signed-off-by: Cory Johns 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/master Commit: bc3e86e4a5d9d498dc0ff19fe0beaf521bc69ce0 Parents: 33fa756 Author: Cory Johns Authored: Tue Feb 18 22:38:04 2014 +0000 Committer: Cory Johns 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']: