##// END OF EJS Templates
pagination in pull-requests page + UI
marcink -
r3676:9d2db665 beta
parent child Browse files
Show More
@@ -0,0 +1,33 b''
1 ## -*- coding: utf-8 -*-
2
3 % for pr in c.pullrequests_pager:
4 <div class="pr ${'pr-closed' if pr.is_closed() else ''}">
5 <div class="pr-title">
6 %if pr.is_closed():
7 <div style="float:left;margin: -4px 0px;"><span class="pr-closed-tag">${_('Closed')}</span></div>
8 %endif
9 <img src="${h.url('/images/icons/flag_status_%s.png' % str(pr.last_review_status))}" />
10 <a href="${h.url('pullrequest_show',repo_name=c.repo_name,pull_request_id=pr.pull_request_id)}">
11 ${_('Pull request #%s opened by %s on %s') % (pr.pull_request_id, pr.author.full_name, h.fmt_date(pr.created_on))}
12 </a>
13 </div>
14 <h5 style="border:0px;padding-bottom:0px">${_('Title')}: ${pr.title}</h5>
15 <div>${pr.description}</div>
16 </div>
17 % endfor
18
19 <div class="pagination-wh pagination-left">
20 <script type="text/javascript">
21 YUE.onDOMReady(function(){
22 YUE.delegate("pullrequests","click",function(e, matchedEl, container){
23 ypjax(e.target.href,"pullrequests",function(){
24 show_more_event();
25 tooltip_activate();
26 show_changeset_tooltip();
27 });
28 YUE.preventDefault(e);
29 },'.pager_link');
30 });
31 </script>
32 ${c.pullrequests_pager.pager('$link_previous ~2~ $link_next')}
33 </div>
@@ -38,6 +38,7 b' from rhodecode.lib.compat import json'
38 from rhodecode.lib.base import BaseRepoController, render
38 from rhodecode.lib.base import BaseRepoController, render
39 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\
39 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\
40 NotAnonymous
40 NotAnonymous
41 from rhodecode.lib.helpers import Page
41 from rhodecode.lib import helpers as h
42 from rhodecode.lib import helpers as h
42 from rhodecode.lib import diffs
43 from rhodecode.lib import diffs
43 from rhodecode.lib.utils import action_logger, jsonify
44 from rhodecode.lib.utils import action_logger, jsonify
@@ -53,6 +54,7 b' from rhodecode.model.comment import Chan'
53 from rhodecode.model.changeset_status import ChangesetStatusModel
54 from rhodecode.model.changeset_status import ChangesetStatusModel
54 from rhodecode.model.forms import PullRequestForm
55 from rhodecode.model.forms import PullRequestForm
55 from mercurial import scmutil
56 from mercurial import scmutil
57 from rhodecode.lib.utils2 import safe_int
56
58
57 log = logging.getLogger(__name__)
59 log = logging.getLogger(__name__)
58
60
@@ -140,6 +142,15 b' class PullrequestsController(BaseRepoCon'
140 def show_all(self, repo_name):
142 def show_all(self, repo_name):
141 c.pull_requests = PullRequestModel().get_all(repo_name)
143 c.pull_requests = PullRequestModel().get_all(repo_name)
142 c.repo_name = repo_name
144 c.repo_name = repo_name
145 p = safe_int(request.params.get('page', 1), 1)
146
147 c.pullrequests_pager = Page(c.pull_requests, page=p, items_per_page=10)
148
149 c.pullrequest_data = render('/pullrequests/pullrequest_data.html')
150
151 if request.environ.get('HTTP_X_PARTIAL_XHR'):
152 return c.pullrequest_data
153
143 return render('/pullrequests/pullrequest_show_all.html')
154 return render('/pullrequests/pullrequest_show_all.html')
144
155
145 @NotAnonymous()
156 @NotAnonymous()
@@ -201,6 +212,7 b' class PullrequestsController(BaseRepoCon'
201
212
202 c.default_other_repo_info = other_repos_info[c.default_other_repo]
213 c.default_other_repo_info = other_repos_info[c.default_other_repo]
203 c.other_repos_info = json.dumps(other_repos_info)
214 c.other_repos_info = json.dumps(other_repos_info)
215
204 return render('/pullrequests/pullrequest.html')
216 return render('/pullrequests/pullrequest.html')
205
217
206 @NotAnonymous()
218 @NotAnonymous()
@@ -4568,7 +4568,6 b' PULL REQUESTS'
4568 font-weight: bold;
4568 font-weight: bold;
4569 }
4569 }
4570
4570
4571 div.closed h4 a,
4572 h3.closed,
4571 h3.closed,
4573 #pullrequests_container li.closed a
4572 #pullrequests_container li.closed a
4574 {
4573 {
@@ -4576,6 +4575,34 b' h3.closed,'
4576 background: #eee;
4575 background: #eee;
4577 }
4576 }
4578
4577
4578 div.pr-title {
4579 font-size: 1.6em;
4580 }
4581
4582 div.pr {
4583 border-bottom: 1px solid #DDD;
4584 margin: 0px 20px;
4585 padding: 10px 0px;
4586 }
4587 div.pr-closed {
4588 background-color: rgba(245,245,245,0.5);
4589 }
4590
4591 span.pr-closed-tag {
4592 margin-bottom: 1px;
4593 margin-right: 1px;
4594 padding: 1px 3px;
4595 font-size: 10px;
4596 padding: 1px 3px 1px 3px;
4597 font-size: 10px;
4598 color: #336699;
4599 white-space: nowrap;
4600 -webkit-border-radius: 4px;
4601 border-radius: 4px;
4602 border: 1px solid #d9e8f8;
4603 line-height: 1.5em;
4604 }
4605
4579 /****
4606 /****
4580 PERMS
4607 PERMS
4581 *****/
4608 *****/
@@ -14,29 +14,13 b''
14
14
15 <%def name="main()">
15 <%def name="main()">
16 ${self.context_bar('showpullrequest')}
16 ${self.context_bar('showpullrequest')}
17
17 <div class="box">
18 <div class="box">
18 <!-- box / title -->
19 <!-- box / title -->
19 <div class="title">
20 <div class="title">
20 ${self.breadcrumbs()}
21 ${self.breadcrumbs()}
21 </div>
22 </div>
22
23 ${c.pullrequest_data}
23 %for pr in c.pull_requests:
24 <div class="${'closed' if pr.is_closed() else ''}">
25 <h4 style="border:0px;padding:0px">
26 <img src="${h.url('/images/icons/flag_status_%s.png' % str(pr.last_review_status))}" />
27 <a href="${h.url('pullrequest_show',repo_name=c.repo_name,pull_request_id=pr.pull_request_id)}">
28 ${_('Pull request #%s opened by %s on %s') % (pr.pull_request_id, pr.author.full_name, h.fmt_date(pr.created_on))}
29 </a>
30 %if pr.is_closed():
31 (${_('Closed')})
32 %endif
33 </h4>
34 <h5 style="border:0px;padding-bottom:0px">${_('Title')}: ${pr.title}</h5>
35 <div style="padding:0px 24px">${pr.description}</div>
36 <div style="border-bottom: 1px solid #DDD;margin:10px 20px;padding-bottom:10px"></div>
37 </div>
38 %endfor
39
40 </div>
24 </div>
41
25
42 </%def>
26 </%def>
General Comments 0
You need to be logged in to leave comments. Login now