##// END OF EJS Templates
controllers: consistently use c.cs_comments and cs_statuses...
Mads Kiilerich -
r6766:f0ec7be7 default
parent child Browse files
Show More
@@ -61,8 +61,8 b' def _load_changelog_summary():'
61 items_per_page=size,
61 items_per_page=size,
62 url=url_generator)
62 url=url_generator)
63 page_revisions = [x.raw_id for x in list(c.repo_changesets)]
63 page_revisions = [x.raw_id for x in list(c.repo_changesets)]
64 c.comments = c.db_repo.get_comments(page_revisions)
64 c.cs_comments = c.db_repo.get_comments(page_revisions)
65 c.statuses = c.db_repo.statuses(page_revisions)
65 c.cs_statuses = c.db_repo.statuses(page_revisions)
66
66
67
67
68 class ChangelogController(BaseRepoController):
68 class ChangelogController(BaseRepoController):
@@ -150,8 +150,8 b' class ChangelogController(BaseRepoContro'
150 items_per_page=c.size, branch=branch_name,)
150 items_per_page=c.size, branch=branch_name,)
151
151
152 page_revisions = [x.raw_id for x in c.pagination]
152 page_revisions = [x.raw_id for x in c.pagination]
153 c.comments = c.db_repo.get_comments(page_revisions)
153 c.cs_comments = c.db_repo.get_comments(page_revisions)
154 c.statuses = c.db_repo.statuses(page_revisions)
154 c.cs_statuses = c.db_repo.statuses(page_revisions)
155 except EmptyRepositoryError as e:
155 except EmptyRepositoryError as e:
156 h.flash(safe_str(e), category='warning')
156 h.flash(safe_str(e), category='warning')
157 raise HTTPFound(location=url('summary_home', repo_name=c.repo_name))
157 raise HTTPFound(location=url('summary_home', repo_name=c.repo_name))
@@ -223,7 +223,7 b' class CompareController(BaseRepoControll'
223 c.cs_repo.scm_instance, c.cs_rev)
223 c.cs_repo.scm_instance, c.cs_rev)
224 raw_ids = [x.raw_id for x in c.cs_ranges]
224 raw_ids = [x.raw_id for x in c.cs_ranges]
225 c.cs_comments = c.cs_repo.get_comments(raw_ids)
225 c.cs_comments = c.cs_repo.get_comments(raw_ids)
226 c.statuses = c.cs_repo.statuses(raw_ids)
226 c.cs_statuses = c.cs_repo.statuses(raw_ids)
227
227
228 revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
228 revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
229 c.jsdata = graph_data(c.cs_repo.scm_instance, revs)
229 c.jsdata = graph_data(c.cs_repo.scm_instance, revs)
@@ -578,7 +578,7 b' class PullrequestsController(BaseRepoCon'
578
578
579 raw_ids = [x.raw_id for x in c.cs_ranges]
579 raw_ids = [x.raw_id for x in c.cs_ranges]
580 c.cs_comments = c.cs_repo.get_comments(raw_ids)
580 c.cs_comments = c.cs_repo.get_comments(raw_ids)
581 c.statuses = c.cs_repo.statuses(raw_ids)
581 c.cs_statuses = c.cs_repo.statuses(raw_ids)
582
582
583 ignore_whitespace = request.GET.get('ignorews') == '1'
583 ignore_whitespace = request.GET.get('ignorews') == '1'
584 line_context = safe_int(request.GET.get('context'), 3)
584 line_context = safe_int(request.GET.get('context'), 3)
@@ -628,8 +628,7 b' class PullrequestsController(BaseRepoCon'
628 for comments in lines.values():
628 for comments in lines.values():
629 c.inline_cnt += len(comments)
629 c.inline_cnt += len(comments)
630 # comments
630 # comments
631 c.comments = cc_model.get_comments(c.db_repo.repo_id,
631 c.comments = cc_model.get_comments(c.db_repo.repo_id, pull_request=pull_request_id)
632 pull_request=pull_request_id)
633
632
634 # (badly named) pull-request status calculation based on reviewer votes
633 # (badly named) pull-request status calculation based on reviewer votes
635 (c.pull_request_reviewers,
634 (c.pull_request_reviewers,
@@ -81,15 +81,15 b''
81 %endif
81 %endif
82 </td>
82 </td>
83 <td class="status">
83 <td class="status">
84 %if c.statuses.get(cs.raw_id):
84 %if c.cs_statuses.get(cs.raw_id):
85 %if c.statuses.get(cs.raw_id)[2]:
85 %if c.cs_statuses.get(cs.raw_id)[2]:
86 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username, c.statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
86 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username, c.cs_statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.cs_statuses.get(cs.raw_id)[3],pull_request_id=c.cs_statuses.get(cs.raw_id)[2])}">
87 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
87 <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i>
88 </a>
88 </a>
89 %else:
89 %else:
90 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username)}"
90 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username)}"
91 href="${c.comments[cs.raw_id][0].url()}">
91 href="${c.cs_comments[cs.raw_id][0].url()}">
92 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
92 <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i>
93 </a>
93 </a>
94 %endif
94 %endif
95 %endif
95 %endif
@@ -121,9 +121,9 b''
121 %endif
121 %endif
122 </div>
122 </div>
123 <div class="extra-container">
123 <div class="extra-container">
124 %if c.comments.get(cs.raw_id):
124 %if c.cs_comments.get(cs.raw_id):
125 <a class="comments-container comments-cnt" href="${c.comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(c.comments[cs.raw_id])}">
125 <a class="comments-container comments-cnt" href="${c.cs_comments[cs.raw_id][0].url()}" data-toggle="tooltip" title="${_('%s comments') % len(c.cs_comments[cs.raw_id])}">
126 ${len(c.comments[cs.raw_id])}
126 ${len(c.cs_comments[cs.raw_id])}
127 <i class="icon-comment-discussion"></i>
127 <i class="icon-comment-discussion"></i>
128 </a>
128 </a>
129 %endif
129 %endif
@@ -13,25 +13,25 b''
13 %for cnt,cs in enumerate(c.repo_changesets):
13 %for cnt,cs in enumerate(c.repo_changesets):
14 <tr class="parity${cnt%2} ${'mergerow' if len(cs.parents) > 1 else ''}">
14 <tr class="parity${cnt%2} ${'mergerow' if len(cs.parents) > 1 else ''}">
15 <td class="compact">
15 <td class="compact">
16 %if c.statuses.get(cs.raw_id):
16 %if c.cs_statuses.get(cs.raw_id):
17 %if c.statuses.get(cs.raw_id)[2]:
17 %if c.cs_statuses.get(cs.raw_id)[2]:
18 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username, c.statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
18 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s\nClick to open associated pull request %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username, c.cs_statuses.get(cs.raw_id)[4])}" href="${h.url('pullrequest_show',repo_name=c.cs_statuses.get(cs.raw_id)[3],pull_request_id=c.cs_statuses.get(cs.raw_id)[2])}">
19 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
19 <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i>
20 </a>
20 </a>
21 %else:
21 %else:
22 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.statuses.get(cs.raw_id)[1], c.statuses.get(cs.raw_id)[5].username)}"
22 <a data-toggle="tooltip" title="${_('Changeset status: %s by %s') % (c.cs_statuses.get(cs.raw_id)[1], c.cs_statuses.get(cs.raw_id)[5].username)}"
23 href="${c.comments[cs.raw_id][0].url()}">
23 href="${c.cs_comments[cs.raw_id][0].url()}">
24 <i class="icon-circle changeset-status-${c.statuses.get(cs.raw_id)[0]}"></i>
24 <i class="icon-circle changeset-status-${c.cs_statuses.get(cs.raw_id)[0]}"></i>
25 </a>
25 </a>
26 %endif
26 %endif
27 %endif
27 %endif
28 </td>
28 </td>
29 <td class="compact">
29 <td class="compact">
30 %if c.comments.get(cs.raw_id,[]):
30 %if c.cs_comments.get(cs.raw_id,[]):
31 <div class="comments-container">
31 <div class="comments-container">
32 <div title="${('comments')}">
32 <div title="${('comments')}">
33 <a href="${c.comments[cs.raw_id][0].url()}">
33 <a href="${c.cs_comments[cs.raw_id][0].url()}">
34 <i class="icon-comment"></i>${len(c.comments[cs.raw_id])}
34 <i class="icon-comment"></i>${len(c.cs_comments[cs.raw_id])}
35 </a>
35 </a>
36 </div>
36 </div>
37 </div>
37 </div>
@@ -33,8 +33,8 b''
33 %for cnt, cs in enumerate(reversed(c.cs_ranges)):
33 %for cnt, cs in enumerate(reversed(c.cs_ranges)):
34 <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
34 <tr id="chg_${cnt+1}" class="${'mergerow' if len(cs.parents) > 1 else ''}">
35 <td>
35 <td>
36 %if cs.raw_id in c.statuses:
36 %if cs.raw_id in c.cs_statuses:
37 <i class="icon-circle changeset-status-${c.statuses[cs.raw_id][0]}" title="${_('Changeset status: %s') % c.statuses[cs.raw_id][1]}"></i>
37 <i class="icon-circle changeset-status-${c.cs_statuses[cs.raw_id][0]}" title="${_('Changeset status: %s') % c.cs_statuses[cs.raw_id][1]}"></i>
38 %endif
38 %endif
39 %if c.cs_comments.get(cs.raw_id):
39 %if c.cs_comments.get(cs.raw_id):
40 <div class="comments-container">
40 <div class="comments-container">
General Comments 0
You need to be logged in to leave comments. Login now