com web/qa: Fixed bug that pull request page doesn't show all PRs: pulls/index.php pulls/pullrequests.js

From: Date: Tue, 17 Jul 2012 09:43:39 +0000
Subject: com web/qa: Fixed bug that pull request page doesn't show all PRs: pulls/index.php pulls/pullrequests.js
Groups: php.qa 
Request: Send a blank email to php-qa+get-66661@lists.php.net to get a copy of this message
Commit: 557062013e3839fd56c55e85c44e820e69c0cb3c Author: Xinchen Hui <laruence@gmail.com> Tue, 17 Jul 2012 17:43:39 +0800 Parents: 4d464357b9b825e6e086de5be4a4de7727e21698 Branches: master Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=557062013e3839fd56c55e85c44e820e69c0cb3c Log: Fixed bug that pull request page doesn't show all PRs Also fixed the bug that double refresh due to hashchange event handler Changed paths: M pulls/index.php M pulls/pullrequests.js Diff: diff --git a/pulls/index.php b/pulls/index.php index 314c936..c501511 100644 --- a/pulls/index.php +++ b/pulls/index.php @@ -57,8 +57,18 @@ common_header(); white-space: pre; } + #backToRepolist { + float: left; + } + #repoContent { width: 920px; + clear: both; + } + + #nextRepoPage { + float: right; + display: none; } </style> <link href="http://code.jquery.com/ui/1.8.18/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/> @@ -133,6 +143,7 @@ if (!constant('GITHUB_PASS')) { ?> <div id="backToRepolist"><a href="#">&lt;&lt;&lt-- Repos</a></div> + <div id="nextRepoPage"><a href="javascript:void(0);">Next--&gt;&gt;&gt;</a></div> <div id="mainContent"> <ul id="repolist"></ul> <p>Even though the PHP project is using <a href="http://git.php.net">git.php.net</a> diff --git a/pulls/pullrequests.js b/pulls/pullrequests.js index 9a88b4c..b2eaba8 100644 --- a/pulls/pullrequests.js +++ b/pulls/pullrequests.js @@ -99,24 +99,43 @@ $(document).ready(function() { repos.update(); $(window).bind( "hashchange", function(e) { - if ($.bbq.getState( "repo" )) { - loadRepo($.bbq.getState("repo")); + if ($.bbq.getState("repo")) { repos.hideList(); } else { + $("#nextRepoPage").hide(); repos.showList(); } }); $(window).trigger( "hashchange" ); + + if ($.bbq..getState("repo")) { + loadRepo($.bbq.getState("repo")); + } }); -function loadRepo(repo) { +function loadRepo(repo, url) { $("#loading").show(); + url = url || GITHUB_BASEURL+'repos/'+GITHUB_ORG+"/"+repo+"/pulls"; $.ajax({ dataType: 'jsonp', - url: GITHUB_BASEURL+'repos/'+GITHUB_ORG+"/"+repo+"/pulls", + url: url, success: function (data) { $("#loading").hide(); + if (data.meta && data.meta.Link) { + for (i=0; i<data.meta.Link.length; i++) { + var link = data.meta.Link[i]; + if (link[1].rel == "next") { + $("#nextRepoPage").show().click(function() { + $(this).hide(); + loadRepo(repo, data.meta.Link[0][0]); + }); + break; + } + } + } else { + $("#nextRepoPage").hide(); + } for (var key in data.data) { data.data[key].body = converter.makeHtml(data.data[key].body); }

« previous php.qa (#66661) next »