Show More
@@ -1,922 +1,920 b'' | |||
|
1 | 1 | <%inherit file="/base/base.mako"/> |
|
2 | 2 | <%namespace name="base" file="/base/base.mako"/> |
|
3 | 3 | <%namespace name="dt" file="/data_table/_dt_elements.mako"/> |
|
4 | 4 | |
|
5 | 5 | <%def name="title()"> |
|
6 | 6 | ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)} |
|
7 | 7 | %if c.rhodecode_name: |
|
8 | 8 | · ${h.branding(c.rhodecode_name)} |
|
9 | 9 | %endif |
|
10 | 10 | </%def> |
|
11 | 11 | |
|
12 | 12 | <%def name="breadcrumbs_links()"> |
|
13 | 13 | |
|
14 | 14 | </%def> |
|
15 | 15 | |
|
16 | 16 | <%def name="menu_bar_nav()"> |
|
17 | 17 | ${self.menu_items(active='repositories')} |
|
18 | 18 | </%def> |
|
19 | 19 | |
|
20 | 20 | <%def name="menu_bar_subnav()"> |
|
21 | 21 | ${self.repo_menu(active='showpullrequest')} |
|
22 | 22 | </%def> |
|
23 | 23 | |
|
24 | 24 | <%def name="main()"> |
|
25 | 25 | |
|
26 | 26 | <script type="text/javascript"> |
|
27 | 27 | // TODO: marcink switch this to pyroutes |
|
28 | 28 | AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}"; |
|
29 | 29 | templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id}; |
|
30 | 30 | </script> |
|
31 | 31 | |
|
32 | 32 | <div class="box"> |
|
33 | 33 | |
|
34 | 34 | <div class="box pr-summary"> |
|
35 | 35 | |
|
36 | 36 | <div class="summary-details block-left"> |
|
37 | 37 | <div id="pr-title"> |
|
38 | 38 | % if c.pull_request.is_closed(): |
|
39 | 39 | <span class="pr-title-closed-tag tag">${_('Closed')}</span> |
|
40 | 40 | % endif |
|
41 | 41 | <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}"> |
|
42 | 42 | </div> |
|
43 | 43 | <div id="pr-title-edit" class="input" style="display: none;"> |
|
44 | 44 | <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}"> |
|
45 | 45 | </div> |
|
46 | 46 | |
|
47 | 47 | <% summary = lambda n:{False:'summary-short'}.get(n) %> |
|
48 | 48 | <div class="pr-details-title"> |
|
49 | 49 | <div class="pull-left"> |
|
50 | 50 | <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request !{}').format(c.pull_request.pull_request_id)}</a> |
|
51 | 51 | ${_('Created on')} |
|
52 | 52 | <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span> |
|
53 | 53 | <span class="pr-details-title-author-pref">${_('by')}</span> |
|
54 | 54 | </div> |
|
55 | 55 | |
|
56 | 56 | <div class="pull-left"> |
|
57 | 57 | ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)} |
|
58 | 58 | </div> |
|
59 | 59 | |
|
60 | 60 | %if c.allowed_to_update: |
|
61 | 61 | <div class="pull-right"> |
|
62 | 62 | <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div> |
|
63 | 63 | <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;"> |
|
64 | 64 | % if c.allowed_to_delete: |
|
65 | 65 | ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)} |
|
66 | 66 | <input class="btn btn-link btn-danger no-margin" id="remove_${c.pull_request.pull_request_id}" name="remove_${c.pull_request.pull_request_id}" |
|
67 | 67 | onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')" |
|
68 | 68 | type="submit" value="${_('Delete pull request')}"> |
|
69 | 69 | ${h.end_form()} |
|
70 | 70 | % else: |
|
71 | 71 | <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span> |
|
72 | 72 | % endif |
|
73 | 73 | </div> |
|
74 | 74 | <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div> |
|
75 | 75 | <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div> |
|
76 | 76 | </div> |
|
77 | 77 | |
|
78 | 78 | %endif |
|
79 | 79 | </div> |
|
80 | 80 | |
|
81 | 81 | <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}"> |
|
82 | 82 | ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name)} |
|
83 | 83 | </div> |
|
84 | 84 | |
|
85 | 85 | <div id="pr-desc-edit" class="input textarea" style="display: none;"> |
|
86 | 86 | <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}"> |
|
87 | 87 | ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)} |
|
88 | 88 | </div> |
|
89 | 89 | |
|
90 | 90 | <div id="summary" class="fields pr-details-content"> |
|
91 | 91 | |
|
92 | 92 | ## review |
|
93 | 93 | <div class="field"> |
|
94 | 94 | <div class="label-pr-detail"> |
|
95 | 95 | <label>${_('Review status')}:</label> |
|
96 | 96 | </div> |
|
97 | 97 | <div class="input"> |
|
98 | 98 | %if c.pull_request_review_status: |
|
99 | 99 | <div class="tag status-tag-${c.pull_request_review_status}"> |
|
100 | 100 | <i class="icon-circle review-status-${c.pull_request_review_status}"></i> |
|
101 | 101 | <span class="changeset-status-lbl"> |
|
102 | 102 | %if c.pull_request.is_closed(): |
|
103 | 103 | ${_('Closed')}, |
|
104 | 104 | %endif |
|
105 | 105 | |
|
106 | 106 | ${h.commit_status_lbl(c.pull_request_review_status)} |
|
107 | 107 | |
|
108 | 108 | </span> |
|
109 | 109 | </div> |
|
110 | 110 | - ${_ungettext('calculated based on {} reviewer vote', 'calculated based on {} reviewers votes', len(c.pull_request_reviewers)).format(len(c.pull_request_reviewers))} |
|
111 | 111 | %endif |
|
112 | 112 | </div> |
|
113 | 113 | </div> |
|
114 | 114 | |
|
115 | 115 | ## source |
|
116 | 116 | <div class="field"> |
|
117 | 117 | <div class="label-pr-detail"> |
|
118 | 118 | <label>${_('Commit flow')}:</label> |
|
119 | 119 | </div> |
|
120 | 120 | <div class="input"> |
|
121 | 121 | <div class="pr-commit-flow"> |
|
122 | 122 | ## Source |
|
123 | 123 | %if c.pull_request.source_ref_parts.type == 'branch': |
|
124 | 124 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}"><code class="pr-source-info">${c.pull_request.source_ref_parts.type}:${c.pull_request.source_ref_parts.name}</code></a> |
|
125 | 125 | %else: |
|
126 | 126 | <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code> |
|
127 | 127 | %endif |
|
128 | 128 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.repo_name}</a> |
|
129 | 129 | → |
|
130 | 130 | ## Target |
|
131 | 131 | %if c.pull_request.target_ref_parts.type == 'branch': |
|
132 | 132 | <a href="${h.route_path('repo_commits', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}"><code class="pr-target-info">${c.pull_request.target_ref_parts.type}:${c.pull_request.target_ref_parts.name}</code></a> |
|
133 | 133 | %else: |
|
134 | 134 | <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code> |
|
135 | 135 | %endif |
|
136 | 136 | |
|
137 | 137 | ${_('of')} <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.repo_name}</a> |
|
138 | 138 | |
|
139 | 139 | <a class="source-details-action" href="#expand-source-details" onclick="return versionController.toggleElement(this, '.source-details')" data-toggle-on='<i class="icon-angle-down">more details</i>' data-toggle-off='<i class="icon-angle-up">less details</i>'> |
|
140 | 140 | <i class="icon-angle-down">more details</i> |
|
141 | 141 | </a> |
|
142 | 142 | |
|
143 | 143 | </div> |
|
144 | 144 | |
|
145 | 145 | <div class="source-details" style="display: none"> |
|
146 | 146 | |
|
147 | 147 | <ul> |
|
148 | 148 | |
|
149 | 149 | ## common ancestor |
|
150 | 150 | <li> |
|
151 | 151 | ${_('Common ancestor')}: |
|
152 | 152 | % if c.ancestor_commit: |
|
153 | 153 | <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a> |
|
154 | 154 | % else: |
|
155 | 155 | ${_('not available')} |
|
156 | 156 | % endif |
|
157 | 157 | </li> |
|
158 | 158 | |
|
159 | 159 | ## pull url |
|
160 | 160 | <li> |
|
161 | 161 | %if h.is_hg(c.pull_request.source_repo): |
|
162 | 162 | <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %> |
|
163 | 163 | %elif h.is_git(c.pull_request.source_repo): |
|
164 | 164 | <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %> |
|
165 | 165 | %endif |
|
166 | 166 | |
|
167 | 167 | <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly"> |
|
168 | 168 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i> |
|
169 | 169 | </li> |
|
170 | 170 | |
|
171 | 171 | ## Shadow repo |
|
172 | 172 | <li> |
|
173 | 173 | % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref: |
|
174 | 174 | %if h.is_hg(c.pull_request.target_repo): |
|
175 | 175 | <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> |
|
176 | 176 | %elif h.is_git(c.pull_request.target_repo): |
|
177 | 177 | <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %> |
|
178 | 178 | %endif |
|
179 | 179 | |
|
180 | 180 | <span class="tooltip" title="${_('Clone repository in its merged state using shadow repository')}">${_('Clone from shadow repository')}</span>: <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly"> |
|
181 | 181 | <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i> |
|
182 | 182 | |
|
183 | 183 | % else: |
|
184 | 184 | <div class=""> |
|
185 | 185 | ${_('Shadow repository data not available')}. |
|
186 | 186 | </div> |
|
187 | 187 | % endif |
|
188 | 188 | </li> |
|
189 | 189 | |
|
190 | 190 | </ul> |
|
191 | 191 | |
|
192 | 192 | </div> |
|
193 | 193 | |
|
194 | 194 | </div> |
|
195 | 195 | |
|
196 | 196 | </div> |
|
197 | 197 | |
|
198 | 198 | ## versions |
|
199 | 199 | <div class="field"> |
|
200 | 200 | <div class="label-pr-detail"> |
|
201 | 201 | <label>${_('Versions')}:</label> |
|
202 | 202 | </div> |
|
203 | 203 | |
|
204 | 204 | <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %> |
|
205 | 205 | <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %> |
|
206 | 206 | |
|
207 | 207 | <div class="pr-versions"> |
|
208 | 208 | % if c.show_version_changes: |
|
209 | 209 | <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %> |
|
210 | 210 | <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %> |
|
211 | 211 | ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))} |
|
212 | 212 | <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions" |
|
213 | 213 | data-toggle-on="${_('show versions')}." |
|
214 | 214 | data-toggle-off="${_('hide versions')}."> |
|
215 | 215 | ${_('show versions')}. |
|
216 | 216 | </a> |
|
217 | 217 | <table> |
|
218 | 218 | ## SHOW ALL VERSIONS OF PR |
|
219 | 219 | <% ver_pr = None %> |
|
220 | 220 | |
|
221 | 221 | % for data in reversed(list(enumerate(c.versions, 1))): |
|
222 | 222 | <% ver_pos = data[0] %> |
|
223 | 223 | <% ver = data[1] %> |
|
224 | 224 | <% ver_pr = ver.pull_request_version_id %> |
|
225 | 225 | <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %> |
|
226 | 226 | |
|
227 | 227 | <tr class="version-pr" style="display: ${display_row}"> |
|
228 | 228 | <td> |
|
229 | 229 | <code> |
|
230 | 230 | <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a> |
|
231 | 231 | </code> |
|
232 | 232 | </td> |
|
233 | 233 | <td> |
|
234 | 234 | <input ${('checked="checked"' if c.from_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/> |
|
235 | 235 | <input ${('checked="checked"' if c.at_version_num == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/> |
|
236 | 236 | </td> |
|
237 | 237 | <td> |
|
238 | 238 | <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %> |
|
239 | 239 | <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i> |
|
240 | 240 | |
|
241 | 241 | </td> |
|
242 | 242 | <td> |
|
243 | 243 | % if c.at_version_num != ver_pr: |
|
244 | 244 | <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i> |
|
245 | 245 | <code> |
|
246 | 246 | General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])} |
|
247 | 247 | </code> |
|
248 | 248 | % endif |
|
249 | 249 | </td> |
|
250 | 250 | <td> |
|
251 | 251 | ##<code>${ver.source_ref_parts.commit_id[:6]}</code> |
|
252 | 252 | </td> |
|
253 | 253 | <td> |
|
254 | 254 | <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code> |
|
255 | 255 | </td> |
|
256 | 256 | </tr> |
|
257 | 257 | % endfor |
|
258 | 258 | |
|
259 | 259 | <tr> |
|
260 | 260 | <td colspan="6"> |
|
261 | 261 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" |
|
262 | 262 | data-label-text-locked="${_('select versions to show changes')}" |
|
263 | 263 | data-label-text-diff="${_('show changes between versions')}" |
|
264 | 264 | data-label-text-show="${_('show pull request for this version')}" |
|
265 | 265 | > |
|
266 | 266 | ${_('select versions to show changes')} |
|
267 | 267 | </button> |
|
268 | 268 | </td> |
|
269 | 269 | </tr> |
|
270 | 270 | </table> |
|
271 | 271 | % else: |
|
272 | 272 | <div> |
|
273 | 273 | ${_('Pull request versions not available')}. |
|
274 | 274 | </div> |
|
275 | 275 | % endif |
|
276 | 276 | </div> |
|
277 | 277 | </div> |
|
278 | 278 | |
|
279 | 279 | </div> |
|
280 | 280 | |
|
281 | 281 | </div> |
|
282 | 282 | |
|
283 | 283 | ## REVIEW RULES |
|
284 | 284 | <div id="review_rules" style="display: none" class="reviewers-title block-right"> |
|
285 | 285 | <div class="pr-details-title"> |
|
286 | 286 | ${_('Reviewer rules')} |
|
287 | 287 | %if c.allowed_to_update: |
|
288 | 288 | <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span> |
|
289 | 289 | %endif |
|
290 | 290 | </div> |
|
291 | 291 | <div class="pr-reviewer-rules"> |
|
292 | 292 | ## review rules will be appended here, by default reviewers logic |
|
293 | 293 | </div> |
|
294 | 294 | <input id="review_data" type="hidden" name="review_data" value=""> |
|
295 | 295 | </div> |
|
296 | 296 | |
|
297 | 297 | ## REVIEWERS |
|
298 | 298 | <div class="reviewers-title first-panel block-right"> |
|
299 | 299 | <div class="pr-details-title"> |
|
300 | 300 | ${_('Pull request reviewers')} |
|
301 | 301 | %if c.allowed_to_update: |
|
302 | 302 | <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span> |
|
303 | 303 | %endif |
|
304 | 304 | </div> |
|
305 | 305 | </div> |
|
306 | 306 | <div id="reviewers" class="block-right pr-details-content reviewers"> |
|
307 | 307 | |
|
308 | 308 | ## members redering block |
|
309 | 309 | <input type="hidden" name="__start__" value="review_members:sequence"> |
|
310 | 310 | <ul id="review_members" class="group_members"> |
|
311 | 311 | |
|
312 | 312 | % for review_obj, member, reasons, mandatory, status in c.pull_request_reviewers: |
|
313 | 313 | <script> |
|
314 | 314 | var member = ${h.json.dumps(h.reviewer_as_json(member, reasons=reasons, mandatory=mandatory, user_group=review_obj.rule_user_group_data()))|n}; |
|
315 | 315 | var status = "${(status[0][1].status if status else 'not_reviewed')}"; |
|
316 | 316 | var status_lbl = "${h.commit_status_lbl(status[0][1].status if status else 'not_reviewed')}"; |
|
317 | 317 | var allowed_to_update = ${h.json.dumps(c.allowed_to_update)}; |
|
318 | 318 | |
|
319 | 319 | var entry = renderTemplate('reviewMemberEntry', { |
|
320 | 320 | 'member': member, |
|
321 | 321 | 'mandatory': member.mandatory, |
|
322 | 322 | 'reasons': member.reasons, |
|
323 | 323 | 'allowed_to_update': allowed_to_update, |
|
324 | 324 | 'review_status': status, |
|
325 | 325 | 'review_status_label': status_lbl, |
|
326 | 326 | 'user_group': member.user_group, |
|
327 | 327 | 'create': false |
|
328 | 328 | }); |
|
329 | 329 | $('#review_members').append(entry) |
|
330 | 330 | </script> |
|
331 | 331 | |
|
332 | 332 | % endfor |
|
333 | 333 | |
|
334 | 334 | </ul> |
|
335 | 335 | |
|
336 | 336 | <input type="hidden" name="__end__" value="review_members:sequence"> |
|
337 | 337 | ## end members redering block |
|
338 | 338 | |
|
339 | 339 | %if not c.pull_request.is_closed(): |
|
340 | 340 | <div id="add_reviewer" class="ac" style="display: none;"> |
|
341 | 341 | %if c.allowed_to_update: |
|
342 | 342 | % if not c.forbid_adding_reviewers: |
|
343 | 343 | <div id="add_reviewer_input" class="reviewer_ac"> |
|
344 | 344 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))} |
|
345 | 345 | <div id="reviewers_container"></div> |
|
346 | 346 | </div> |
|
347 | 347 | % endif |
|
348 | 348 | <div class="pull-right"> |
|
349 | 349 | <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button> |
|
350 | 350 | </div> |
|
351 | 351 | %endif |
|
352 | 352 | </div> |
|
353 | 353 | %endif |
|
354 | 354 | </div> |
|
355 | 355 | |
|
356 | 356 | ## TODOs will be listed here |
|
357 | 357 | <div class="reviewers-title block-right"> |
|
358 | 358 | <div class="pr-details-title"> |
|
359 | 359 | ## Only show unresolved, that is only what matters |
|
360 | 360 | TODO Comments - ${len(c.unresolved_comments)} / ${(len(c.unresolved_comments) + len(c.resolved_comments))} |
|
361 | 361 | |
|
362 | 362 | % if not c.at_version: |
|
363 | 363 | % if c.resolved_comments: |
|
364 | 364 | <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return versionController.toggleElement(this, '.unresolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span> |
|
365 | 365 | % else: |
|
366 | 366 | <span class="block-right last-item noselect">Show resolved</span> |
|
367 | 367 | % endif |
|
368 | 368 | % endif |
|
369 | 369 | </div> |
|
370 | 370 | </div> |
|
371 | 371 | <div class="block-right pr-details-content reviewers"> |
|
372 | 372 | |
|
373 | 373 | <table class="todo-table"> |
|
374 | 374 | <% |
|
375 | 375 | def sorter(entry): |
|
376 | 376 | user_id = entry.author.user_id |
|
377 | 377 | resolved = '1' if entry.resolved else '0' |
|
378 | 378 | if user_id == c.rhodecode_user.user_id: |
|
379 | 379 | # own comments first |
|
380 | 380 | user_id = 0 |
|
381 | 381 | return '{}_{}_{}'.format(resolved, user_id, str(entry.comment_id).zfill(100)) |
|
382 | 382 | %> |
|
383 | 383 | |
|
384 | 384 | % if c.at_version: |
|
385 | 385 | <tr> |
|
386 | 386 | <td class="unresolved-todo-text">${_('unresolved TODOs unavailable in this view')}.</td> |
|
387 | 387 | </tr> |
|
388 | 388 | % else: |
|
389 | 389 | % for todo_comment in sorted(c.unresolved_comments + c.resolved_comments, key=sorter): |
|
390 | 390 | <% resolved = todo_comment.resolved %> |
|
391 | 391 | % if inline: |
|
392 | 392 | <% outdated_at_ver = todo_comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> |
|
393 | 393 | % else: |
|
394 | 394 | <% outdated_at_ver = todo_comment.older_than_version(getattr(c, 'at_version_num', None)) %> |
|
395 | 395 | % endif |
|
396 | 396 | |
|
397 | 397 | <tr ${('class="unresolved-todo" style="display: none"' if resolved else '') |n}> |
|
398 | 398 | |
|
399 | 399 | <td class="td-todo-number"> |
|
400 | 400 | % if resolved: |
|
401 | 401 | <a class="permalink todo-resolved tooltip" title="${_('Resolved by comment #{}').format(todo_comment.resolved.comment_id)}" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})"> |
|
402 | 402 | <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a> |
|
403 | 403 | % else: |
|
404 | 404 | <a class="permalink" href="#comment-${todo_comment.comment_id}" onclick="return Rhodecode.comments.scrollToComment($('#comment-${todo_comment.comment_id}'), 0, ${h.json.dumps(outdated_at_ver)})"> |
|
405 | 405 | <i class="icon-flag-filled"></i> ${todo_comment.comment_id}</a> |
|
406 | 406 | % endif |
|
407 | 407 | </td> |
|
408 | 408 | <td class="td-todo-gravatar"> |
|
409 | 409 | ${base.gravatar(todo_comment.author.email, 16, user=todo_comment.author, tooltip=True, extra_class=['no-margin'])} |
|
410 | 410 | </td> |
|
411 | 411 | <td class="todo-comment-text-wrapper"> |
|
412 | 412 | <div class="todo-comment-text"> |
|
413 | 413 | <code>${h.chop_at_smart(todo_comment.text, '\n', suffix_if_chopped='...')}</code> |
|
414 | 414 | </div> |
|
415 | 415 | </td> |
|
416 | 416 | |
|
417 | 417 | </tr> |
|
418 | 418 | % endfor |
|
419 | 419 | |
|
420 | 420 | % if len(c.unresolved_comments) == 0: |
|
421 | 421 | <tr> |
|
422 | 422 | <td class="unresolved-todo-text">${_('No unresolved TODOs')}.</td> |
|
423 | 423 | </tr> |
|
424 | 424 | % endif |
|
425 | 425 | |
|
426 | 426 | % endif |
|
427 | 427 | |
|
428 | 428 | </table> |
|
429 | 429 | |
|
430 | 430 | </div> |
|
431 | 431 | </div> |
|
432 | 432 | |
|
433 | 433 | </div> |
|
434 | 434 | |
|
435 | 435 | <div class="box"> |
|
436 | 436 | |
|
437 | 437 | % if c.state_progressing: |
|
438 | 438 | |
|
439 | 439 | <h2 style="text-align: center"> |
|
440 | 440 | ${_('Cannot show diff when pull request state is changing. Current progress state')}: <span class="tag tag-merge-state-${c.pull_request.state}">${c.pull_request.state}</span> |
|
441 | 441 | |
|
442 | 442 | % if c.is_super_admin: |
|
443 | 443 | <br/> |
|
444 | 444 | If you think this is an error try <a href="${h.current_route_path(request, force_state='created')}">forced state reset</a> to <span class="tag tag-merge-state-created">created</span> state. |
|
445 | 445 | % endif |
|
446 | 446 | </h2> |
|
447 | 447 | |
|
448 | 448 | % else: |
|
449 | 449 | |
|
450 | 450 | ## Diffs rendered here |
|
451 | 451 | <div class="table" > |
|
452 | 452 | <div id="changeset_compare_view_content"> |
|
453 | 453 | ##CS |
|
454 | 454 | % if c.missing_requirements: |
|
455 | 455 | <div class="box"> |
|
456 | 456 | <div class="alert alert-warning"> |
|
457 | 457 | <div> |
|
458 | 458 | <strong>${_('Missing requirements:')}</strong> |
|
459 | 459 | ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')} |
|
460 | 460 | </div> |
|
461 | 461 | </div> |
|
462 | 462 | </div> |
|
463 | 463 | % elif c.missing_commits: |
|
464 | 464 | <div class="box"> |
|
465 | 465 | <div class="alert alert-warning"> |
|
466 | 466 | <div> |
|
467 | 467 | <strong>${_('Missing commits')}:</strong> |
|
468 | 468 | ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')} |
|
469 | 469 | ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')} |
|
470 | 470 | ${_('Consider doing a {force_refresh_url} in case you think this is an error.').format(force_refresh_url=h.link_to('force refresh', h.current_route_path(request, force_refresh='1')))|n} |
|
471 | 471 | </div> |
|
472 | 472 | </div> |
|
473 | 473 | </div> |
|
474 | % elif c.pr_merge_source_commit.changed: | |
|
474 | % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed(): | |
|
475 | 475 | <div class="box"> |
|
476 | 476 | <div class="alert alert-info"> |
|
477 | 477 | <div> |
|
478 | % if c.pr_merge_source_commit.changed: | |
|
479 | 478 | <strong>${_('There are new changes for `{}:{}` in source repository, please consider updating this pull request.').format(c.pr_merge_source_commit.ref_spec.type, c.pr_merge_source_commit.ref_spec.name)}</strong> |
|
480 | % endif | |
|
481 | 479 | </div> |
|
482 | 480 | </div> |
|
483 | 481 | </div> |
|
484 | 482 | % endif |
|
485 | 483 | |
|
486 | 484 | <div class="compare_view_commits_title"> |
|
487 | 485 | % if not c.compare_mode: |
|
488 | 486 | |
|
489 | 487 | % if c.at_version_pos: |
|
490 | 488 | <h4> |
|
491 | 489 | ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos} |
|
492 | 490 | </h4> |
|
493 | 491 | % endif |
|
494 | 492 | |
|
495 | 493 | <div class="pull-left"> |
|
496 | 494 | <div class="btn-group"> |
|
497 | 495 | <a class="${('collapsed' if c.collapse_all_commits else '')}" href="#expand-commits" onclick="toggleCommitExpand(this); return false" data-toggle-commits-cnt=${len(c.commit_ranges)} > |
|
498 | 496 | % if c.collapse_all_commits: |
|
499 | 497 | <i class="icon-plus-squared-alt icon-no-margin"></i> |
|
500 | 498 | ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))} |
|
501 | 499 | % else: |
|
502 | 500 | <i class="icon-minus-squared-alt icon-no-margin"></i> |
|
503 | 501 | ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))} |
|
504 | 502 | % endif |
|
505 | 503 | </a> |
|
506 | 504 | </div> |
|
507 | 505 | </div> |
|
508 | 506 | |
|
509 | 507 | <div class="pull-right"> |
|
510 | 508 | % if c.allowed_to_update and not c.pull_request.is_closed(): |
|
511 | 509 | |
|
512 | 510 | <div class="btn-group btn-group-actions"> |
|
513 | 511 | <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false"> |
|
514 | 512 | ${_('Update commits')} |
|
515 | 513 | </a> |
|
516 | 514 | |
|
517 | 515 | <a id="update_commits_switcher" class="tooltip btn btn-primary" style="margin-left: -1px" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}"> |
|
518 | 516 | <i class="icon-down"></i> |
|
519 | 517 | </a> |
|
520 | 518 | |
|
521 | 519 | <div class="btn-action-switcher-container" id="update-commits-switcher"> |
|
522 | 520 | <ul class="btn-action-switcher" role="menu"> |
|
523 | 521 | <li> |
|
524 | 522 | <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false"> |
|
525 | 523 | ${_('Force update commits')} |
|
526 | 524 | </a> |
|
527 | 525 | <div class="action-help-block"> |
|
528 | 526 | ${_('Update commits and force refresh this pull request.')} |
|
529 | 527 | </div> |
|
530 | 528 | </li> |
|
531 | 529 | </ul> |
|
532 | 530 | </div> |
|
533 | 531 | </div> |
|
534 | 532 | |
|
535 | 533 | % else: |
|
536 | 534 | <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a> |
|
537 | 535 | % endif |
|
538 | 536 | |
|
539 | 537 | </div> |
|
540 | 538 | % endif |
|
541 | 539 | </div> |
|
542 | 540 | |
|
543 | 541 | % if not c.missing_commits: |
|
544 | 542 | % if c.compare_mode: |
|
545 | 543 | % if c.at_version: |
|
546 | 544 | <h4> |
|
547 | 545 | ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}: |
|
548 | 546 | </h4> |
|
549 | 547 | |
|
550 | 548 | <div class="subtitle-compare"> |
|
551 | 549 | ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))} |
|
552 | 550 | </div> |
|
553 | 551 | |
|
554 | 552 | <div class="container"> |
|
555 | 553 | <table class="rctable compare_view_commits"> |
|
556 | 554 | <tr> |
|
557 | 555 | <th></th> |
|
558 | 556 | <th>${_('Time')}</th> |
|
559 | 557 | <th>${_('Author')}</th> |
|
560 | 558 | <th>${_('Commit')}</th> |
|
561 | 559 | <th></th> |
|
562 | 560 | <th>${_('Description')}</th> |
|
563 | 561 | </tr> |
|
564 | 562 | |
|
565 | 563 | % for c_type, commit in c.commit_changes: |
|
566 | 564 | % if c_type in ['a', 'r']: |
|
567 | 565 | <% |
|
568 | 566 | if c_type == 'a': |
|
569 | 567 | cc_title = _('Commit added in displayed changes') |
|
570 | 568 | elif c_type == 'r': |
|
571 | 569 | cc_title = _('Commit removed in displayed changes') |
|
572 | 570 | else: |
|
573 | 571 | cc_title = '' |
|
574 | 572 | %> |
|
575 | 573 | <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select"> |
|
576 | 574 | <td> |
|
577 | 575 | <div class="commit-change-indicator color-${c_type}-border"> |
|
578 | 576 | <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}"> |
|
579 | 577 | ${c_type.upper()} |
|
580 | 578 | </div> |
|
581 | 579 | </div> |
|
582 | 580 | </td> |
|
583 | 581 | <td class="td-time"> |
|
584 | 582 | ${h.age_component(commit.date)} |
|
585 | 583 | </td> |
|
586 | 584 | <td class="td-user"> |
|
587 | 585 | ${base.gravatar_with_user(commit.author, 16, tooltip=True)} |
|
588 | 586 | </td> |
|
589 | 587 | <td class="td-hash"> |
|
590 | 588 | <code> |
|
591 | 589 | <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}"> |
|
592 | 590 | r${commit.idx}:${h.short_id(commit.raw_id)} |
|
593 | 591 | </a> |
|
594 | 592 | ${h.hidden('revisions', commit.raw_id)} |
|
595 | 593 | </code> |
|
596 | 594 | </td> |
|
597 | 595 | <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false"> |
|
598 | 596 | <i class="icon-expand-linked"></i> |
|
599 | 597 | </td> |
|
600 | 598 | <td class="mid td-description"> |
|
601 | 599 | <div class="log-container truncate-wrap"> |
|
602 | 600 | <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name)}</div> |
|
603 | 601 | </div> |
|
604 | 602 | </td> |
|
605 | 603 | </tr> |
|
606 | 604 | % endif |
|
607 | 605 | % endfor |
|
608 | 606 | </table> |
|
609 | 607 | </div> |
|
610 | 608 | |
|
611 | 609 | % endif |
|
612 | 610 | |
|
613 | 611 | % else: |
|
614 | 612 | <%include file="/compare/compare_commits.mako" /> |
|
615 | 613 | % endif |
|
616 | 614 | |
|
617 | 615 | <div class="cs_files"> |
|
618 | 616 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
619 | 617 | % if c.at_version: |
|
620 | 618 | <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['display']) %> |
|
621 | 619 | <% c.comments = c.comment_versions[c.at_version_num]['display'] %> |
|
622 | 620 | % else: |
|
623 | 621 | <% c.inline_cnt = len(c.inline_versions[c.at_version_num]['until']) %> |
|
624 | 622 | <% c.comments = c.comment_versions[c.at_version_num]['until'] %> |
|
625 | 623 | % endif |
|
626 | 624 | |
|
627 | 625 | <% |
|
628 | 626 | pr_menu_data = { |
|
629 | 627 | 'outdated_comm_count_ver': outdated_comm_count_ver |
|
630 | 628 | } |
|
631 | 629 | %> |
|
632 | 630 | |
|
633 | 631 | ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on)} |
|
634 | 632 | |
|
635 | 633 | % if c.range_diff_on: |
|
636 | 634 | % for commit in c.commit_ranges: |
|
637 | 635 | ${cbdiffs.render_diffset( |
|
638 | 636 | c.changes[commit.raw_id], |
|
639 | 637 | commit=commit, use_comments=True, |
|
640 | 638 | collapse_when_files_over=5, |
|
641 | 639 | disable_new_comments=True, |
|
642 | 640 | deleted_files_comments=c.deleted_files_comments, |
|
643 | 641 | inline_comments=c.inline_comments, |
|
644 | 642 | pull_request_menu=pr_menu_data, show_todos=False)} |
|
645 | 643 | % endfor |
|
646 | 644 | % else: |
|
647 | 645 | ${cbdiffs.render_diffset( |
|
648 | 646 | c.diffset, use_comments=True, |
|
649 | 647 | collapse_when_files_over=30, |
|
650 | 648 | disable_new_comments=not c.allowed_to_comment, |
|
651 | 649 | deleted_files_comments=c.deleted_files_comments, |
|
652 | 650 | inline_comments=c.inline_comments, |
|
653 | 651 | pull_request_menu=pr_menu_data, show_todos=False)} |
|
654 | 652 | % endif |
|
655 | 653 | |
|
656 | 654 | </div> |
|
657 | 655 | % else: |
|
658 | 656 | ## skipping commits we need to clear the view for missing commits |
|
659 | 657 | <div style="clear:both;"></div> |
|
660 | 658 | % endif |
|
661 | 659 | |
|
662 | 660 | </div> |
|
663 | 661 | </div> |
|
664 | 662 | |
|
665 | 663 | ## template for inline comment form |
|
666 | 664 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
667 | 665 | |
|
668 | 666 | ## comments heading with count |
|
669 | 667 | <div class="comments-heading"> |
|
670 | 668 | <i class="icon-comment"></i> |
|
671 | 669 | ${_('Comments')} ${len(c.comments)} |
|
672 | 670 | </div> |
|
673 | 671 | |
|
674 | 672 | ## render general comments |
|
675 | 673 | <div id="comment-tr-show"> |
|
676 | 674 | % if general_outdated_comm_count_ver: |
|
677 | 675 | <div class="info-box"> |
|
678 | 676 | % if general_outdated_comm_count_ver == 1: |
|
679 | 677 | ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)}, |
|
680 | 678 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a> |
|
681 | 679 | % else: |
|
682 | 680 | ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)}, |
|
683 | 681 | <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a> |
|
684 | 682 | % endif |
|
685 | 683 | </div> |
|
686 | 684 | % endif |
|
687 | 685 | </div> |
|
688 | 686 | |
|
689 | 687 | ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)} |
|
690 | 688 | |
|
691 | 689 | % if not c.pull_request.is_closed(): |
|
692 | 690 | ## main comment form and it status |
|
693 | 691 | ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name, |
|
694 | 692 | pull_request_id=c.pull_request.pull_request_id), |
|
695 | 693 | c.pull_request_review_status, |
|
696 | 694 | is_pull_request=True, change_status=c.allowed_to_change_status)} |
|
697 | 695 | |
|
698 | 696 | ## merge status, and merge action |
|
699 | 697 | <div class="pull-request-merge"> |
|
700 | 698 | <%include file="/pullrequests/pullrequest_merge_checks.mako"/> |
|
701 | 699 | </div> |
|
702 | 700 | |
|
703 | 701 | %endif |
|
704 | 702 | |
|
705 | 703 | % endif |
|
706 | 704 | </div> |
|
707 | 705 | |
|
708 | 706 | <script type="text/javascript"> |
|
709 | 707 | |
|
710 | 708 | versionController = new VersionController(); |
|
711 | 709 | versionController.init(); |
|
712 | 710 | |
|
713 | 711 | reviewersController = new ReviewersController(); |
|
714 | 712 | commitsController = new CommitsController(); |
|
715 | 713 | |
|
716 | 714 | updateController = new UpdatePrController(); |
|
717 | 715 | |
|
718 | 716 | $(function () { |
|
719 | 717 | |
|
720 | 718 | // custom code mirror |
|
721 | 719 | var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm; |
|
722 | 720 | |
|
723 | 721 | var PRDetails = { |
|
724 | 722 | editButton: $('#open_edit_pullrequest'), |
|
725 | 723 | closeButton: $('#close_edit_pullrequest'), |
|
726 | 724 | deleteButton: $('#delete_pullrequest'), |
|
727 | 725 | viewFields: $('#pr-desc, #pr-title'), |
|
728 | 726 | editFields: $('#pr-desc-edit, #pr-title-edit, .pr-save'), |
|
729 | 727 | |
|
730 | 728 | init: function () { |
|
731 | 729 | var that = this; |
|
732 | 730 | this.editButton.on('click', function (e) { |
|
733 | 731 | that.edit(); |
|
734 | 732 | }); |
|
735 | 733 | this.closeButton.on('click', function (e) { |
|
736 | 734 | that.view(); |
|
737 | 735 | }); |
|
738 | 736 | }, |
|
739 | 737 | |
|
740 | 738 | edit: function (event) { |
|
741 | 739 | this.viewFields.hide(); |
|
742 | 740 | this.editButton.hide(); |
|
743 | 741 | this.deleteButton.hide(); |
|
744 | 742 | this.closeButton.show(); |
|
745 | 743 | this.editFields.show(); |
|
746 | 744 | codeMirrorInstance.refresh(); |
|
747 | 745 | }, |
|
748 | 746 | |
|
749 | 747 | view: function (event) { |
|
750 | 748 | this.editButton.show(); |
|
751 | 749 | this.deleteButton.show(); |
|
752 | 750 | this.editFields.hide(); |
|
753 | 751 | this.closeButton.hide(); |
|
754 | 752 | this.viewFields.show(); |
|
755 | 753 | } |
|
756 | 754 | }; |
|
757 | 755 | |
|
758 | 756 | var ReviewersPanel = { |
|
759 | 757 | editButton: $('#open_edit_reviewers'), |
|
760 | 758 | closeButton: $('#close_edit_reviewers'), |
|
761 | 759 | addButton: $('#add_reviewer'), |
|
762 | 760 | removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove'), |
|
763 | 761 | |
|
764 | 762 | init: function () { |
|
765 | 763 | var self = this; |
|
766 | 764 | this.editButton.on('click', function (e) { |
|
767 | 765 | self.edit(); |
|
768 | 766 | }); |
|
769 | 767 | this.closeButton.on('click', function (e) { |
|
770 | 768 | self.close(); |
|
771 | 769 | }); |
|
772 | 770 | }, |
|
773 | 771 | |
|
774 | 772 | edit: function (event) { |
|
775 | 773 | this.editButton.hide(); |
|
776 | 774 | this.closeButton.show(); |
|
777 | 775 | this.addButton.show(); |
|
778 | 776 | this.removeButtons.css('visibility', 'visible'); |
|
779 | 777 | // review rules |
|
780 | 778 | reviewersController.loadReviewRules( |
|
781 | 779 | ${c.pull_request.reviewer_data_json | n}); |
|
782 | 780 | }, |
|
783 | 781 | |
|
784 | 782 | close: function (event) { |
|
785 | 783 | this.editButton.show(); |
|
786 | 784 | this.closeButton.hide(); |
|
787 | 785 | this.addButton.hide(); |
|
788 | 786 | this.removeButtons.css('visibility', 'hidden'); |
|
789 | 787 | // hide review rules |
|
790 | 788 | reviewersController.hideReviewRules() |
|
791 | 789 | } |
|
792 | 790 | }; |
|
793 | 791 | |
|
794 | 792 | PRDetails.init(); |
|
795 | 793 | ReviewersPanel.init(); |
|
796 | 794 | |
|
797 | 795 | showOutdated = function (self) { |
|
798 | 796 | $('.comment-inline.comment-outdated').show(); |
|
799 | 797 | $('.filediff-outdated').show(); |
|
800 | 798 | $('.showOutdatedComments').hide(); |
|
801 | 799 | $('.hideOutdatedComments').show(); |
|
802 | 800 | }; |
|
803 | 801 | |
|
804 | 802 | hideOutdated = function (self) { |
|
805 | 803 | $('.comment-inline.comment-outdated').hide(); |
|
806 | 804 | $('.filediff-outdated').hide(); |
|
807 | 805 | $('.hideOutdatedComments').hide(); |
|
808 | 806 | $('.showOutdatedComments').show(); |
|
809 | 807 | }; |
|
810 | 808 | |
|
811 | 809 | refreshMergeChecks = function () { |
|
812 | 810 | var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}"; |
|
813 | 811 | $('.pull-request-merge').css('opacity', 0.3); |
|
814 | 812 | $('.action-buttons-extra').css('opacity', 0.3); |
|
815 | 813 | |
|
816 | 814 | $('.pull-request-merge').load( |
|
817 | 815 | loadUrl, function () { |
|
818 | 816 | $('.pull-request-merge').css('opacity', 1); |
|
819 | 817 | |
|
820 | 818 | $('.action-buttons-extra').css('opacity', 1); |
|
821 | 819 | } |
|
822 | 820 | ); |
|
823 | 821 | }; |
|
824 | 822 | |
|
825 | 823 | closePullRequest = function (status) { |
|
826 | 824 | if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) { |
|
827 | 825 | return false; |
|
828 | 826 | } |
|
829 | 827 | // inject closing flag |
|
830 | 828 | $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">'); |
|
831 | 829 | $(generalCommentForm.statusChange).select2("val", status).trigger('change'); |
|
832 | 830 | $(generalCommentForm.submitForm).submit(); |
|
833 | 831 | }; |
|
834 | 832 | |
|
835 | 833 | $('#show-outdated-comments').on('click', function (e) { |
|
836 | 834 | var button = $(this); |
|
837 | 835 | var outdated = $('.comment-outdated'); |
|
838 | 836 | |
|
839 | 837 | if (button.html() === "(Show)") { |
|
840 | 838 | button.html("(Hide)"); |
|
841 | 839 | outdated.show(); |
|
842 | 840 | } else { |
|
843 | 841 | button.html("(Show)"); |
|
844 | 842 | outdated.hide(); |
|
845 | 843 | } |
|
846 | 844 | }); |
|
847 | 845 | |
|
848 | 846 | $('.show-inline-comments').on('change', function (e) { |
|
849 | 847 | var show = 'none'; |
|
850 | 848 | var target = e.currentTarget; |
|
851 | 849 | if (target.checked) { |
|
852 | 850 | show = '' |
|
853 | 851 | } |
|
854 | 852 | var boxid = $(target).attr('id_for'); |
|
855 | 853 | var comments = $('#{0} .inline-comments'.format(boxid)); |
|
856 | 854 | var fn_display = function (idx) { |
|
857 | 855 | $(this).css('display', show); |
|
858 | 856 | }; |
|
859 | 857 | $(comments).each(fn_display); |
|
860 | 858 | var btns = $('#{0} .inline-comments-button'.format(boxid)); |
|
861 | 859 | $(btns).each(fn_display); |
|
862 | 860 | }); |
|
863 | 861 | |
|
864 | 862 | $('#merge_pull_request_form').submit(function () { |
|
865 | 863 | if (!$('#merge_pull_request').attr('disabled')) { |
|
866 | 864 | $('#merge_pull_request').attr('disabled', 'disabled'); |
|
867 | 865 | } |
|
868 | 866 | return true; |
|
869 | 867 | }); |
|
870 | 868 | |
|
871 | 869 | $('#edit_pull_request').on('click', function (e) { |
|
872 | 870 | var title = $('#pr-title-input').val(); |
|
873 | 871 | var description = codeMirrorInstance.getValue(); |
|
874 | 872 | var renderer = $('#pr-renderer-input').val(); |
|
875 | 873 | editPullRequest( |
|
876 | 874 | "${c.repo_name}", "${c.pull_request.pull_request_id}", |
|
877 | 875 | title, description, renderer); |
|
878 | 876 | }); |
|
879 | 877 | |
|
880 | 878 | $('#update_pull_request').on('click', function (e) { |
|
881 | 879 | $(this).attr('disabled', 'disabled'); |
|
882 | 880 | $(this).addClass('disabled'); |
|
883 | 881 | $(this).html(_gettext('Saving...')); |
|
884 | 882 | reviewersController.updateReviewers( |
|
885 | 883 | "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
886 | 884 | }); |
|
887 | 885 | |
|
888 | 886 | |
|
889 | 887 | // fixing issue with caches on firefox |
|
890 | 888 | $('#update_commits').removeAttr("disabled"); |
|
891 | 889 | |
|
892 | 890 | $('.show-inline-comments').on('click', function (e) { |
|
893 | 891 | var boxid = $(this).attr('data-comment-id'); |
|
894 | 892 | var button = $(this); |
|
895 | 893 | |
|
896 | 894 | if (button.hasClass("comments-visible")) { |
|
897 | 895 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { |
|
898 | 896 | $(this).hide(); |
|
899 | 897 | }); |
|
900 | 898 | button.removeClass("comments-visible"); |
|
901 | 899 | } else { |
|
902 | 900 | $('#{0} .inline-comments'.format(boxid)).each(function (index) { |
|
903 | 901 | $(this).show(); |
|
904 | 902 | }); |
|
905 | 903 | button.addClass("comments-visible"); |
|
906 | 904 | } |
|
907 | 905 | }); |
|
908 | 906 | |
|
909 | 907 | // register submit callback on commentForm form to track TODOs |
|
910 | 908 | window.commentFormGlobalSubmitSuccessCallback = function () { |
|
911 | 909 | refreshMergeChecks(); |
|
912 | 910 | }; |
|
913 | 911 | |
|
914 | 912 | ReviewerAutoComplete('#user'); |
|
915 | 913 | |
|
916 | 914 | }) |
|
917 | 915 | |
|
918 | 916 | </script> |
|
919 | 917 | |
|
920 | 918 | </div> |
|
921 | 919 | |
|
922 | 920 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now