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