##// END OF EJS Templates
pull requests: add show/hide comment functionality #4106
lisaq -
r517:bf98000c default
parent child Browse files
Show More
@@ -1,568 +1,589 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
4 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="breadcrumbs_links()">
10 <%def name="breadcrumbs_links()">
11 <span id="pr-title">
11 <span id="pr-title">
12 ${c.pull_request.title}
12 ${c.pull_request.title}
13 %if c.pull_request.is_closed():
13 %if c.pull_request.is_closed():
14 (${_('Closed')})
14 (${_('Closed')})
15 %endif
15 %endif
16 </span>
16 </span>
17 <div id="pr-title-edit" class="input" style="display: none;">
17 <div id="pr-title-edit" class="input" style="display: none;">
18 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
18 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
19 </div>
19 </div>
20 </%def>
20 </%def>
21
21
22 <%def name="menu_bar_nav()">
22 <%def name="menu_bar_nav()">
23 ${self.menu_items(active='repositories')}
23 ${self.menu_items(active='repositories')}
24 </%def>
24 </%def>
25
25
26 <%def name="menu_bar_subnav()">
26 <%def name="menu_bar_subnav()">
27 ${self.repo_menu(active='showpullrequest')}
27 ${self.repo_menu(active='showpullrequest')}
28 </%def>
28 </%def>
29
29
30 <%def name="main()">
30 <%def name="main()">
31 <script type="text/javascript">
31 <script type="text/javascript">
32 // TODO: marcink switch this to pyroutes
32 // TODO: marcink switch this to pyroutes
33 AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
33 AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
34 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
34 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
35 </script>
35 </script>
36 <div class="box">
36 <div class="box">
37 <div class="title">
37 <div class="title">
38 ${self.repo_page_title(c.rhodecode_db_repo)}
38 ${self.repo_page_title(c.rhodecode_db_repo)}
39 </div>
39 </div>
40
40
41 ${self.breadcrumbs()}
41 ${self.breadcrumbs()}
42
42
43
43
44 <div class="box pr-summary">
44 <div class="box pr-summary">
45 <div class="summary-details block-left">
45 <div class="summary-details block-left">
46 <%summary = lambda n:{False:'summary-short'}.get(n)%>
46 <%summary = lambda n:{False:'summary-short'}.get(n)%>
47 <div class="pr-details-title">
47 <div class="pr-details-title">
48 ${_('Pull request #%s') % c.pull_request.pull_request_id} ${_('From')} ${h.format_date(c.pull_request.created_on)}
48 ${_('Pull request #%s') % c.pull_request.pull_request_id} ${_('From')} ${h.format_date(c.pull_request.created_on)}
49 %if c.allowed_to_update:
49 %if c.allowed_to_update:
50 <span id="open_edit_pullrequest" class="block-right action_button">${_('Edit')}</span>
50 <span id="open_edit_pullrequest" class="block-right action_button">${_('Edit')}</span>
51 <span id="close_edit_pullrequest" class="block-right action_button" style="display: none;">${_('Close')}</span>
51 <span id="close_edit_pullrequest" class="block-right action_button" style="display: none;">${_('Close')}</span>
52 %endif
52 %endif
53 </div>
53 </div>
54
54
55 <div id="summary" class="fields pr-details-content">
55 <div id="summary" class="fields pr-details-content">
56 <div class="field">
56 <div class="field">
57 <div class="label-summary">
57 <div class="label-summary">
58 <label>${_('Origin')}:</label>
58 <label>${_('Origin')}:</label>
59 </div>
59 </div>
60 <div class="input">
60 <div class="input">
61 <div class="pr-origininfo">
61 <div class="pr-origininfo">
62 ## branch link is only valid if it is a branch
62 ## branch link is only valid if it is a branch
63 <span class="tag">
63 <span class="tag">
64 %if c.pull_request.source_ref_parts.type == 'branch':
64 %if c.pull_request.source_ref_parts.type == 'branch':
65 <a href="${h.url('changelog_home', repo_name=c.pull_request.source_repo.repo_name, branch=c.pull_request.source_ref_parts.name)}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
65 <a href="${h.url('changelog_home', repo_name=c.pull_request.source_repo.repo_name, branch=c.pull_request.source_ref_parts.name)}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
66 %else:
66 %else:
67 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
67 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
68 %endif
68 %endif
69 </span>
69 </span>
70 <span class="clone-url">
70 <span class="clone-url">
71 <a href="${h.url('summary_home', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
71 <a href="${h.url('summary_home', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
72 </span>
72 </span>
73 </div>
73 </div>
74 <div class="pr-pullinfo">
74 <div class="pr-pullinfo">
75 %if h.is_hg(c.pull_request.source_repo):
75 %if h.is_hg(c.pull_request.source_repo):
76 <input type="text" value="hg pull -r ${h.short_id(c.source_ref)} ${c.pull_request.source_repo.clone_url()}" readonly="readonly">
76 <input type="text" value="hg pull -r ${h.short_id(c.source_ref)} ${c.pull_request.source_repo.clone_url()}" readonly="readonly">
77 %elif h.is_git(c.pull_request.source_repo):
77 %elif h.is_git(c.pull_request.source_repo):
78 <input type="text" value="git pull ${c.pull_request.source_repo.clone_url()} ${c.pull_request.source_ref_parts.name}" readonly="readonly">
78 <input type="text" value="git pull ${c.pull_request.source_repo.clone_url()} ${c.pull_request.source_ref_parts.name}" readonly="readonly">
79 %endif
79 %endif
80 </div>
80 </div>
81 </div>
81 </div>
82 </div>
82 </div>
83 <div class="field">
83 <div class="field">
84 <div class="label-summary">
84 <div class="label-summary">
85 <label>${_('Target')}:</label>
85 <label>${_('Target')}:</label>
86 </div>
86 </div>
87 <div class="input">
87 <div class="input">
88 <div class="pr-targetinfo">
88 <div class="pr-targetinfo">
89 ## branch link is only valid if it is a branch
89 ## branch link is only valid if it is a branch
90 <span class="tag">
90 <span class="tag">
91 %if c.pull_request.target_ref_parts.type == 'branch':
91 %if c.pull_request.target_ref_parts.type == 'branch':
92 <a href="${h.url('changelog_home', repo_name=c.pull_request.target_repo.repo_name, branch=c.pull_request.target_ref_parts.name)}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
92 <a href="${h.url('changelog_home', repo_name=c.pull_request.target_repo.repo_name, branch=c.pull_request.target_ref_parts.name)}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
93 %else:
93 %else:
94 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
94 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
95 %endif
95 %endif
96 </span>
96 </span>
97 <span class="clone-url">
97 <span class="clone-url">
98 <a href="${h.url('summary_home', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
98 <a href="${h.url('summary_home', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
99 </span>
99 </span>
100 </div>
100 </div>
101 </div>
101 </div>
102 </div>
102 </div>
103 <div class="field">
103 <div class="field">
104 <div class="label-summary">
104 <div class="label-summary">
105 <label>${_('Review')}:</label>
105 <label>${_('Review')}:</label>
106 </div>
106 </div>
107 <div class="input">
107 <div class="input">
108 %if c.pull_request_review_status:
108 %if c.pull_request_review_status:
109 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
109 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
110 <span class="changeset-status-lbl tooltip">
110 <span class="changeset-status-lbl tooltip">
111 %if c.pull_request.is_closed():
111 %if c.pull_request.is_closed():
112 ${_('Closed')},
112 ${_('Closed')},
113 %endif
113 %endif
114 ${h.commit_status_lbl(c.pull_request_review_status)}
114 ${h.commit_status_lbl(c.pull_request_review_status)}
115 </span>
115 </span>
116 - ${ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
116 - ${ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
117 %endif
117 %endif
118 </div>
118 </div>
119 </div>
119 </div>
120 <div class="field">
120 <div class="field">
121 <div class="pr-description-label label-summary">
121 <div class="pr-description-label label-summary">
122 <label>${_('Description')}:</label>
122 <label>${_('Description')}:</label>
123 </div>
123 </div>
124 <div id="pr-desc" class="input">
124 <div id="pr-desc" class="input">
125 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
125 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
126 </div>
126 </div>
127 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
127 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
128 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
128 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
129 </div>
129 </div>
130 </div>
130 </div>
131 <div class="field">
131 <div class="field">
132 <div class="label-summary">
132 <div class="label-summary">
133 <label>${_('Comments')}:</label>
133 <label>${_('Comments')}:</label>
134 </div>
134 </div>
135 <div class="input">
135 <div class="input">
136 <div>
136 <div>
137 <div class="comments-number">
137 <div class="comments-number">
138 %if c.comments:
138 %if c.comments:
139 <a href="#comments">${ungettext("%d Pull request comment", "%d Pull request comments", len(c.comments)) % len(c.comments)}</a>,
139 <a href="#comments">${ungettext("%d Pull request comment", "%d Pull request comments", len(c.comments)) % len(c.comments)}</a>,
140 %else:
140 %else:
141 ${ungettext("%d Pull request comment", "%d Pull request comments", len(c.comments)) % len(c.comments)}
141 ${ungettext("%d Pull request comment", "%d Pull request comments", len(c.comments)) % len(c.comments)}
142 %endif
142 %endif
143 %if c.inline_cnt:
143 %if c.inline_cnt:
144 ## this is replaced with a proper link to first comment via JS linkifyComments() func
144 ## this is replaced with a proper link to first comment via JS linkifyComments() func
145 <a href="#inline-comments" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
145 <a href="#inline-comments" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
146 %else:
146 %else:
147 ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
147 ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
148 %endif
148 %endif
149
149
150 % if c.outdated_cnt:
150 % if c.outdated_cnt:
151 ,${ungettext("%d Outdated Comment", "%d Outdated Comments", c.outdated_cnt) % c.outdated_cnt} <span id="show-outdated-comments" class="btn btn-link">${_('(Show)')}</span>
151 ,${ungettext("%d Outdated Comment", "%d Outdated Comments", c.outdated_cnt) % c.outdated_cnt} <span id="show-outdated-comments" class="btn btn-link">${_('(Show)')}</span>
152 % endif
152 % endif
153 </div>
153 </div>
154 </div>
154 </div>
155 </div>
155 </div>
156 </div>
156 </div>
157 <div id="pr-save" class="field" style="display: none;">
157 <div id="pr-save" class="field" style="display: none;">
158 <div class="label-summary"></div>
158 <div class="label-summary"></div>
159 <div class="input">
159 <div class="input">
160 <span id="edit_pull_request" class="btn btn-small">${_('Save Changes')}</span>
160 <span id="edit_pull_request" class="btn btn-small">${_('Save Changes')}</span>
161 </div>
161 </div>
162 </div>
162 </div>
163 </div>
163 </div>
164 </div>
164 </div>
165 <div>
165 <div>
166 ## AUTHOR
166 ## AUTHOR
167 <div class="reviewers-title block-right">
167 <div class="reviewers-title block-right">
168 <div class="pr-details-title">
168 <div class="pr-details-title">
169 ${_('Author')}
169 ${_('Author')}
170 </div>
170 </div>
171 </div>
171 </div>
172 <div class="block-right pr-details-content reviewers">
172 <div class="block-right pr-details-content reviewers">
173 <ul class="group_members">
173 <ul class="group_members">
174 <li>
174 <li>
175 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
175 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
176 </li>
176 </li>
177 </ul>
177 </ul>
178 </div>
178 </div>
179 ## REVIEWERS
179 ## REVIEWERS
180 <div class="reviewers-title block-right">
180 <div class="reviewers-title block-right">
181 <div class="pr-details-title">
181 <div class="pr-details-title">
182 ${_('Pull request reviewers')}
182 ${_('Pull request reviewers')}
183 %if c.allowed_to_update:
183 %if c.allowed_to_update:
184 <span id="open_edit_reviewers" class="block-right action_button">${_('Edit')}</span>
184 <span id="open_edit_reviewers" class="block-right action_button">${_('Edit')}</span>
185 <span id="close_edit_reviewers" class="block-right action_button" style="display: none;">${_('Close')}</span>
185 <span id="close_edit_reviewers" class="block-right action_button" style="display: none;">${_('Close')}</span>
186 %endif
186 %endif
187 </div>
187 </div>
188 </div>
188 </div>
189 <div id="reviewers" class="block-right pr-details-content reviewers">
189 <div id="reviewers" class="block-right pr-details-content reviewers">
190 ## members goes here !
190 ## members goes here !
191 <ul id="review_members" class="group_members">
191 <ul id="review_members" class="group_members">
192 %for member,status in c.pull_request_reviewers:
192 %for member,status in c.pull_request_reviewers:
193 <li id="reviewer_${member.user_id}">
193 <li id="reviewer_${member.user_id}">
194 <div class="reviewers_member">
194 <div class="reviewers_member">
195 <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
195 <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
196 <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div>
196 <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div>
197 </div>
197 </div>
198 <div id="reviewer_${member.user_id}_name" class="reviewer_name">
198 <div id="reviewer_${member.user_id}_name" class="reviewer_name">
199 ${self.gravatar_with_user(member.email, 16)} <div class="reviewer">(${_('owner') if c.pull_request.user_id == member.user_id else _('reviewer')})</div>
199 ${self.gravatar_with_user(member.email, 16)} <div class="reviewer">(${_('owner') if c.pull_request.user_id == member.user_id else _('reviewer')})</div>
200 </div>
200 </div>
201 <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="review_members" />
201 <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="review_members" />
202 %if c.allowed_to_update:
202 %if c.allowed_to_update:
203 <div class="reviewer_member_remove action_button" onclick="removeReviewMember(${member.user_id}, true)" style="visibility: hidden;">
203 <div class="reviewer_member_remove action_button" onclick="removeReviewMember(${member.user_id}, true)" style="visibility: hidden;">
204 <i class="icon-remove-sign" ></i>
204 <i class="icon-remove-sign" ></i>
205 </div>
205 </div>
206 %endif
206 %endif
207 </div>
207 </div>
208 </li>
208 </li>
209 %endfor
209 %endfor
210 </ul>
210 </ul>
211 %if not c.pull_request.is_closed():
211 %if not c.pull_request.is_closed():
212 <div id="add_reviewer_input" class='ac' style="display: none;">
212 <div id="add_reviewer_input" class='ac' style="display: none;">
213 %if c.allowed_to_update:
213 %if c.allowed_to_update:
214 <div class="reviewer_ac">
214 <div class="reviewer_ac">
215 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer'))}
215 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer'))}
216 <div id="reviewers_container"></div>
216 <div id="reviewers_container"></div>
217 </div>
217 </div>
218 <div>
218 <div>
219 <span id="update_pull_request" class="btn btn-small">${_('Save Changes')}</span>
219 <span id="update_pull_request" class="btn btn-small">${_('Save Changes')}</span>
220 </div>
220 </div>
221 %endif
221 %endif
222 </div>
222 </div>
223 %endif
223 %endif
224 </div>
224 </div>
225 </div>
225 </div>
226 </div>
226 </div>
227 <div class="box">
227 <div class="box">
228 ##DIFF
228 ##DIFF
229 <div class="table" >
229 <div class="table" >
230 <div id="changeset_compare_view_content">
230 <div id="changeset_compare_view_content">
231 ##CS
231 ##CS
232 % if c.missing_requirements:
232 % if c.missing_requirements:
233 <div class="box">
233 <div class="box">
234 <div class="alert alert-warning">
234 <div class="alert alert-warning">
235 <div>
235 <div>
236 <strong>${_('Missing requirements:')}</strong>
236 <strong>${_('Missing requirements:')}</strong>
237 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
237 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
238 </div>
238 </div>
239 </div>
239 </div>
240 </div>
240 </div>
241 % elif c.missing_commits:
241 % elif c.missing_commits:
242 <div class="box">
242 <div class="box">
243 <div class="alert alert-warning">
243 <div class="alert alert-warning">
244 <div>
244 <div>
245 <strong>${_('Missing commits')}:</strong>
245 <strong>${_('Missing commits')}:</strong>
246 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
246 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
247 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
247 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
248 </div>
248 </div>
249 </div>
249 </div>
250 </div>
250 </div>
251 % endif
251 % endif
252 <div class="compare_view_commits_title">
252 <div class="compare_view_commits_title">
253 % if c.allowed_to_update and not c.pull_request.is_closed():
253 % if c.allowed_to_update and not c.pull_request.is_closed():
254 <button id="update_commits" class="btn btn-small">${_('Update commits')}</button>
254 <button id="update_commits" class="btn btn-small">${_('Update commits')}</button>
255 % endif
255 % endif
256 % if len(c.commit_ranges):
256 % if len(c.commit_ranges):
257 <h2>${ungettext('Compare View: %s commit','Compare View: %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}</h2>
257 <h2>${ungettext('Compare View: %s commit','Compare View: %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}</h2>
258 % endif
258 % endif
259 </div>
259 </div>
260 % if not c.missing_commits:
260 % if not c.missing_commits:
261 <%include file="/compare/compare_commits.html" />
261 <%include file="/compare/compare_commits.html" />
262 ## FILES
262 ## FILES
263 <div class="cs_files_title">
263 <div class="cs_files_title">
264 <span class="cs_files_expand">
264 <span class="cs_files_expand">
265 <span id="expand_all_files">${_('Expand All')}</span> | <span id="collapse_all_files">${_('Collapse All')}</span>
265 <span id="expand_all_files">${_('Expand All')}</span> | <span id="collapse_all_files">${_('Collapse All')}</span>
266 </span>
266 </span>
267 <h2>
267 <h2>
268 ${diff_block.diff_summary_text(len(c.files), c.lines_added, c.lines_deleted, c.limited_diff)}
268 ${diff_block.diff_summary_text(len(c.files), c.lines_added, c.lines_deleted, c.limited_diff)}
269 </h2>
269 </h2>
270 </div>
270 </div>
271 % endif
271 % endif
272 <div class="cs_files">
272 <div class="cs_files">
273 %if not c.files and not c.missing_commits:
273 %if not c.files and not c.missing_commits:
274 <span class="empty_data">${_('No files')}</span>
274 <span class="empty_data">${_('No files')}</span>
275 %endif
275 %endif
276 <table class="compare_view_files">
276 <table class="compare_view_files">
277 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
277 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
278 %for FID, change, path, stats in c.files:
278 %for FID, change, path, stats in c.files:
279 <tr class="cs_${change} collapse_file" fid="${FID}">
279 <tr class="cs_${change} collapse_file" fid="${FID}">
280 <td class="cs_icon_td">
280 <td class="cs_icon_td">
281 <span class="collapse_file_icon" fid="${FID}"></span>
281 <span class="collapse_file_icon" fid="${FID}"></span>
282 </td>
282 </td>
283 <td class="cs_icon_td">
283 <td class="cs_icon_td">
284 <div class="flag_status not_reviewed hidden"></div>
284 <div class="flag_status not_reviewed hidden"></div>
285 </td>
285 </td>
286 <td class="cs_${change}" id="a_${FID}">
286 <td class="cs_${change}" id="a_${FID}">
287 <div class="node">
287 <div class="node">
288 <a href="#a_${FID}">
288 <a href="#a_${FID}">
289 <i class="icon-file-${change.lower()}"></i>
289 <i class="icon-file-${change.lower()}"></i>
290 ${h.safe_unicode(path)}
290 ${h.safe_unicode(path)}
291 </a>
291 </a>
292 </div>
292 </div>
293 </td>
293 </td>
294 <td>
294 <td>
295 <div class="changes pull-right">${h.fancy_file_stats(stats)}</div>
295 <div class="changes pull-right">${h.fancy_file_stats(stats)}</div>
296 <div class="comment-bubble pull-right" data-path="${path}">
296 <div class="comment-bubble pull-right" data-path="${path}">
297 <i class="icon-comment"></i>
297 <i class="icon-comment"></i>
298 </div>
298 </div>
299 </td>
299 </td>
300 </tr>
300 </tr>
301 <tr fid="${FID}" id="diff_${FID}" class="diff_links">
301 <tr fid="${FID}" id="diff_${FID}" class="diff_links">
302 <td></td>
302 <td></td>
303 <td></td>
303 <td></td>
304 <td class="cs_${change}">
304 <td class="cs_${change}">
305 %if c.target_repo.repo_name == c.repo_name:
305 %if c.target_repo.repo_name == c.repo_name:
306 ${diff_block.diff_menu(c.repo_name, h.safe_unicode(path), c.target_ref, c.source_ref, change)}
306 ${diff_block.diff_menu(c.repo_name, h.safe_unicode(path), c.target_ref, c.source_ref, change)}
307 %else:
307 %else:
308 ## this is slightly different case later, since the other repo can have this
308 ## this is slightly different case later, since the other repo can have this
309 ## file in other state than the origin repo
309 ## file in other state than the origin repo
310 ${diff_block.diff_menu(c.target_repo.repo_name, h.safe_unicode(path), c.target_ref, c.source_ref, change)}
310 ${diff_block.diff_menu(c.target_repo.repo_name, h.safe_unicode(path), c.target_ref, c.source_ref, change)}
311 %endif
311 %endif
312 </td>
312 </td>
313 <td class="td-actions rc-form">
313 <td class="td-actions rc-form">
314 <div data-comment-id="${FID}" class="btn-link show-inline-comments comments-visible">
315 <span class="comments-show">${_('Show comments')}</span>
316 <span class="comments-hide">${_('Hide comments')}</span>
317 </div>
314 </td>
318 </td>
315 </tr>
319 </tr>
316 <tr id="tr_${FID}">
320 <tr id="tr_${FID}">
317 <td></td>
321 <td></td>
318 <td></td>
322 <td></td>
319 <td class="injected_diff" colspan="2">
323 <td class="injected_diff" colspan="2">
320 ${diff_block.diff_block_simple([c.changes[FID]])}
324 ${diff_block.diff_block_simple([c.changes[FID]])}
321 </td>
325 </td>
322 </tr>
326 </tr>
323
327
324 ## Loop through inline comments
328 ## Loop through inline comments
325 % if c.outdated_comments.get(path,False):
329 % if c.outdated_comments.get(path,False):
326 <tr class="outdated">
330 <tr class="outdated">
327 <td></td>
331 <td></td>
328 <td></td>
332 <td></td>
329 <td colspan="2">
333 <td colspan="2">
330 <p>${_('Outdated Inline Comments')}:</p>
334 <p>${_('Outdated Inline Comments')}:</p>
331 </td>
335 </td>
332 </tr>
336 </tr>
333 <tr class="outdated">
337 <tr class="outdated">
334 <td></td>
338 <td></td>
335 <td></td>
339 <td></td>
336 <td colspan="2" class="outdated_comment_block">
340 <td colspan="2" class="outdated_comment_block">
337 % for line, comments in c.outdated_comments[path].iteritems():
341 % for line, comments in c.outdated_comments[path].iteritems():
338 <div class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
342 <div class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
339 % for co in comments:
343 % for co in comments:
340 ${comment.comment_block_outdated(co)}
344 ${comment.comment_block_outdated(co)}
341 % endfor
345 % endfor
342 </div>
346 </div>
343 % endfor
347 % endfor
344 </td>
348 </td>
345 </tr>
349 </tr>
346 % endif
350 % endif
347 %endfor
351 %endfor
348 ## Loop through inline comments for deleted files
352 ## Loop through inline comments for deleted files
349 %for path in c.deleted_files:
353 %for path in c.deleted_files:
350 <tr class="outdated deleted">
354 <tr class="outdated deleted">
351 <td></td>
355 <td></td>
352 <td></td>
356 <td></td>
353 <td>${path}</td>
357 <td>${path}</td>
354 </tr>
358 </tr>
355 <tr class="outdated deleted">
359 <tr class="outdated deleted">
356 <td></td>
360 <td></td>
357 <td></td>
361 <td></td>
358 <td>(${_('Removed')})</td>
362 <td>(${_('Removed')})</td>
359 </tr>
363 </tr>
360 % if path in c.outdated_comments:
364 % if path in c.outdated_comments:
361 <tr class="outdated deleted">
365 <tr class="outdated deleted">
362 <td></td>
366 <td></td>
363 <td></td>
367 <td></td>
364 <td colspan="2">
368 <td colspan="2">
365 <p>${_('Outdated Inline Comments')}:</p>
369 <p>${_('Outdated Inline Comments')}:</p>
366 </td>
370 </td>
367 </tr>
371 </tr>
368 <tr class="outdated">
372 <tr class="outdated">
369 <td></td>
373 <td></td>
370 <td></td>
374 <td></td>
371 <td colspan="2" class="outdated_comment_block">
375 <td colspan="2" class="outdated_comment_block">
372 % for line, comments in c.outdated_comments[path].iteritems():
376 % for line, comments in c.outdated_comments[path].iteritems():
373 <div class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
377 <div class="inline-comment-placeholder" path="${path}" target_id="${h.safeid(h.safe_unicode(path))}">
374 % for co in comments:
378 % for co in comments:
375 ${comment.comment_block_outdated(co)}
379 ${comment.comment_block_outdated(co)}
376 % endfor
380 % endfor
377 </div>
381 </div>
378 % endfor
382 % endfor
379 </td>
383 </td>
380 </tr>
384 </tr>
381 % endif
385 % endif
382 %endfor
386 %endfor
383 </table>
387 </table>
384 </div>
388 </div>
385 % if c.limited_diff:
389 % if c.limited_diff:
386 <h5>${_('Commit was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5>
390 <h5>${_('Commit was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5>
387 % endif
391 % endif
388 </div>
392 </div>
389 </div>
393 </div>
390
394
391 % if c.limited_diff:
395 % if c.limited_diff:
392 <p>${_('Commit was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></p>
396 <p>${_('Commit was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></p>
393 % endif
397 % endif
394
398
395 ## template for inline comment form
399 ## template for inline comment form
396 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
400 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
397 ${comment.comment_inline_form()}
401 ${comment.comment_inline_form()}
398
402
399 ## render comments and inlines
403 ## render comments and inlines
400 ${comment.generate_comments(include_pull_request=True, is_pull_request=True)}
404 ${comment.generate_comments(include_pull_request=True, is_pull_request=True)}
401
405
402 % if not c.pull_request.is_closed():
406 % if not c.pull_request.is_closed():
403 ## main comment form and it status
407 ## main comment form and it status
404 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
408 ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name,
405 pull_request_id=c.pull_request.pull_request_id),
409 pull_request_id=c.pull_request.pull_request_id),
406 c.pull_request_review_status,
410 c.pull_request_review_status,
407 is_pull_request=True, change_status=c.allowed_to_change_status)}
411 is_pull_request=True, change_status=c.allowed_to_change_status)}
408 %endif
412 %endif
409
413
410 <script type="text/javascript">
414 <script type="text/javascript">
411 if (location.href.indexOf('#') != -1) {
415 if (location.href.indexOf('#') != -1) {
412 var id = '#'+location.href.substring(location.href.indexOf('#') + 1).split('#');
416 var id = '#'+location.href.substring(location.href.indexOf('#') + 1).split('#');
413 var line = $('html').find(id);
417 var line = $('html').find(id);
414 offsetScroll(line, 70);
418 offsetScroll(line, 70);
415 }
419 }
416 $(function(){
420 $(function(){
417 ReviewerAutoComplete('user');
421 ReviewerAutoComplete('user');
418 // custom code mirror
422 // custom code mirror
419 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
423 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
420
424
421 var PRDetails = {
425 var PRDetails = {
422 editButton: $('#open_edit_pullrequest'),
426 editButton: $('#open_edit_pullrequest'),
423 closeButton: $('#close_edit_pullrequest'),
427 closeButton: $('#close_edit_pullrequest'),
424 viewFields: $('#pr-desc, #pr-title'),
428 viewFields: $('#pr-desc, #pr-title'),
425 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
429 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
426
430
427 init: function() {
431 init: function() {
428 var that = this;
432 var that = this;
429 this.editButton.on('click', function(e) { that.edit(); });
433 this.editButton.on('click', function(e) { that.edit(); });
430 this.closeButton.on('click', function(e) { that.view(); });
434 this.closeButton.on('click', function(e) { that.view(); });
431 },
435 },
432
436
433 edit: function(event) {
437 edit: function(event) {
434 this.viewFields.hide();
438 this.viewFields.hide();
435 this.editButton.hide();
439 this.editButton.hide();
436 this.editFields.show();
440 this.editFields.show();
437 codeMirrorInstance.refresh();
441 codeMirrorInstance.refresh();
438 },
442 },
439
443
440 view: function(event) {
444 view: function(event) {
441 this.editFields.hide();
445 this.editFields.hide();
442 this.closeButton.hide();
446 this.closeButton.hide();
443 this.viewFields.show();
447 this.viewFields.show();
444 }
448 }
445 };
449 };
446
450
447 var ReviewersPanel = {
451 var ReviewersPanel = {
448 editButton: $('#open_edit_reviewers'),
452 editButton: $('#open_edit_reviewers'),
449 closeButton: $('#close_edit_reviewers'),
453 closeButton: $('#close_edit_reviewers'),
450 addButton: $('#add_reviewer_input'),
454 addButton: $('#add_reviewer_input'),
451 removeButtons: $('.reviewer_member_remove'),
455 removeButtons: $('.reviewer_member_remove'),
452
456
453 init: function() {
457 init: function() {
454 var that = this;
458 var that = this;
455 this.editButton.on('click', function(e) { that.edit(); });
459 this.editButton.on('click', function(e) { that.edit(); });
456 this.closeButton.on('click', function(e) { that.close(); });
460 this.closeButton.on('click', function(e) { that.close(); });
457 },
461 },
458
462
459 edit: function(event) {
463 edit: function(event) {
460 this.editButton.hide();
464 this.editButton.hide();
461 this.closeButton.show();
465 this.closeButton.show();
462 this.addButton.show();
466 this.addButton.show();
463 this.removeButtons.css('visibility', 'visible');
467 this.removeButtons.css('visibility', 'visible');
464 },
468 },
465
469
466 close: function(event) {
470 close: function(event) {
467 this.editButton.show();
471 this.editButton.show();
468 this.closeButton.hide();
472 this.closeButton.hide();
469 this.addButton.hide();
473 this.addButton.hide();
470 this.removeButtons.css('visibility', 'hidden');
474 this.removeButtons.css('visibility', 'hidden');
471 }
475 }
472 };
476 };
473
477
474 PRDetails.init();
478 PRDetails.init();
475 ReviewersPanel.init();
479 ReviewersPanel.init();
476
480
477 $('#show-outdated-comments').on('click', function(e){
481 $('#show-outdated-comments').on('click', function(e){
478 var button = $(this);
482 var button = $(this);
479 var outdated = $('.outdated');
483 var outdated = $('.outdated');
480 if (button.html() === "(Show)") {
484 if (button.html() === "(Show)") {
481 button.html("(Hide)");
485 button.html("(Hide)");
482 outdated.show();
486 outdated.show();
483 } else {
487 } else {
484 button.html("(Show)");
488 button.html("(Show)");
485 outdated.hide();
489 outdated.hide();
486 }
490 }
487 });
491 });
488
492
489 $('.show-inline-comments').on('change', function(e){
493 $('.show-inline-comments').on('change', function(e){
490 var show = 'none';
494 var show = 'none';
491 var target = e.currentTarget;
495 var target = e.currentTarget;
492 if(target.checked){
496 if(target.checked){
493 show = ''
497 show = ''
494 }
498 }
495 var boxid = $(target).attr('id_for');
499 var boxid = $(target).attr('id_for');
496 var comments = $('#{0} .inline-comments'.format(boxid));
500 var comments = $('#{0} .inline-comments'.format(boxid));
497 var fn_display = function(idx){
501 var fn_display = function(idx){
498 $(this).css('display', show);
502 $(this).css('display', show);
499 };
503 };
500 $(comments).each(fn_display);
504 $(comments).each(fn_display);
501 var btns = $('#{0} .inline-comments-button'.format(boxid));
505 var btns = $('#{0} .inline-comments-button'.format(boxid));
502 $(btns).each(fn_display);
506 $(btns).each(fn_display);
503 });
507 });
504
508
505 // inject comments into their proper positions
509 // inject comments into their proper positions
506 var file_comments = $('.inline-comment-placeholder');
510 var file_comments = $('.inline-comment-placeholder');
507 %if c.pull_request.is_closed():
511 %if c.pull_request.is_closed():
508 renderInlineComments(file_comments, false);
512 renderInlineComments(file_comments, false);
509 %else:
513 %else:
510 renderInlineComments(file_comments, true);
514 renderInlineComments(file_comments, true);
511 %endif
515 %endif
512 var commentTotals = {};
516 var commentTotals = {};
513 $.each(file_comments, function(i, comment) {
517 $.each(file_comments, function(i, comment) {
514 var path = $(comment).attr('path');
518 var path = $(comment).attr('path');
515 var comms = $(comment).children().length;
519 var comms = $(comment).children().length;
516 if (path in commentTotals) {
520 if (path in commentTotals) {
517 commentTotals[path] += comms;
521 commentTotals[path] += comms;
518 } else {
522 } else {
519 commentTotals[path] = comms;
523 commentTotals[path] = comms;
520 }
524 }
521 });
525 });
522 $.each(commentTotals, function(path, total) {
526 $.each(commentTotals, function(path, total) {
523 var elem = $('.comment-bubble[data-path="'+ path +'"]');
527 var elem = $('.comment-bubble[data-path="'+ path +'"]');
524 elem.css('visibility', 'visible');
528 elem.css('visibility', 'visible');
525 elem.html(elem.html() + ' ' + total );
529 elem.html(elem.html() + ' ' + total );
526 });
530 });
527
531
528 $('#merge_pull_request_form').submit(function() {
532 $('#merge_pull_request_form').submit(function() {
529 if (!$('#merge_pull_request').attr('disabled')) {
533 if (!$('#merge_pull_request').attr('disabled')) {
530 $('#merge_pull_request').attr('disabled', 'disabled');
534 $('#merge_pull_request').attr('disabled', 'disabled');
531 }
535 }
532 return true;
536 return true;
533 });
537 });
534
538
535 $('#edit_pull_request').on('click', function(e){
539 $('#edit_pull_request').on('click', function(e){
536 var title = $('#pr-title-input').val();
540 var title = $('#pr-title-input').val();
537 var description = codeMirrorInstance.getValue();
541 var description = codeMirrorInstance.getValue();
538 editPullRequest(
542 editPullRequest(
539 "${c.repo_name}", "${c.pull_request.pull_request_id}",
543 "${c.repo_name}", "${c.pull_request.pull_request_id}",
540 title, description);
544 title, description);
541 });
545 });
542
546
543 $('#update_pull_request').on('click', function(e){
547 $('#update_pull_request').on('click', function(e){
544 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
548 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
545 });
549 });
546
550
547 $('#update_commits').on('click', function(e){
551 $('#update_commits').on('click', function(e){
548 var isDisabled = !$(e.currentTarget).attr('disabled');
552 var isDisabled = !$(e.currentTarget).attr('disabled');
549 $(e.currentTarget).text(_gettext('Updating...'));
553 $(e.currentTarget).text(_gettext('Updating...'));
550 $(e.currentTarget).attr('disabled', 'disabled');
554 $(e.currentTarget).attr('disabled', 'disabled');
551 if(isDisabled){
555 if(isDisabled){
552 updateCommits("${c.repo_name}", "${c.pull_request.pull_request_id}");
556 updateCommits("${c.repo_name}", "${c.pull_request.pull_request_id}");
553 }
557 }
554
558
555 });
559 });
556 // fixing issue with caches on firefox
560 // fixing issue with caches on firefox
557 $('#update_commits').removeAttr("disabled");
561 $('#update_commits').removeAttr("disabled");
558
562
559 $('#close_pull_request').on('click', function(e){
563 $('#close_pull_request').on('click', function(e){
560 closePullRequest("${c.repo_name}", "${c.pull_request.pull_request_id}");
564 closePullRequest("${c.repo_name}", "${c.pull_request.pull_request_id}");
561 });
565 });
566
567 $('.show-inline-comments').on('click', function(e){
568 var boxid = $(this).attr('data-comment-id');
569 var button = $(this);
570
571 if(button.hasClass("comments-visible")) {
572 $('#{0} .inline-comments'.format(boxid)).each(function(index){
573 $(this).hide();
574 })
575 button.removeClass("comments-visible");
576 } else {
577 $('#{0} .inline-comments'.format(boxid)).each(function(index){
578 $(this).show();
579 })
580 button.addClass("comments-visible");
581 }
582 });
562 })
583 })
563 </script>
584 </script>
564
585
565 </div>
586 </div>
566 </div>
587 </div>
567
588
568 </%def>
589 </%def>
General Comments 0
You need to be logged in to leave comments. Login now