# HG changeset patch # User Marcin Kuzminski # Date 1365107621 -7200 # Node ID 9d2db665ef318f81406ddaf85fd25a35461a2b63 # Parent 7a5b11c2328835480914f06a1cc0bc8b2fe80c10 pagination in pull-requests page + UI diff -r 7a5b11c23288 -r 9d2db665ef31 rhodecode/controllers/pullrequests.py --- a/rhodecode/controllers/pullrequests.py Thu Apr 04 20:39:26 2013 +0200 +++ b/rhodecode/controllers/pullrequests.py Thu Apr 04 22:33:41 2013 +0200 @@ -38,6 +38,7 @@ from rhodecode.lib.base import BaseRepoController, render from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\ NotAnonymous +from rhodecode.lib.helpers import Page from rhodecode.lib import helpers as h from rhodecode.lib import diffs from rhodecode.lib.utils import action_logger, jsonify @@ -53,6 +54,7 @@ from rhodecode.model.changeset_status import ChangesetStatusModel from rhodecode.model.forms import PullRequestForm from mercurial import scmutil +from rhodecode.lib.utils2 import safe_int log = logging.getLogger(__name__) @@ -140,6 +142,15 @@ def show_all(self, repo_name): c.pull_requests = PullRequestModel().get_all(repo_name) c.repo_name = repo_name + p = safe_int(request.params.get('page', 1), 1) + + c.pullrequests_pager = Page(c.pull_requests, page=p, items_per_page=10) + + c.pullrequest_data = render('/pullrequests/pullrequest_data.html') + + if request.environ.get('HTTP_X_PARTIAL_XHR'): + return c.pullrequest_data + return render('/pullrequests/pullrequest_show_all.html') @NotAnonymous() @@ -201,6 +212,7 @@ c.default_other_repo_info = other_repos_info[c.default_other_repo] c.other_repos_info = json.dumps(other_repos_info) + return render('/pullrequests/pullrequest.html') @NotAnonymous() diff -r 7a5b11c23288 -r 9d2db665ef31 rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css Thu Apr 04 20:39:26 2013 +0200 +++ b/rhodecode/public/css/style.css Thu Apr 04 22:33:41 2013 +0200 @@ -4568,7 +4568,6 @@ font-weight: bold; } -div.closed h4 a, h3.closed, #pullrequests_container li.closed a { @@ -4576,6 +4575,34 @@ background: #eee; } +div.pr-title { + font-size: 1.6em; +} + +div.pr { + border-bottom: 1px solid #DDD; + margin: 0px 20px; + padding: 10px 0px; +} +div.pr-closed { + background-color: rgba(245,245,245,0.5); +} + +span.pr-closed-tag { + margin-bottom: 1px; + margin-right: 1px; + padding: 1px 3px; + font-size: 10px; + padding: 1px 3px 1px 3px; + font-size: 10px; + color: #336699; + white-space: nowrap; + -webkit-border-radius: 4px; + border-radius: 4px; + border: 1px solid #d9e8f8; + line-height: 1.5em; +} + /**** PERMS *****/ diff -r 7a5b11c23288 -r 9d2db665ef31 rhodecode/templates/pullrequests/pullrequest_data.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/templates/pullrequests/pullrequest_data.html Thu Apr 04 22:33:41 2013 +0200 @@ -0,0 +1,33 @@ +## -*- coding: utf-8 -*- + +% for pr in c.pullrequests_pager: +
+ +
${_('Title')}: ${pr.title}
+
${pr.description}
+
+% endfor + +
+ +${c.pullrequests_pager.pager('$link_previous ~2~ $link_next')} +
diff -r 7a5b11c23288 -r 9d2db665ef31 rhodecode/templates/pullrequests/pullrequest_show_all.html --- a/rhodecode/templates/pullrequests/pullrequest_show_all.html Thu Apr 04 20:39:26 2013 +0200 +++ b/rhodecode/templates/pullrequests/pullrequest_show_all.html Thu Apr 04 22:33:41 2013 +0200 @@ -14,29 +14,13 @@ <%def name="main()"> ${self.context_bar('showpullrequest')} +
${self.breadcrumbs()}
- - %for pr in c.pull_requests: -
-

- - - ${_('Pull request #%s opened by %s on %s') % (pr.pull_request_id, pr.author.full_name, h.fmt_date(pr.created_on))} - - %if pr.is_closed(): - (${_('Closed')}) - %endif -

-
${_('Title')}: ${pr.title}
-
${pr.description}
-
-
- %endfor - + ${c.pullrequest_data}