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