Show More
@@ -1,643 +1,647 b'' | |||
|
1 | 1 | <%inherit file="/base/base.mako"/> |
|
2 | 2 | |
|
3 | 3 | <%def name="title()"> |
|
4 | 4 | ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)} |
|
5 | 5 | %if c.rhodecode_name: |
|
6 | 6 | · ${h.branding(c.rhodecode_name)} |
|
7 | 7 | %endif |
|
8 | 8 | </%def> |
|
9 | 9 | |
|
10 | 10 | <%def name="breadcrumbs_links()"> |
|
11 | 11 | <span id="pr-title"> |
|
12 | 12 | ${c.pull_request.title} |
|
13 | 13 | %if c.pull_request.is_closed(): |
|
14 | 14 | (${_('Closed')}) |
|
15 | 15 | %endif |
|
16 | 16 | </span> |
|
17 | 17 | <div id="pr-title-edit" class="input" style="display: none;"> |
|
18 | 18 | ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)} |
|
19 | 19 | </div> |
|
20 | 20 | </%def> |
|
21 | 21 | |
|
22 | 22 | <%def name="menu_bar_nav()"> |
|
23 | 23 | ${self.menu_items(active='repositories')} |
|
24 | 24 | </%def> |
|
25 | 25 | |
|
26 | 26 | <%def name="menu_bar_subnav()"> |
|
27 | 27 | ${self.repo_menu(active='showpullrequest')} |
|
28 | 28 | </%def> |
|
29 | 29 | |
|
30 | 30 | <%def name="main()"> |
|
31 | 31 | |
|
32 | 32 | <script type="text/javascript"> |
|
33 | 33 | // TODO: marcink switch this to pyroutes |
|
34 | 34 | AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"; |
|
35 | 35 | templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id}; |
|
36 | 36 | </script> |
|
37 | 37 | <div class="box"> |
|
38 | 38 | <div class="title"> |
|
39 | 39 | ${self.repo_page_title(c.rhodecode_db_repo)} |
|
40 | 40 | </div> |
|
41 | 41 | |
|
42 | 42 | ${self.breadcrumbs()} |
|
43 | 43 | |
|
44 | 44 | <div class="box pr-summary"> |
|
45 | 45 | <div class="summary-details block-left"> |
|
46 | 46 | <% summary = lambda n:{False:'summary-short'}.get(n) %> |
|
47 | 47 | <div class="pr-details-title"> |
|
48 | 48 | <a href="${h.url('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)} |
|
49 | 49 | %if c.allowed_to_update: |
|
50 | 50 | <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0"> |
|
51 | 51 | % if c.allowed_to_delete: |
|
52 | 52 | ${h.secure_form(url('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id),method='delete')} |
|
53 | 53 | ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'), |
|
54 | 54 | class_="btn btn-link btn-danger",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")} |
|
55 | 55 | ${h.end_form()} |
|
56 | 56 | % else: |
|
57 | 57 | ${_('Delete')} |
|
58 | 58 | % endif |
|
59 | 59 | </div> |
|
60 | 60 | <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div> |
|
61 | 61 | <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div> |
|
62 | 62 | %endif |
|
63 | 63 | </div> |
|
64 | 64 | |
|
65 | 65 | <div id="summary" class="fields pr-details-content"> |
|
66 | 66 | <div class="field"> |
|
67 | 67 | <div class="label-summary"> |
|
68 | 68 | <label>${_('Origin')}:</label> |
|
69 | 69 | </div> |
|
70 | 70 | <div class="input"> |
|
71 | 71 | <div class="pr-origininfo"> |
|
72 | 72 | ## branch link is only valid if it is a branch |
|
73 | 73 | <span class="tag"> |
|
74 | 74 | %if c.pull_request.source_ref_parts.type == 'branch': |
|
75 | 75 | <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> |
|
76 | 76 | %else: |
|
77 | 77 | ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name} |
|
78 | 78 | %endif |
|
79 | 79 | </span> |
|
80 | 80 | <span class="clone-url"> |
|
81 | 81 | <a href="${h.url('summary_home', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a> |
|
82 | 82 | </span> |
|
83 | 83 | </div> |
|
84 | 84 | <div class="pr-pullinfo"> |
|
85 | 85 | %if h.is_hg(c.pull_request.source_repo): |
|
86 | 86 | <input type="text" value="hg pull -r ${h.short_id(c.source_ref)} ${c.pull_request.source_repo.clone_url()}" readonly="readonly"> |
|
87 | 87 | %elif h.is_git(c.pull_request.source_repo): |
|
88 | 88 | <input type="text" value="git pull ${c.pull_request.source_repo.clone_url()} ${c.pull_request.source_ref_parts.name}" readonly="readonly"> |
|
89 | 89 | %endif |
|
90 | 90 | </div> |
|
91 | 91 | </div> |
|
92 | 92 | </div> |
|
93 | 93 | <div class="field"> |
|
94 | 94 | <div class="label-summary"> |
|
95 | 95 | <label>${_('Target')}:</label> |
|
96 | 96 | </div> |
|
97 | 97 | <div class="input"> |
|
98 | 98 | <div class="pr-targetinfo"> |
|
99 | 99 | ## branch link is only valid if it is a branch |
|
100 | 100 | <span class="tag"> |
|
101 | 101 | %if c.pull_request.target_ref_parts.type == 'branch': |
|
102 | 102 | <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> |
|
103 | 103 | %else: |
|
104 | 104 | ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name} |
|
105 | 105 | %endif |
|
106 | 106 | </span> |
|
107 | 107 | <span class="clone-url"> |
|
108 | 108 | <a href="${h.url('summary_home', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a> |
|
109 | 109 | </span> |
|
110 | 110 | </div> |
|
111 | 111 | </div> |
|
112 | 112 | </div> |
|
113 | 113 | |
|
114 | 114 | ## Link to the shadow repository. |
|
115 | 115 | <div class="field"> |
|
116 | 116 | <div class="label-summary"> |
|
117 | 117 | <label>${_('Merge')}:</label> |
|
118 | 118 | </div> |
|
119 | 119 | <div class="input"> |
|
120 | 120 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: |
|
121 | 121 | <div class="pr-mergeinfo"> |
|
122 | 122 | %if h.is_hg(c.pull_request.target_repo): |
|
123 | 123 | <input type="text" value="hg clone -u ${c.pull_request.shadow_merge_ref.name} ${c.shadow_clone_url} pull-request-${c.pull_request.pull_request_id}" readonly="readonly"> |
|
124 | 124 | %elif h.is_git(c.pull_request.target_repo): |
|
125 | 125 | <input type="text" value="git clone --branch ${c.pull_request.shadow_merge_ref.name} ${c.shadow_clone_url} pull-request-${c.pull_request.pull_request_id}" readonly="readonly"> |
|
126 | 126 | %endif |
|
127 | 127 | </div> |
|
128 | 128 | % else: |
|
129 | 129 | <div class=""> |
|
130 | 130 | ${_('Shadow repository data not available')}. |
|
131 | 131 | </div> |
|
132 | 132 | % endif |
|
133 | 133 | </div> |
|
134 | 134 | </div> |
|
135 | 135 | |
|
136 | 136 | <div class="field"> |
|
137 | 137 | <div class="label-summary"> |
|
138 | 138 | <label>${_('Review')}:</label> |
|
139 | 139 | </div> |
|
140 | 140 | <div class="input"> |
|
141 | 141 | %if c.pull_request_review_status: |
|
142 | 142 | <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div> |
|
143 | 143 | <span class="changeset-status-lbl tooltip"> |
|
144 | 144 | %if c.pull_request.is_closed(): |
|
145 | 145 | ${_('Closed')}, |
|
146 | 146 | %endif |
|
147 | 147 | ${h.commit_status_lbl(c.pull_request_review_status)} |
|
148 | 148 | </span> |
|
149 | 149 | - ${ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)} |
|
150 | 150 | %endif |
|
151 | 151 | </div> |
|
152 | 152 | </div> |
|
153 | 153 | <div class="field"> |
|
154 | 154 | <div class="pr-description-label label-summary"> |
|
155 | 155 | <label>${_('Description')}:</label> |
|
156 | 156 | </div> |
|
157 | 157 | <div id="pr-desc" class="input"> |
|
158 | 158 | <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div> |
|
159 | 159 | </div> |
|
160 | 160 | <div id="pr-desc-edit" class="input textarea editor" style="display: none;"> |
|
161 | 161 | <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea> |
|
162 | 162 | </div> |
|
163 | 163 | </div> |
|
164 | 164 | |
|
165 | 165 | <div class="field"> |
|
166 | 166 | <div class="label-summary"> |
|
167 | 167 | <label>${_('Versions')} (${len(c.versions)+1}):</label> |
|
168 | 168 | </div> |
|
169 | 169 | |
|
170 | 170 | <div class="pr-versions"> |
|
171 | 171 | % if c.show_version_changes: |
|
172 | 172 | <table> |
|
173 | 173 | ## CURRENTLY SELECT PR VERSION |
|
174 | 174 | <tr class="version-pr" style="display: ${'' if c.at_version_num is None else 'none'}"> |
|
175 | 175 | <td> |
|
176 | 176 | % if c.at_version in [None, 'latest']: |
|
177 | 177 | <i class="icon-ok link"></i> |
|
178 | 178 | % else: |
|
179 | 179 | <i class="icon-comment"></i> <code>${len(c.inline_versions[None])}</code> |
|
180 | 180 | % endif |
|
181 | 181 | </td> |
|
182 | 182 | <td> |
|
183 | 183 | <code> |
|
184 | 184 | % if c.versions: |
|
185 | 185 | <a href="${h.url.current(version='latest')}">${_('latest')}</a> |
|
186 | 186 | % else: |
|
187 | 187 | ${_('initial')} |
|
188 | 188 | % endif |
|
189 | 189 | </code> |
|
190 | 190 | </td> |
|
191 | 191 | <td> |
|
192 | 192 | <code>${c.pull_request_latest.source_ref_parts.commit_id[:6]}</code> |
|
193 | 193 | </td> |
|
194 | 194 | <td> |
|
195 | 195 | ${_('created')} ${h.age_component(c.pull_request_latest.updated_on)} |
|
196 | 196 | </td> |
|
197 | 197 | <td align="right"> |
|
198 | 198 | % if c.versions and c.at_version_num in [None, 'latest']: |
|
199 | 199 | <span id="show-pr-versions" class="btn btn-link" onclick="$('.version-pr').show(); $(this).hide(); return false">${_('Show all versions')}</span> |
|
200 | 200 | % endif |
|
201 | 201 | </td> |
|
202 | 202 | </tr> |
|
203 | 203 | |
|
204 | 204 | ## SHOW ALL VERSIONS OF PR |
|
205 | 205 | <% ver_pr = None %> |
|
206 | 206 | % for data in reversed(list(enumerate(c.versions, 1))): |
|
207 | 207 | <% ver_pos = data[0] %> |
|
208 | 208 | <% ver = data[1] %> |
|
209 | 209 | <% ver_pr = ver.pull_request_version_id %> |
|
210 | 210 | |
|
211 | 211 | <tr class="version-pr" style="display: ${'' if c.at_version == ver_pr else 'none'}"> |
|
212 | 212 | <td> |
|
213 | 213 | % if c.at_version == ver_pr: |
|
214 | 214 | <i class="icon-ok link"></i> |
|
215 | 215 | % else: |
|
216 | 216 | <i class="icon-comment"></i> <code>${len(c.inline_versions[ver_pr])}</code> |
|
217 | 217 | % endif |
|
218 | 218 | </td> |
|
219 | 219 | <td> |
|
220 | 220 | <code class="tooltip" title="${_('Comment from pull request version {0}').format(ver_pos)}"> |
|
221 | 221 | <a href="${h.url.current(version=ver_pr)}">v${ver_pos}</a> |
|
222 | 222 | </code> |
|
223 | 223 | </td> |
|
224 | 224 | <td> |
|
225 | 225 | <code>${ver.source_ref_parts.commit_id[:6]}</code> |
|
226 | 226 | </td> |
|
227 | 227 | <td> |
|
228 | 228 | ${_('created')} ${h.age_component(ver.updated_on)} |
|
229 | 229 | </td> |
|
230 | 230 | <td align="right"> |
|
231 | 231 | % if c.at_version == ver_pr: |
|
232 | 232 | <span id="show-pr-versions" class="btn btn-link" onclick="$('.version-pr').show(); $(this).hide(); return false">${_('Show all versions')}</span> |
|
233 | 233 | % endif |
|
234 | 234 | </td> |
|
235 | 235 | </tr> |
|
236 | 236 | % endfor |
|
237 | 237 | |
|
238 | 238 | ## show comment/inline comments summary |
|
239 | 239 | <tr> |
|
240 | 240 | <td> |
|
241 | 241 | </td> |
|
242 | 242 | |
|
243 | 243 | <% inline_comm_count_ver = len(c.inline_versions[ver_pr])%> |
|
244 | 244 | <td colspan="4" style="border-top: 1px dashed #dbd9da"> |
|
245 | 245 | ${_('Comments for this version')}: |
|
246 | 246 | %if c.comments: |
|
247 | 247 | <a href="#comments">${_("%d General ") % len(c.comments)}</a> |
|
248 | 248 | %else: |
|
249 | 249 | ${_("%d General ") % len(c.comments)} |
|
250 | 250 | %endif |
|
251 | 251 | |
|
252 | 252 | <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num])%> |
|
253 | 253 | %if inline_comm_count_ver: |
|
254 | 254 | , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a> |
|
255 | 255 | %else: |
|
256 | 256 | , ${_("%d Inline") % inline_comm_count_ver} |
|
257 | 257 | %endif |
|
258 | 258 | |
|
259 | 259 | %if c.outdated_cnt: |
|
260 | 260 | , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % c.outdated_cnt}</a> |
|
261 | 261 | <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a> |
|
262 | 262 | <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a> |
|
263 | 263 | %else: |
|
264 | 264 | , ${_("%d Outdated") % c.outdated_cnt} |
|
265 | 265 | %endif |
|
266 | 266 | </td> |
|
267 | 267 | </tr> |
|
268 | 268 | |
|
269 | 269 | <tr> |
|
270 | 270 | <td></td> |
|
271 | 271 | <td colspan="4"> |
|
272 | 272 | % if c.at_version: |
|
273 | 273 | <pre> |
|
274 | 274 | Changed commits: |
|
275 | 275 | * added: ${len(c.changes.added)} |
|
276 | 276 | * removed: ${len(c.changes.removed)} |
|
277 | 277 | |
|
278 | 278 | % if not (c.file_changes.added+c.file_changes.modified+c.file_changes.removed): |
|
279 | 279 | No file changes found |
|
280 | 280 | % else: |
|
281 | 281 | Changed files: |
|
282 | 282 | %for file_name in c.file_changes.added: |
|
283 | 283 | * A <a href="#${'a_' + h.FID('', file_name)}">${file_name}</a> |
|
284 | 284 | %endfor |
|
285 | 285 | %for file_name in c.file_changes.modified: |
|
286 | 286 | * M <a href="#${'a_' + h.FID('', file_name)}">${file_name}</a> |
|
287 | 287 | %endfor |
|
288 | 288 | %for file_name in c.file_changes.removed: |
|
289 | 289 | * R ${file_name} |
|
290 | 290 | %endfor |
|
291 | 291 | % endif |
|
292 | 292 | </pre> |
|
293 | 293 | % endif |
|
294 | 294 | </td> |
|
295 | 295 | </tr> |
|
296 | 296 | </table> |
|
297 | 297 | % else: |
|
298 | 298 | ${_('Pull request versions not available')}. |
|
299 | 299 | % endif |
|
300 | 300 | </div> |
|
301 | 301 | </div> |
|
302 | 302 | |
|
303 | 303 | <div id="pr-save" class="field" style="display: none;"> |
|
304 | 304 | <div class="label-summary"></div> |
|
305 | 305 | <div class="input"> |
|
306 | 306 | <span id="edit_pull_request" class="btn btn-small">${_('Save Changes')}</span> |
|
307 | 307 | </div> |
|
308 | 308 | </div> |
|
309 | 309 | </div> |
|
310 | 310 | </div> |
|
311 | 311 | <div> |
|
312 | 312 | ## AUTHOR |
|
313 | 313 | <div class="reviewers-title block-right"> |
|
314 | 314 | <div class="pr-details-title"> |
|
315 | 315 | ${_('Author')} |
|
316 | 316 | </div> |
|
317 | 317 | </div> |
|
318 | 318 | <div class="block-right pr-details-content reviewers"> |
|
319 | 319 | <ul class="group_members"> |
|
320 | 320 | <li> |
|
321 | 321 | ${self.gravatar_with_user(c.pull_request.author.email, 16)} |
|
322 | 322 | </li> |
|
323 | 323 | </ul> |
|
324 | 324 | </div> |
|
325 | 325 | ## REVIEWERS |
|
326 | 326 | <div class="reviewers-title block-right"> |
|
327 | 327 | <div class="pr-details-title"> |
|
328 | 328 | ${_('Pull request reviewers')} |
|
329 | 329 | %if c.allowed_to_update: |
|
330 | 330 | <span id="open_edit_reviewers" class="block-right action_button">${_('Edit')}</span> |
|
331 | 331 | <span id="close_edit_reviewers" class="block-right action_button" style="display: none;">${_('Close')}</span> |
|
332 | 332 | %endif |
|
333 | 333 | </div> |
|
334 | 334 | </div> |
|
335 | 335 | <div id="reviewers" class="block-right pr-details-content reviewers"> |
|
336 | 336 | ## members goes here ! |
|
337 | 337 | <input type="hidden" name="__start__" value="review_members:sequence"> |
|
338 | 338 | <ul id="review_members" class="group_members"> |
|
339 | 339 | %for member,reasons,status in c.pull_request_reviewers: |
|
340 | 340 | <li id="reviewer_${member.user_id}"> |
|
341 | 341 | <div class="reviewers_member"> |
|
342 | 342 | <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}"> |
|
343 | 343 | <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div> |
|
344 | 344 | </div> |
|
345 | 345 | <div id="reviewer_${member.user_id}_name" class="reviewer_name"> |
|
346 | 346 | ${self.gravatar_with_user(member.email, 16)} |
|
347 | 347 | </div> |
|
348 | 348 | <input type="hidden" name="__start__" value="reviewer:mapping"> |
|
349 | 349 | <input type="hidden" name="__start__" value="reasons:sequence"> |
|
350 | 350 | %for reason in reasons: |
|
351 | 351 | <div class="reviewer_reason">- ${reason}</div> |
|
352 | 352 | <input type="hidden" name="reason" value="${reason}"> |
|
353 | 353 | |
|
354 | 354 | %endfor |
|
355 | 355 | <input type="hidden" name="__end__" value="reasons:sequence"> |
|
356 | 356 | <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="user_id" /> |
|
357 | 357 | <input type="hidden" name="__end__" value="reviewer:mapping"> |
|
358 | 358 | %if c.allowed_to_update: |
|
359 | 359 | <div class="reviewer_member_remove action_button" onclick="removeReviewMember(${member.user_id}, true)" style="visibility: hidden;"> |
|
360 | 360 | <i class="icon-remove-sign" ></i> |
|
361 | 361 | </div> |
|
362 | 362 | %endif |
|
363 | 363 | </div> |
|
364 | 364 | </li> |
|
365 | 365 | %endfor |
|
366 | 366 | </ul> |
|
367 | 367 | <input type="hidden" name="__end__" value="review_members:sequence"> |
|
368 | 368 | %if not c.pull_request.is_closed(): |
|
369 | 369 | <div id="add_reviewer_input" class='ac' style="display: none;"> |
|
370 | 370 | %if c.allowed_to_update: |
|
371 | 371 | <div class="reviewer_ac"> |
|
372 | 372 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer'))} |
|
373 | 373 | <div id="reviewers_container"></div> |
|
374 | 374 | </div> |
|
375 | 375 | <div> |
|
376 | 376 | <span id="update_pull_request" class="btn btn-small">${_('Save Changes')}</span> |
|
377 | 377 | </div> |
|
378 | 378 | %endif |
|
379 | 379 | </div> |
|
380 | 380 | %endif |
|
381 | 381 | </div> |
|
382 | 382 | </div> |
|
383 | 383 | </div> |
|
384 | 384 | <div class="box"> |
|
385 | 385 | ##DIFF |
|
386 | 386 | <div class="table" > |
|
387 | 387 | <div id="changeset_compare_view_content"> |
|
388 | 388 | ##CS |
|
389 | 389 | % if c.missing_requirements: |
|
390 | 390 | <div class="box"> |
|
391 | 391 | <div class="alert alert-warning"> |
|
392 | 392 | <div> |
|
393 | 393 | <strong>${_('Missing requirements:')}</strong> |
|
394 | 394 | ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')} |
|
395 | 395 | </div> |
|
396 | 396 | </div> |
|
397 | 397 | </div> |
|
398 | 398 | % elif c.missing_commits: |
|
399 | 399 | <div class="box"> |
|
400 | 400 | <div class="alert alert-warning"> |
|
401 | 401 | <div> |
|
402 | 402 | <strong>${_('Missing commits')}:</strong> |
|
403 | 403 | ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')} |
|
404 | 404 | ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')} |
|
405 | 405 | </div> |
|
406 | 406 | </div> |
|
407 | 407 | </div> |
|
408 | 408 | % endif |
|
409 | 409 | <div class="compare_view_commits_title"> |
|
410 | 410 | |
|
411 | 411 | <div class="pull-left"> |
|
412 | 412 | <div class="btn-group"> |
|
413 | 413 | <a |
|
414 | 414 | class="btn" |
|
415 | 415 | href="#" |
|
416 | 416 | onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false"> |
|
417 | 417 | ${ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
418 | 418 | </a> |
|
419 | 419 | <a |
|
420 | 420 | class="btn" |
|
421 | 421 | href="#" |
|
422 | 422 | onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false"> |
|
423 | 423 | ${ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)} |
|
424 | 424 | </a> |
|
425 | 425 | </div> |
|
426 | 426 | </div> |
|
427 | 427 | |
|
428 | 428 | <div class="pull-right"> |
|
429 | 429 | % if c.allowed_to_update and not c.pull_request.is_closed(): |
|
430 | 430 | <a id="update_commits" class="btn btn-primary pull-right">${_('Update commits')}</a> |
|
431 | 431 | % else: |
|
432 | 432 | <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a> |
|
433 | 433 | % endif |
|
434 | 434 | |
|
435 | 435 | </div> |
|
436 | 436 | |
|
437 | 437 | </div> |
|
438 | ||
|
438 | 439 |
|
|
439 | 440 | <%include file="/compare/compare_commits.mako" /> |
|
440 | 441 | <div class="cs_files"> |
|
441 | 442 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
442 | 443 | ${cbdiffs.render_diffset_menu()} |
|
443 | 444 | ${cbdiffs.render_diffset( |
|
444 | 445 | c.diffset, use_comments=True, |
|
445 | 446 | collapse_when_files_over=30, |
|
446 | 447 | disable_new_comments=not c.allowed_to_comment, |
|
447 | 448 | deleted_files_comments=c.deleted_files_comments)} |
|
449 | </div> | |
|
450 | % else: | |
|
451 | ## skipping commits we need to clear the view for missing commits | |
|
452 | <div style="clear:both;"></div> | |
|
453 | % endif | |
|
448 | 454 | |
|
449 | 455 |
|
|
450 | % endif | |
|
451 | </div> | |
|
452 | 456 | </div> |
|
453 | 457 | |
|
454 | 458 | ## template for inline comment form |
|
455 | 459 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
456 | 460 | |
|
457 | 461 | ## render general comments |
|
458 | 462 | ${comment.generate_comments(include_pull_request=True, is_pull_request=True)} |
|
459 | 463 | |
|
460 | 464 | % if not c.pull_request.is_closed(): |
|
461 | 465 | ## main comment form and it status |
|
462 | 466 | ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name, |
|
463 | 467 | pull_request_id=c.pull_request.pull_request_id), |
|
464 | 468 | c.pull_request_review_status, |
|
465 | 469 | is_pull_request=True, change_status=c.allowed_to_change_status)} |
|
466 | 470 | %endif |
|
467 | 471 | |
|
468 | 472 | <script type="text/javascript"> |
|
469 | 473 | if (location.hash) { |
|
470 | 474 | var result = splitDelimitedHash(location.hash); |
|
471 | 475 | var line = $('html').find(result.loc); |
|
472 | 476 | if (line.length > 0){ |
|
473 | 477 | offsetScroll(line, 70); |
|
474 | 478 | } |
|
475 | 479 | } |
|
476 | 480 | $(function(){ |
|
477 | 481 | ReviewerAutoComplete('user'); |
|
478 | 482 | // custom code mirror |
|
479 | 483 | var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input'); |
|
480 | 484 | |
|
481 | 485 | var PRDetails = { |
|
482 | 486 | editButton: $('#open_edit_pullrequest'), |
|
483 | 487 | closeButton: $('#close_edit_pullrequest'), |
|
484 | 488 | deleteButton: $('#delete_pullrequest'), |
|
485 | 489 | viewFields: $('#pr-desc, #pr-title'), |
|
486 | 490 | editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'), |
|
487 | 491 | |
|
488 | 492 | init: function() { |
|
489 | 493 | var that = this; |
|
490 | 494 | this.editButton.on('click', function(e) { that.edit(); }); |
|
491 | 495 | this.closeButton.on('click', function(e) { that.view(); }); |
|
492 | 496 | }, |
|
493 | 497 | |
|
494 | 498 | edit: function(event) { |
|
495 | 499 | this.viewFields.hide(); |
|
496 | 500 | this.editButton.hide(); |
|
497 | 501 | this.deleteButton.hide(); |
|
498 | 502 | this.closeButton.show(); |
|
499 | 503 | this.editFields.show(); |
|
500 | 504 | codeMirrorInstance.refresh(); |
|
501 | 505 | }, |
|
502 | 506 | |
|
503 | 507 | view: function(event) { |
|
504 | 508 | this.editButton.show(); |
|
505 | 509 | this.deleteButton.show(); |
|
506 | 510 | this.editFields.hide(); |
|
507 | 511 | this.closeButton.hide(); |
|
508 | 512 | this.viewFields.show(); |
|
509 | 513 | } |
|
510 | 514 | }; |
|
511 | 515 | |
|
512 | 516 | var ReviewersPanel = { |
|
513 | 517 | editButton: $('#open_edit_reviewers'), |
|
514 | 518 | closeButton: $('#close_edit_reviewers'), |
|
515 | 519 | addButton: $('#add_reviewer_input'), |
|
516 | 520 | removeButtons: $('.reviewer_member_remove'), |
|
517 | 521 | |
|
518 | 522 | init: function() { |
|
519 | 523 | var that = this; |
|
520 | 524 | this.editButton.on('click', function(e) { that.edit(); }); |
|
521 | 525 | this.closeButton.on('click', function(e) { that.close(); }); |
|
522 | 526 | }, |
|
523 | 527 | |
|
524 | 528 | edit: function(event) { |
|
525 | 529 | this.editButton.hide(); |
|
526 | 530 | this.closeButton.show(); |
|
527 | 531 | this.addButton.show(); |
|
528 | 532 | this.removeButtons.css('visibility', 'visible'); |
|
529 | 533 | }, |
|
530 | 534 | |
|
531 | 535 | close: function(event) { |
|
532 | 536 | this.editButton.show(); |
|
533 | 537 | this.closeButton.hide(); |
|
534 | 538 | this.addButton.hide(); |
|
535 | 539 | this.removeButtons.css('visibility', 'hidden'); |
|
536 | 540 | } |
|
537 | 541 | }; |
|
538 | 542 | |
|
539 | 543 | PRDetails.init(); |
|
540 | 544 | ReviewersPanel.init(); |
|
541 | 545 | |
|
542 | 546 | showOutdated = function(self){ |
|
543 | 547 | $('.comment-outdated').show(); |
|
544 | 548 | $('.filediff-outdated').show(); |
|
545 | 549 | $('.showOutdatedComments').hide(); |
|
546 | 550 | $('.hideOutdatedComments').show(); |
|
547 | 551 | |
|
548 | 552 | }; |
|
549 | 553 | |
|
550 | 554 | hideOutdated = function(self){ |
|
551 | 555 | $('.comment-outdated').hide(); |
|
552 | 556 | $('.filediff-outdated').hide(); |
|
553 | 557 | $('.hideOutdatedComments').hide(); |
|
554 | 558 | $('.showOutdatedComments').show(); |
|
555 | 559 | }; |
|
556 | 560 | |
|
557 | 561 | $('#show-outdated-comments').on('click', function(e){ |
|
558 | 562 | var button = $(this); |
|
559 | 563 | var outdated = $('.comment-outdated'); |
|
560 | 564 | |
|
561 | 565 | if (button.html() === "(Show)") { |
|
562 | 566 | button.html("(Hide)"); |
|
563 | 567 | outdated.show(); |
|
564 | 568 | } else { |
|
565 | 569 | button.html("(Show)"); |
|
566 | 570 | outdated.hide(); |
|
567 | 571 | } |
|
568 | 572 | }); |
|
569 | 573 | |
|
570 | 574 | $('.show-inline-comments').on('change', function(e){ |
|
571 | 575 | var show = 'none'; |
|
572 | 576 | var target = e.currentTarget; |
|
573 | 577 | if(target.checked){ |
|
574 | 578 | show = '' |
|
575 | 579 | } |
|
576 | 580 | var boxid = $(target).attr('id_for'); |
|
577 | 581 | var comments = $('#{0} .inline-comments'.format(boxid)); |
|
578 | 582 | var fn_display = function(idx){ |
|
579 | 583 | $(this).css('display', show); |
|
580 | 584 | }; |
|
581 | 585 | $(comments).each(fn_display); |
|
582 | 586 | var btns = $('#{0} .inline-comments-button'.format(boxid)); |
|
583 | 587 | $(btns).each(fn_display); |
|
584 | 588 | }); |
|
585 | 589 | |
|
586 | 590 | $('#merge_pull_request_form').submit(function() { |
|
587 | 591 | if (!$('#merge_pull_request').attr('disabled')) { |
|
588 | 592 | $('#merge_pull_request').attr('disabled', 'disabled'); |
|
589 | 593 | } |
|
590 | 594 | return true; |
|
591 | 595 | }); |
|
592 | 596 | |
|
593 | 597 | $('#edit_pull_request').on('click', function(e){ |
|
594 | 598 | var title = $('#pr-title-input').val(); |
|
595 | 599 | var description = codeMirrorInstance.getValue(); |
|
596 | 600 | editPullRequest( |
|
597 | 601 | "${c.repo_name}", "${c.pull_request.pull_request_id}", |
|
598 | 602 | title, description); |
|
599 | 603 | }); |
|
600 | 604 | |
|
601 | 605 | $('#update_pull_request').on('click', function(e){ |
|
602 | 606 | updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
603 | 607 | }); |
|
604 | 608 | |
|
605 | 609 | $('#update_commits').on('click', function(e){ |
|
606 | 610 | var isDisabled = !$(e.currentTarget).attr('disabled'); |
|
607 | 611 | $(e.currentTarget).text(_gettext('Updating...')); |
|
608 | 612 | $(e.currentTarget).attr('disabled', 'disabled'); |
|
609 | 613 | if(isDisabled){ |
|
610 | 614 | updateCommits("${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
611 | 615 | } |
|
612 | 616 | |
|
613 | 617 | }); |
|
614 | 618 | // fixing issue with caches on firefox |
|
615 | 619 | $('#update_commits').removeAttr("disabled"); |
|
616 | 620 | |
|
617 | 621 | $('#close_pull_request').on('click', function(e){ |
|
618 | 622 | closePullRequest("${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
619 | 623 | }); |
|
620 | 624 | |
|
621 | 625 | $('.show-inline-comments').on('click', function(e){ |
|
622 | 626 | var boxid = $(this).attr('data-comment-id'); |
|
623 | 627 | var button = $(this); |
|
624 | 628 | |
|
625 | 629 | if(button.hasClass("comments-visible")) { |
|
626 | 630 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
627 | 631 | $(this).hide(); |
|
628 | 632 | }); |
|
629 | 633 | button.removeClass("comments-visible"); |
|
630 | 634 | } else { |
|
631 | 635 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
632 | 636 | $(this).show(); |
|
633 | 637 | }); |
|
634 | 638 | button.addClass("comments-visible"); |
|
635 | 639 | } |
|
636 | 640 | }); |
|
637 | 641 | }) |
|
638 | 642 | </script> |
|
639 | 643 | |
|
640 | 644 | </div> |
|
641 | 645 | </div> |
|
642 | 646 | |
|
643 | 647 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now