##// END OF EJS Templates
draft: fixed logic in toggle all draft for submit.
milka -
r4682:a7b110e0 stable
parent child Browse files
Show More
@@ -1,1055 +1,1060 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 <%namespace name="sidebar" file="/base/sidebar.mako"/>
4 <%namespace name="sidebar" file="/base/sidebar.mako"/>
5
5
6
6
7 <%def name="title()">
7 <%def name="title()">
8 ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)}
8 ${_('{} Pull Request !{}').format(c.repo_name, c.pull_request.pull_request_id)}
9 %if c.rhodecode_name:
9 %if c.rhodecode_name:
10 &middot; ${h.branding(c.rhodecode_name)}
10 &middot; ${h.branding(c.rhodecode_name)}
11 %endif
11 %endif
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()">
14 <%def name="breadcrumbs_links()">
15
15
16 </%def>
16 </%def>
17
17
18 <%def name="menu_bar_nav()">
18 <%def name="menu_bar_nav()">
19 ${self.menu_items(active='repositories')}
19 ${self.menu_items(active='repositories')}
20 </%def>
20 </%def>
21
21
22 <%def name="menu_bar_subnav()">
22 <%def name="menu_bar_subnav()">
23 ${self.repo_menu(active='showpullrequest')}
23 ${self.repo_menu(active='showpullrequest')}
24 </%def>
24 </%def>
25
25
26
26
27 <%def name="main()">
27 <%def name="main()">
28 ## Container to gather extracted Tickets
28 ## Container to gather extracted Tickets
29 <%
29 <%
30 c.referenced_commit_issues = h.IssuesRegistry()
30 c.referenced_commit_issues = h.IssuesRegistry()
31 c.referenced_desc_issues = h.IssuesRegistry()
31 c.referenced_desc_issues = h.IssuesRegistry()
32 %>
32 %>
33
33
34 <script type="text/javascript">
34 <script type="text/javascript">
35 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
35 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
36 templateContext.pull_request_data.pull_request_version = '${request.GET.get('version', '')}';
36 templateContext.pull_request_data.pull_request_version = '${request.GET.get('version', '')}';
37 </script>
37 </script>
38
38
39 <div class="box">
39 <div class="box">
40
40
41 <div class="box pr-summary">
41 <div class="box pr-summary">
42
42
43 <div class="summary-details block-left">
43 <div class="summary-details block-left">
44 <div id="pr-title">
44 <div id="pr-title">
45 % if c.pull_request.is_closed():
45 % if c.pull_request.is_closed():
46 <span class="pr-title-closed-tag tag">${_('Closed')}</span>
46 <span class="pr-title-closed-tag tag">${_('Closed')}</span>
47 % endif
47 % endif
48 <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}">
48 <input class="pr-title-input large disabled" disabled="disabled" name="pullrequest_title" type="text" value="${c.pull_request.title}">
49 </div>
49 </div>
50 <div id="pr-title-edit" class="input" style="display: none;">
50 <div id="pr-title-edit" class="input" style="display: none;">
51 <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}">
51 <input class="pr-title-input large" id="pr-title-input" name="pullrequest_title" type="text" value="${c.pull_request.title}">
52 </div>
52 </div>
53
53
54 <% summary = lambda n:{False:'summary-short'}.get(n) %>
54 <% summary = lambda n:{False:'summary-short'}.get(n) %>
55 <div class="pr-details-title">
55 <div class="pr-details-title">
56 <div class="pull-left">
56 <div class="pull-left">
57 <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>
57 <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>
58 ${_('Created on')}
58 ${_('Created on')}
59 <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span>
59 <span class="tooltip" title="${_('Last updated on')} ${h.format_date(c.pull_request.updated_on)}">${h.format_date(c.pull_request.created_on)},</span>
60 <span class="pr-details-title-author-pref">${_('by')}</span>
60 <span class="pr-details-title-author-pref">${_('by')}</span>
61 </div>
61 </div>
62
62
63 <div class="pull-left">
63 <div class="pull-left">
64 ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)}
64 ${self.gravatar_with_user(c.pull_request.author.email, 16, tooltip=True)}
65 </div>
65 </div>
66
66
67 %if c.allowed_to_update:
67 %if c.allowed_to_update:
68 <div class="pull-right">
68 <div class="pull-right">
69 <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div>
69 <div id="edit_pull_request" class="action_button pr-save" style="display: none;">${_('Update title & description')}</div>
70 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
70 <div id="delete_pullrequest" class="action_button pr-save ${('' if c.allowed_to_delete else 'disabled' )}" style="display: none;">
71 % if c.allowed_to_delete:
71 % if c.allowed_to_delete:
72 ${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)}
72 ${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)}
73 <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}"
73 <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}"
74 onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')"
74 onclick="submitConfirm(event, this, _gettext('Confirm to delete this pull request'), _gettext('Delete'), '${'!{}'.format(c.pull_request.pull_request_id)}')"
75 type="submit" value="${_('Delete pull request')}">
75 type="submit" value="${_('Delete pull request')}">
76 ${h.end_form()}
76 ${h.end_form()}
77 % else:
77 % else:
78 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
78 <span class="tooltip" title="${_('Not allowed to delete this pull request')}">${_('Delete pull request')}</span>
79 % endif
79 % endif
80 </div>
80 </div>
81 <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div>
81 <div id="open_edit_pullrequest" class="action_button">${_('Edit')}</div>
82 <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div>
82 <div id="close_edit_pullrequest" class="action_button" style="display: none;">${_('Cancel')}</div>
83 </div>
83 </div>
84
84
85 %endif
85 %endif
86 </div>
86 </div>
87
87
88 <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}">
88 <div id="pr-desc" class="input" title="${_('Rendered using {} renderer').format(c.renderer)}">
89 ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name, issues_container_callback=c.referenced_desc_issues())}
89 ${h.render(c.pull_request.description, renderer=c.renderer, repo_name=c.repo_name, issues_container_callback=c.referenced_desc_issues())}
90 </div>
90 </div>
91
91
92 <div id="pr-desc-edit" class="input textarea" style="display: none;">
92 <div id="pr-desc-edit" class="input textarea" style="display: none;">
93 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
93 <input id="pr-renderer-input" type="hidden" name="description_renderer" value="${c.visual.default_renderer}">
94 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
94 ${dt.markup_form('pr-description-input', form_text=c.pull_request.description)}
95 </div>
95 </div>
96
96
97 <div id="summary" class="fields pr-details-content">
97 <div id="summary" class="fields pr-details-content">
98
98
99 ## source
99 ## source
100 <div class="field">
100 <div class="field">
101 <div class="label-pr-detail">
101 <div class="label-pr-detail">
102 <label>${_('Commit flow')}:</label>
102 <label>${_('Commit flow')}:</label>
103 </div>
103 </div>
104 <div class="input">
104 <div class="input">
105 <div class="pr-commit-flow">
105 <div class="pr-commit-flow">
106 ## Source
106 ## Source
107 %if c.pull_request.source_ref_parts.type == 'branch':
107 %if c.pull_request.source_ref_parts.type == 'branch':
108 <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>
108 <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>
109 %else:
109 %else:
110 <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code>
110 <code class="pr-source-info">${'{}:{}'.format(c.pull_request.source_ref_parts.type, c.pull_request.source_ref_parts.name)}</code>
111 %endif
111 %endif
112 ${_('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>
112 ${_('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>
113 &rarr;
113 &rarr;
114 ## Target
114 ## Target
115 %if c.pull_request.target_ref_parts.type == 'branch':
115 %if c.pull_request.target_ref_parts.type == 'branch':
116 <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>
116 <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>
117 %else:
117 %else:
118 <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code>
118 <code class="pr-target-info">${'{}:{}'.format(c.pull_request.target_ref_parts.type, c.pull_request.target_ref_parts.name)}</code>
119 %endif
119 %endif
120
120
121 ${_('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>
121 ${_('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>
122
122
123 <a class="source-details-action" href="#expand-source-details" onclick="return 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>'>
123 <a class="source-details-action" href="#expand-source-details" onclick="return 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>'>
124 <i class="icon-angle-down">more details</i>
124 <i class="icon-angle-down">more details</i>
125 </a>
125 </a>
126
126
127 </div>
127 </div>
128
128
129 <div class="source-details" style="display: none">
129 <div class="source-details" style="display: none">
130
130
131 <ul>
131 <ul>
132
132
133 ## common ancestor
133 ## common ancestor
134 <li>
134 <li>
135 ${_('Common ancestor')}:
135 ${_('Common ancestor')}:
136 % if c.ancestor_commit:
136 % if c.ancestor_commit:
137 <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>
137 <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>
138 % else:
138 % else:
139 ${_('not available')}
139 ${_('not available')}
140 % endif
140 % endif
141 </li>
141 </li>
142
142
143 ## pull url
143 ## pull url
144 <li>
144 <li>
145 %if h.is_hg(c.pull_request.source_repo):
145 %if h.is_hg(c.pull_request.source_repo):
146 <% clone_url = u'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
146 <% clone_url = u'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
147 %elif h.is_git(c.pull_request.source_repo):
147 %elif h.is_git(c.pull_request.source_repo):
148 <% clone_url = u'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
148 <% clone_url = u'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
149 %endif
149 %endif
150
150
151 <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
151 <span>${_('Pull changes from source')}</span>: <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
152 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
152 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
153 </li>
153 </li>
154
154
155 ## Shadow repo
155 ## Shadow repo
156 <li>
156 <li>
157 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
157 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
158 %if h.is_hg(c.pull_request.target_repo):
158 %if h.is_hg(c.pull_request.target_repo):
159 <% 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) %>
159 <% 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) %>
160 %elif h.is_git(c.pull_request.target_repo):
160 %elif h.is_git(c.pull_request.target_repo):
161 <% 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) %>
161 <% 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) %>
162 %endif
162 %endif
163
163
164 <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">
164 <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">
165 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
165 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
166
166
167 % else:
167 % else:
168 <div class="">
168 <div class="">
169 ${_('Shadow repository data not available')}.
169 ${_('Shadow repository data not available')}.
170 </div>
170 </div>
171 % endif
171 % endif
172 </li>
172 </li>
173
173
174 </ul>
174 </ul>
175
175
176 </div>
176 </div>
177
177
178 </div>
178 </div>
179
179
180 </div>
180 </div>
181
181
182 ## versions
182 ## versions
183 <div class="field">
183 <div class="field">
184 <div class="label-pr-detail">
184 <div class="label-pr-detail">
185 <label>${_('Versions')}:</label>
185 <label>${_('Versions')}:</label>
186 </div>
186 </div>
187
187
188 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
188 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
189 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
189 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
190
190
191 <div class="pr-versions">
191 <div class="pr-versions">
192 % if c.show_version_changes:
192 % if c.show_version_changes:
193 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
193 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
194 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
194 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
195 ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))}
195 ${_ungettext('{} version available for this pull request, ', '{} versions available for this pull request, ', len(c.versions)).format(len(c.versions))}
196 <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
196 <a id="show-pr-versions" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
197 data-toggle-on="${_('show versions')}."
197 data-toggle-on="${_('show versions')}."
198 data-toggle-off="${_('hide versions')}.">
198 data-toggle-off="${_('hide versions')}.">
199 ${_('show versions')}.
199 ${_('show versions')}.
200 </a>
200 </a>
201 <table>
201 <table>
202 ## SHOW ALL VERSIONS OF PR
202 ## SHOW ALL VERSIONS OF PR
203 <% ver_pr = None %>
203 <% ver_pr = None %>
204
204
205 % for data in reversed(list(enumerate(c.versions, 1))):
205 % for data in reversed(list(enumerate(c.versions, 1))):
206 <% ver_pos = data[0] %>
206 <% ver_pos = data[0] %>
207 <% ver = data[1] %>
207 <% ver = data[1] %>
208 <% ver_pr = ver.pull_request_version_id %>
208 <% ver_pr = ver.pull_request_version_id %>
209 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
209 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
210
210
211 <tr class="version-pr" style="display: ${display_row}">
211 <tr class="version-pr" style="display: ${display_row}">
212 <td>
212 <td>
213 <code>
213 <code>
214 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
214 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
215 </code>
215 </code>
216 </td>
216 </td>
217 <td>
217 <td>
218 <input ${('checked="checked"' if c.from_version_index == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
218 <input ${('checked="checked"' if c.from_version_index == ver_pr else '')} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
219 <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}"/>
219 <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}"/>
220 </td>
220 </td>
221 <td>
221 <td>
222 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
222 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
223 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
223 <i class="tooltip icon-circle review-status-${review_status}" title="${_('Your review status at this version')}"></i>
224
224
225 </td>
225 </td>
226 <td>
226 <td>
227 % if c.at_version_num != ver_pr:
227 % if c.at_version_num != ver_pr:
228 <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i>
228 <i class="tooltip icon-comment" title="${_('Comments from pull request version v{0}').format(ver_pos)}"></i>
229 <code>
229 <code>
230 General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])}
230 General:${len(c.comment_versions[ver_pr]['at'])} / Inline:${len(c.inline_versions[ver_pr]['at'])}
231 </code>
231 </code>
232 % endif
232 % endif
233 </td>
233 </td>
234 <td>
234 <td>
235 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
235 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
236 </td>
236 </td>
237 <td>
237 <td>
238 <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code>
238 <code>${h.age_component(ver.updated_on, time_is_local=True, tooltip=False)}</code>
239 </td>
239 </td>
240 </tr>
240 </tr>
241 % endfor
241 % endfor
242
242
243 <tr>
243 <tr>
244 <td colspan="6">
244 <td colspan="6">
245 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
245 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
246 data-label-text-locked="${_('select versions to show changes')}"
246 data-label-text-locked="${_('select versions to show changes')}"
247 data-label-text-diff="${_('show changes between versions')}"
247 data-label-text-diff="${_('show changes between versions')}"
248 data-label-text-show="${_('show pull request for this version')}"
248 data-label-text-show="${_('show pull request for this version')}"
249 >
249 >
250 ${_('select versions to show changes')}
250 ${_('select versions to show changes')}
251 </button>
251 </button>
252 </td>
252 </td>
253 </tr>
253 </tr>
254 </table>
254 </table>
255 % else:
255 % else:
256 <div>
256 <div>
257 ${_('Pull request versions not available')}.
257 ${_('Pull request versions not available')}.
258 </div>
258 </div>
259 % endif
259 % endif
260 </div>
260 </div>
261 </div>
261 </div>
262
262
263 </div>
263 </div>
264
264
265 </div>
265 </div>
266
266
267
267
268 </div>
268 </div>
269
269
270 </div>
270 </div>
271
271
272 <div class="box">
272 <div class="box">
273
273
274 % if c.state_progressing:
274 % if c.state_progressing:
275
275
276 <h2 style="text-align: center">
276 <h2 style="text-align: center">
277 ${_('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>
277 ${_('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>
278
278
279 % if c.is_super_admin:
279 % if c.is_super_admin:
280 <br/>
280 <br/>
281 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.
281 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.
282 % endif
282 % endif
283 </h2>
283 </h2>
284
284
285 % else:
285 % else:
286
286
287 ## Diffs rendered here
287 ## Diffs rendered here
288 <div class="table" >
288 <div class="table" >
289 <div id="changeset_compare_view_content">
289 <div id="changeset_compare_view_content">
290 ##CS
290 ##CS
291 % if c.missing_requirements:
291 % if c.missing_requirements:
292 <div class="box">
292 <div class="box">
293 <div class="alert alert-warning">
293 <div class="alert alert-warning">
294 <div>
294 <div>
295 <strong>${_('Missing requirements:')}</strong>
295 <strong>${_('Missing requirements:')}</strong>
296 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
296 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
297 </div>
297 </div>
298 </div>
298 </div>
299 </div>
299 </div>
300 % elif c.missing_commits:
300 % elif c.missing_commits:
301 <div class="box">
301 <div class="box">
302 <div class="alert alert-warning">
302 <div class="alert alert-warning">
303 <div>
303 <div>
304 <strong>${_('Missing commits')}:</strong>
304 <strong>${_('Missing commits')}:</strong>
305 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}<br/>
305 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}<br/>
306 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}<br/>
306 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}<br/>
307 ${_('Consider doing a `force update commits` in case you think this is an error.')}
307 ${_('Consider doing a `force update commits` in case you think this is an error.')}
308 </div>
308 </div>
309 </div>
309 </div>
310 </div>
310 </div>
311 % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed():
311 % elif c.pr_merge_source_commit.changed and not c.pull_request.is_closed():
312 <div class="box">
312 <div class="box">
313 <div class="alert alert-info">
313 <div class="alert alert-info">
314 <div>
314 <div>
315 <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>
315 <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>
316 </div>
316 </div>
317 </div>
317 </div>
318 </div>
318 </div>
319 % endif
319 % endif
320
320
321 <div class="compare_view_commits_title">
321 <div class="compare_view_commits_title">
322 % if not c.compare_mode:
322 % if not c.compare_mode:
323
323
324 % if c.at_version_index:
324 % if c.at_version_index:
325 <h4>
325 <h4>
326 ${_('Showing changes at v{}, commenting is disabled.').format(c.at_version_index)}
326 ${_('Showing changes at v{}, commenting is disabled.').format(c.at_version_index)}
327 </h4>
327 </h4>
328 % endif
328 % endif
329
329
330 <div class="pull-left">
330 <div class="pull-left">
331 <div class="btn-group">
331 <div class="btn-group">
332 <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)} >
332 <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)} >
333 % if c.collapse_all_commits:
333 % if c.collapse_all_commits:
334 <i class="icon-plus-squared-alt icon-no-margin"></i>
334 <i class="icon-plus-squared-alt icon-no-margin"></i>
335 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
335 ${_ungettext('Expand {} commit', 'Expand {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
336 % else:
336 % else:
337 <i class="icon-minus-squared-alt icon-no-margin"></i>
337 <i class="icon-minus-squared-alt icon-no-margin"></i>
338 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
338 ${_ungettext('Collapse {} commit', 'Collapse {} commits', len(c.commit_ranges)).format(len(c.commit_ranges))}
339 % endif
339 % endif
340 </a>
340 </a>
341 </div>
341 </div>
342 </div>
342 </div>
343
343
344 <div class="pull-right">
344 <div class="pull-right">
345 % if c.allowed_to_update and not c.pull_request.is_closed():
345 % if c.allowed_to_update and not c.pull_request.is_closed():
346
346
347 <div class="btn-group btn-group-actions">
347 <div class="btn-group btn-group-actions">
348 <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false">
348 <a id="update_commits" class="btn btn-primary no-margin" onclick="updateController.updateCommits(this); return false">
349 ${_('Update commits')}
349 ${_('Update commits')}
350 </a>
350 </a>
351
351
352 <a id="update_commits_switcher" class="tooltip btn btn-primary btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}">
352 <a id="update_commits_switcher" class="tooltip btn btn-primary btn-more-option" data-toggle="dropdown" aria-pressed="false" role="button" title="${_('more update options')}">
353 <i class="icon-down"></i>
353 <i class="icon-down"></i>
354 </a>
354 </a>
355
355
356 <div class="btn-action-switcher-container right-align" id="update-commits-switcher">
356 <div class="btn-action-switcher-container right-align" id="update-commits-switcher">
357 <ul class="btn-action-switcher" role="menu" style="min-width: 300px;">
357 <ul class="btn-action-switcher" role="menu" style="min-width: 300px;">
358 <li>
358 <li>
359 <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false">
359 <a href="#forceUpdate" onclick="updateController.forceUpdateCommits(this); return false">
360 ${_('Force update commits')}
360 ${_('Force update commits')}
361 </a>
361 </a>
362 <div class="action-help-block">
362 <div class="action-help-block">
363 ${_('Update commits and force refresh this pull request.')}
363 ${_('Update commits and force refresh this pull request.')}
364 </div>
364 </div>
365 </li>
365 </li>
366 </ul>
366 </ul>
367 </div>
367 </div>
368 </div>
368 </div>
369
369
370 % else:
370 % else:
371 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
371 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
372 % endif
372 % endif
373
373
374 </div>
374 </div>
375 % endif
375 % endif
376 </div>
376 </div>
377
377
378 % if not c.missing_commits:
378 % if not c.missing_commits:
379 ## COMPARE RANGE DIFF MODE
379 ## COMPARE RANGE DIFF MODE
380 % if c.compare_mode:
380 % if c.compare_mode:
381 % if c.at_version:
381 % if c.at_version:
382 <h4>
382 <h4>
383 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_index, ver_to=c.at_version_index if c.at_version_index else 'latest')}:
383 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_index, ver_to=c.at_version_index if c.at_version_index else 'latest')}:
384 </h4>
384 </h4>
385
385
386 <div class="subtitle-compare">
386 <div class="subtitle-compare">
387 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
387 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
388 </div>
388 </div>
389
389
390 <div class="container">
390 <div class="container">
391 <table class="rctable compare_view_commits">
391 <table class="rctable compare_view_commits">
392 <tr>
392 <tr>
393 <th></th>
393 <th></th>
394 <th>${_('Time')}</th>
394 <th>${_('Time')}</th>
395 <th>${_('Author')}</th>
395 <th>${_('Author')}</th>
396 <th>${_('Commit')}</th>
396 <th>${_('Commit')}</th>
397 <th></th>
397 <th></th>
398 <th>${_('Description')}</th>
398 <th>${_('Description')}</th>
399 </tr>
399 </tr>
400
400
401 % for c_type, commit in c.commit_changes:
401 % for c_type, commit in c.commit_changes:
402 % if c_type in ['a', 'r']:
402 % if c_type in ['a', 'r']:
403 <%
403 <%
404 if c_type == 'a':
404 if c_type == 'a':
405 cc_title = _('Commit added in displayed changes')
405 cc_title = _('Commit added in displayed changes')
406 elif c_type == 'r':
406 elif c_type == 'r':
407 cc_title = _('Commit removed in displayed changes')
407 cc_title = _('Commit removed in displayed changes')
408 else:
408 else:
409 cc_title = ''
409 cc_title = ''
410 %>
410 %>
411 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
411 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
412 <td>
412 <td>
413 <div class="commit-change-indicator color-${c_type}-border">
413 <div class="commit-change-indicator color-${c_type}-border">
414 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
414 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
415 ${c_type.upper()}
415 ${c_type.upper()}
416 </div>
416 </div>
417 </div>
417 </div>
418 </td>
418 </td>
419 <td class="td-time">
419 <td class="td-time">
420 ${h.age_component(commit.date)}
420 ${h.age_component(commit.date)}
421 </td>
421 </td>
422 <td class="td-user">
422 <td class="td-user">
423 ${base.gravatar_with_user(commit.author, 16, tooltip=True)}
423 ${base.gravatar_with_user(commit.author, 16, tooltip=True)}
424 </td>
424 </td>
425 <td class="td-hash">
425 <td class="td-hash">
426 <code>
426 <code>
427 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
427 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
428 r${commit.idx}:${h.short_id(commit.raw_id)}
428 r${commit.idx}:${h.short_id(commit.raw_id)}
429 </a>
429 </a>
430 ${h.hidden('revisions', commit.raw_id)}
430 ${h.hidden('revisions', commit.raw_id)}
431 </code>
431 </code>
432 </td>
432 </td>
433 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
433 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
434 <i class="icon-expand-linked"></i>
434 <i class="icon-expand-linked"></i>
435 </td>
435 </td>
436 <td class="mid td-description">
436 <td class="mid td-description">
437 <div class="log-container truncate-wrap">
437 <div class="log-container truncate-wrap">
438 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name, issues_container_callback=c.referenced_commit_issues(commit.serialize()))}</div>
438 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">${h.urlify_commit_message(commit.message, c.repo_name, issues_container_callback=c.referenced_commit_issues(commit.serialize()))}</div>
439 </div>
439 </div>
440 </td>
440 </td>
441 </tr>
441 </tr>
442 % endif
442 % endif
443 % endfor
443 % endfor
444 </table>
444 </table>
445 </div>
445 </div>
446
446
447 % endif
447 % endif
448
448
449 ## Regular DIFF
449 ## Regular DIFF
450 % else:
450 % else:
451 <%include file="/compare/compare_commits.mako" />
451 <%include file="/compare/compare_commits.mako" />
452 % endif
452 % endif
453
453
454 <div class="cs_files">
454 <div class="cs_files">
455 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
455 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
456
456
457 <%
457 <%
458 pr_menu_data = {
458 pr_menu_data = {
459 'outdated_comm_count_ver': outdated_comm_count_ver,
459 'outdated_comm_count_ver': outdated_comm_count_ver,
460 'pull_request': c.pull_request
460 'pull_request': c.pull_request
461 }
461 }
462 %>
462 %>
463
463
464 ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on, pull_request_menu=pr_menu_data)}
464 ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on, pull_request_menu=pr_menu_data)}
465
465
466 % if c.range_diff_on:
466 % if c.range_diff_on:
467 % for commit in c.commit_ranges:
467 % for commit in c.commit_ranges:
468 ${cbdiffs.render_diffset(
468 ${cbdiffs.render_diffset(
469 c.changes[commit.raw_id],
469 c.changes[commit.raw_id],
470 commit=commit, use_comments=True,
470 commit=commit, use_comments=True,
471 collapse_when_files_over=5,
471 collapse_when_files_over=5,
472 disable_new_comments=True,
472 disable_new_comments=True,
473 deleted_files_comments=c.deleted_files_comments,
473 deleted_files_comments=c.deleted_files_comments,
474 inline_comments=c.inline_comments,
474 inline_comments=c.inline_comments,
475 pull_request_menu=pr_menu_data, show_todos=False)}
475 pull_request_menu=pr_menu_data, show_todos=False)}
476 % endfor
476 % endfor
477 % else:
477 % else:
478 ${cbdiffs.render_diffset(
478 ${cbdiffs.render_diffset(
479 c.diffset, use_comments=True,
479 c.diffset, use_comments=True,
480 collapse_when_files_over=30,
480 collapse_when_files_over=30,
481 disable_new_comments=not c.allowed_to_comment,
481 disable_new_comments=not c.allowed_to_comment,
482 deleted_files_comments=c.deleted_files_comments,
482 deleted_files_comments=c.deleted_files_comments,
483 inline_comments=c.inline_comments,
483 inline_comments=c.inline_comments,
484 pull_request_menu=pr_menu_data, show_todos=False)}
484 pull_request_menu=pr_menu_data, show_todos=False)}
485 % endif
485 % endif
486
486
487 </div>
487 </div>
488 % else:
488 % else:
489 ## skipping commits we need to clear the view for missing commits
489 ## skipping commits we need to clear the view for missing commits
490 <div style="clear:both;"></div>
490 <div style="clear:both;"></div>
491 % endif
491 % endif
492
492
493 </div>
493 </div>
494 </div>
494 </div>
495
495
496 ## template for inline comment form
496 ## template for inline comment form
497 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
497 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
498
498
499 ## comments heading with count
499 ## comments heading with count
500 <div class="comments-heading">
500 <div class="comments-heading">
501 <i class="icon-comment"></i>
501 <i class="icon-comment"></i>
502 ${_('General Comments')} ${len(c.comments)}
502 ${_('General Comments')} ${len(c.comments)}
503 </div>
503 </div>
504
504
505 ## render general comments
505 ## render general comments
506 <div id="comment-tr-show">
506 <div id="comment-tr-show">
507 % if general_outdated_comm_count_ver:
507 % if general_outdated_comm_count_ver:
508 <div class="info-box">
508 <div class="info-box">
509 % if general_outdated_comm_count_ver == 1:
509 % if general_outdated_comm_count_ver == 1:
510 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
510 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
511 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
511 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
512 % else:
512 % else:
513 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
513 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
514 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
514 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
515 % endif
515 % endif
516 </div>
516 </div>
517 % endif
517 % endif
518 </div>
518 </div>
519
519
520 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
520 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
521
521
522 % if not c.pull_request.is_closed():
522 % if not c.pull_request.is_closed():
523 ## main comment form and it status
523 ## main comment form and it status
524 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
524 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
525 pull_request_id=c.pull_request.pull_request_id),
525 pull_request_id=c.pull_request.pull_request_id),
526 c.pull_request_review_status,
526 c.pull_request_review_status,
527 is_pull_request=True, change_status=c.allowed_to_change_status)}
527 is_pull_request=True, change_status=c.allowed_to_change_status)}
528
528
529 ## merge status, and merge action
529 ## merge status, and merge action
530 <div class="pull-request-merge">
530 <div class="pull-request-merge">
531 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
531 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
532 </div>
532 </div>
533
533
534 %endif
534 %endif
535
535
536 % endif
536 % endif
537 </div>
537 </div>
538
538
539
539
540 ### NAV SIDEBAR
540 ### NAV SIDEBAR
541 <aside class="right-sidebar right-sidebar-expanded" id="pr-nav-sticky" style="display: none">
541 <aside class="right-sidebar right-sidebar-expanded" id="pr-nav-sticky" style="display: none">
542 <div class="sidenav navbar__inner" >
542 <div class="sidenav navbar__inner" >
543 ## TOGGLE
543 ## TOGGLE
544 <div class="sidebar-toggle" onclick="toggleSidebar(); return false">
544 <div class="sidebar-toggle" onclick="toggleSidebar(); return false">
545 <a href="#toggleSidebar" class="grey-link-action">
545 <a href="#toggleSidebar" class="grey-link-action">
546
546
547 </a>
547 </a>
548 </div>
548 </div>
549
549
550 ## CONTENT
550 ## CONTENT
551 <div class="sidebar-content">
551 <div class="sidebar-content">
552
552
553 ## Drafts
553 ## Drafts
554 % if c.rhodecode_edition_id == 'EE':
554 % if c.rhodecode_edition_id == 'EE':
555 <div id="draftsTable" class="sidebar-element clear-both" style="display: ${'block' if c.draft_comments else 'none'}">
555 <div id="draftsTable" class="sidebar-element clear-both" style="display: ${'block' if c.draft_comments else 'none'}">
556 <div class="tooltip right-sidebar-collapsed-state" style="display: none;" onclick="toggleSidebar(); return false" title="${_('Drafts')}">
556 <div class="tooltip right-sidebar-collapsed-state" style="display: none;" onclick="toggleSidebar(); return false" title="${_('Drafts')}">
557 <i class="icon-comment icon-draft"></i>
557 <i class="icon-comment icon-draft"></i>
558 <span id="drafts-count">${len(c.draft_comments)}</span>
558 <span id="drafts-count">${len(c.draft_comments)}</span>
559 </div>
559 </div>
560
560
561 <div class="right-sidebar-expanded-state pr-details-title">
561 <div class="right-sidebar-expanded-state pr-details-title">
562 <span style="padding-left: 2px">
562 <span style="padding-left: 2px">
563 <input name="select_all_drafts" type="checkbox" onclick="$('[name=submit_draft]').prop('checked', !$('[name=submit_draft]').prop('checked'))">
563 <input name="select_all_drafts" type="checkbox" onclick="selectDraftComments(event)">
564 </span>
564 </span>
565 <span class="sidebar-heading noselect" onclick="refreshDraftComments(); return false">
565 <span class="sidebar-heading noselect" onclick="refreshDraftComments(); return false">
566 <i class="icon-comment icon-draft"></i>
566 <i class="icon-comment icon-draft"></i>
567 ${_('Drafts')}
567 ${_('Drafts')}
568 </span>
568 </span>
569 <span class="block-right action_button last-item" onclick="submitDrafts(event)">${_('Submit')}</span>
569 <span class="block-right action_button last-item" onclick="submitDrafts(event)">${_('Submit')}</span>
570 </div>
570 </div>
571
571
572 <div id="drafts" class="right-sidebar-expanded-state pr-details-content reviewers">
572 <div id="drafts" class="right-sidebar-expanded-state pr-details-content reviewers">
573 % if c.draft_comments:
573 % if c.draft_comments:
574 ${sidebar.comments_table(c.draft_comments, len(c.draft_comments), draft_comments=True)}
574 ${sidebar.comments_table(c.draft_comments, len(c.draft_comments), draft_comments=True)}
575 % else:
575 % else:
576 <table class="drafts-content-table">
576 <table class="drafts-content-table">
577 <tr>
577 <tr>
578 <td>
578 <td>
579 ${_('No TODOs yet')}
579 ${_('No TODOs yet')}
580 </td>
580 </td>
581 </tr>
581 </tr>
582 </table>
582 </table>
583 % endif
583 % endif
584 </div>
584 </div>
585
585
586 </div>
586 </div>
587 % endif
587 % endif
588
588
589 ## RULES SUMMARY/RULES
589 ## RULES SUMMARY/RULES
590 <div class="sidebar-element clear-both">
590 <div class="sidebar-element clear-both">
591 <% vote_title = _ungettext(
591 <% vote_title = _ungettext(
592 'Status calculated based on votes from {} reviewer',
592 'Status calculated based on votes from {} reviewer',
593 'Status calculated based on votes from {} reviewers', c.reviewers_count).format(c.reviewers_count)
593 'Status calculated based on votes from {} reviewers', c.reviewers_count).format(c.reviewers_count)
594 %>
594 %>
595
595
596 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
596 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
597 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
597 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
598 ${c.reviewers_count}
598 ${c.reviewers_count}
599 </div>
599 </div>
600
600
601 ## REVIEWERS
601 ## REVIEWERS
602 <div class="right-sidebar-expanded-state pr-details-title">
602 <div class="right-sidebar-expanded-state pr-details-title">
603 <span class="tooltip sidebar-heading" title="${vote_title}">
603 <span class="tooltip sidebar-heading" title="${vote_title}">
604 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
604 <i class="icon-circle review-status-${c.pull_request_review_status}"></i>
605 ${_('Reviewers')}
605 ${_('Reviewers')}
606 </span>
606 </span>
607
607
608 %if c.allowed_to_update:
608 %if c.allowed_to_update:
609 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
609 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
610 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
610 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
611 %else:
611 %else:
612 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Show rules')}</span>
612 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Show rules')}</span>
613 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
613 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
614 %endif
614 %endif
615 </div>
615 </div>
616
616
617 <div id="reviewers" class="right-sidebar-expanded-state pr-details-content reviewers">
617 <div id="reviewers" class="right-sidebar-expanded-state pr-details-content reviewers">
618
618
619 <div id="review_rules" style="display: none" class="">
619 <div id="review_rules" style="display: none" class="">
620
620
621 <strong>${_('Reviewer rules')}</strong>
621 <strong>${_('Reviewer rules')}</strong>
622 <div class="pr-reviewer-rules">
622 <div class="pr-reviewer-rules">
623 ## review rules will be appended here, by default reviewers logic
623 ## review rules will be appended here, by default reviewers logic
624 </div>
624 </div>
625 <input id="review_data" type="hidden" name="review_data" value="">
625 <input id="review_data" type="hidden" name="review_data" value="">
626 </div>
626 </div>
627
627
628 ## members redering block
628 ## members redering block
629 <input type="hidden" name="__start__" value="review_members:sequence">
629 <input type="hidden" name="__start__" value="review_members:sequence">
630
630
631 <table id="review_members" class="group_members">
631 <table id="review_members" class="group_members">
632 ## This content is loaded via JS and ReviewersPanel
632 ## This content is loaded via JS and ReviewersPanel
633 </table>
633 </table>
634
634
635 <input type="hidden" name="__end__" value="review_members:sequence">
635 <input type="hidden" name="__end__" value="review_members:sequence">
636 ## end members redering block
636 ## end members redering block
637
637
638 %if not c.pull_request.is_closed():
638 %if not c.pull_request.is_closed():
639 <div id="add_reviewer" class="ac" style="display: none;">
639 <div id="add_reviewer" class="ac" style="display: none;">
640 %if c.allowed_to_update:
640 %if c.allowed_to_update:
641 % if not c.forbid_adding_reviewers:
641 % if not c.forbid_adding_reviewers:
642 <div id="add_reviewer_input" class="reviewer_ac" style="width: 240px">
642 <div id="add_reviewer_input" class="reviewer_ac" style="width: 240px">
643 <input class="ac-input" id="user" name="user" placeholder="${_('Add reviewer or reviewer group')}" type="text" autocomplete="off">
643 <input class="ac-input" id="user" name="user" placeholder="${_('Add reviewer or reviewer group')}" type="text" autocomplete="off">
644 <div id="reviewers_container"></div>
644 <div id="reviewers_container"></div>
645 </div>
645 </div>
646 % endif
646 % endif
647 <div class="pull-right" style="margin-bottom: 15px">
647 <div class="pull-right" style="margin-bottom: 15px">
648 <button data-role="reviewer" id="update_reviewers" class="btn btn-sm no-margin">${_('Save Changes')}</button>
648 <button data-role="reviewer" id="update_reviewers" class="btn btn-sm no-margin">${_('Save Changes')}</button>
649 </div>
649 </div>
650 %endif
650 %endif
651 </div>
651 </div>
652 %endif
652 %endif
653 </div>
653 </div>
654 </div>
654 </div>
655
655
656 ## OBSERVERS
656 ## OBSERVERS
657 % if c.rhodecode_edition_id == 'EE':
657 % if c.rhodecode_edition_id == 'EE':
658 <div class="sidebar-element clear-both">
658 <div class="sidebar-element clear-both">
659 <% vote_title = _ungettext(
659 <% vote_title = _ungettext(
660 '{} observer without voting right.',
660 '{} observer without voting right.',
661 '{} observers without voting right.', c.observers_count).format(c.observers_count)
661 '{} observers without voting right.', c.observers_count).format(c.observers_count)
662 %>
662 %>
663
663
664 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
664 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${vote_title}">
665 <i class="icon-circle-thin"></i>
665 <i class="icon-circle-thin"></i>
666 ${c.observers_count}
666 ${c.observers_count}
667 </div>
667 </div>
668
668
669 <div class="right-sidebar-expanded-state pr-details-title">
669 <div class="right-sidebar-expanded-state pr-details-title">
670 <span class="tooltip sidebar-heading" title="${vote_title}">
670 <span class="tooltip sidebar-heading" title="${vote_title}">
671 <i class="icon-circle-thin"></i>
671 <i class="icon-circle-thin"></i>
672 ${_('Observers')}
672 ${_('Observers')}
673 </span>
673 </span>
674 %if c.allowed_to_update:
674 %if c.allowed_to_update:
675 <span id="open_edit_observers" class="block-right action_button last-item">${_('Edit')}</span>
675 <span id="open_edit_observers" class="block-right action_button last-item">${_('Edit')}</span>
676 <span id="close_edit_observers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
676 <span id="close_edit_observers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
677 %endif
677 %endif
678 </div>
678 </div>
679
679
680 <div id="observers" class="right-sidebar-expanded-state pr-details-content reviewers">
680 <div id="observers" class="right-sidebar-expanded-state pr-details-content reviewers">
681 ## members redering block
681 ## members redering block
682 <input type="hidden" name="__start__" value="observer_members:sequence">
682 <input type="hidden" name="__start__" value="observer_members:sequence">
683
683
684 <table id="observer_members" class="group_members">
684 <table id="observer_members" class="group_members">
685 ## This content is loaded via JS and ReviewersPanel
685 ## This content is loaded via JS and ReviewersPanel
686 </table>
686 </table>
687
687
688 <input type="hidden" name="__end__" value="observer_members:sequence">
688 <input type="hidden" name="__end__" value="observer_members:sequence">
689 ## end members redering block
689 ## end members redering block
690
690
691 %if not c.pull_request.is_closed():
691 %if not c.pull_request.is_closed():
692 <div id="add_observer" class="ac" style="display: none;">
692 <div id="add_observer" class="ac" style="display: none;">
693 %if c.allowed_to_update:
693 %if c.allowed_to_update:
694 % if not c.forbid_adding_reviewers or 1:
694 % if not c.forbid_adding_reviewers or 1:
695 <div id="add_reviewer_input" class="reviewer_ac" style="width: 240px" >
695 <div id="add_reviewer_input" class="reviewer_ac" style="width: 240px" >
696 <input class="ac-input" id="observer" name="observer" placeholder="${_('Add observer or observer group')}" type="text" autocomplete="off">
696 <input class="ac-input" id="observer" name="observer" placeholder="${_('Add observer or observer group')}" type="text" autocomplete="off">
697 <div id="observers_container"></div>
697 <div id="observers_container"></div>
698 </div>
698 </div>
699 % endif
699 % endif
700 <div class="pull-right" style="margin-bottom: 15px">
700 <div class="pull-right" style="margin-bottom: 15px">
701 <button data-role="observer" id="update_observers" class="btn btn-sm no-margin">${_('Save Changes')}</button>
701 <button data-role="observer" id="update_observers" class="btn btn-sm no-margin">${_('Save Changes')}</button>
702 </div>
702 </div>
703 %endif
703 %endif
704 </div>
704 </div>
705 %endif
705 %endif
706 </div>
706 </div>
707 </div>
707 </div>
708 % endif
708 % endif
709
709
710 ## TODOs
710 ## TODOs
711 <div id="todosTable" class="sidebar-element clear-both">
711 <div id="todosTable" class="sidebar-element clear-both">
712 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="TODOs">
712 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="TODOs">
713 <i class="icon-flag-filled"></i>
713 <i class="icon-flag-filled"></i>
714 <span id="todos-count">${len(c.unresolved_comments)}</span>
714 <span id="todos-count">${len(c.unresolved_comments)}</span>
715 </div>
715 </div>
716
716
717 <div class="right-sidebar-expanded-state pr-details-title">
717 <div class="right-sidebar-expanded-state pr-details-title">
718 ## Only show unresolved, that is only what matters
718 ## Only show unresolved, that is only what matters
719 <span class="sidebar-heading noselect" onclick="refreshTODOs(); return false">
719 <span class="sidebar-heading noselect" onclick="refreshTODOs(); return false">
720 <i class="icon-flag-filled"></i>
720 <i class="icon-flag-filled"></i>
721 TODOs
721 TODOs
722 </span>
722 </span>
723
723
724 % if not c.at_version:
724 % if not c.at_version:
725 % if c.resolved_comments:
725 % if c.resolved_comments:
726 <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return toggleElement(this, '.resolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span>
726 <span class="block-right action_button last-item noselect" onclick="$('.unresolved-todo-text').toggle(); return toggleElement(this, '.resolved-todo');" data-toggle-on="Show resolved" data-toggle-off="Hide resolved">Show resolved</span>
727 % else:
727 % else:
728 <span class="block-right last-item noselect">Show resolved</span>
728 <span class="block-right last-item noselect">Show resolved</span>
729 % endif
729 % endif
730 % endif
730 % endif
731 </div>
731 </div>
732
732
733 <div class="right-sidebar-expanded-state pr-details-content">
733 <div class="right-sidebar-expanded-state pr-details-content">
734
734
735 % if c.at_version:
735 % if c.at_version:
736 <table>
736 <table>
737 <tr>
737 <tr>
738 <td class="unresolved-todo-text">${_('TODOs unavailable when browsing versions')}.</td>
738 <td class="unresolved-todo-text">${_('TODOs unavailable when browsing versions')}.</td>
739 </tr>
739 </tr>
740 </table>
740 </table>
741 % else:
741 % else:
742 % if c.unresolved_comments + c.resolved_comments:
742 % if c.unresolved_comments + c.resolved_comments:
743 ${sidebar.comments_table(c.unresolved_comments + c.resolved_comments, len(c.unresolved_comments), todo_comments=True)}
743 ${sidebar.comments_table(c.unresolved_comments + c.resolved_comments, len(c.unresolved_comments), todo_comments=True)}
744 % else:
744 % else:
745 <table class="todos-content-table">
745 <table class="todos-content-table">
746 <tr>
746 <tr>
747 <td>
747 <td>
748 ${_('No TODOs yet')}
748 ${_('No TODOs yet')}
749 </td>
749 </td>
750 </tr>
750 </tr>
751 </table>
751 </table>
752 % endif
752 % endif
753 % endif
753 % endif
754 </div>
754 </div>
755 </div>
755 </div>
756
756
757 ## COMMENTS
757 ## COMMENTS
758 <div id="commentsTable" class="sidebar-element clear-both">
758 <div id="commentsTable" class="sidebar-element clear-both">
759 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Comments')}">
759 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Comments')}">
760 <i class="icon-comment" style="color: #949494"></i>
760 <i class="icon-comment" style="color: #949494"></i>
761 <span id="comments-count">${len(c.inline_comments_flat+c.comments)}</span>
761 <span id="comments-count">${len(c.inline_comments_flat+c.comments)}</span>
762 <span class="display-none" id="general-comments-count">${len(c.comments)}</span>
762 <span class="display-none" id="general-comments-count">${len(c.comments)}</span>
763 <span class="display-none" id="inline-comments-count">${len(c.inline_comments_flat)}</span>
763 <span class="display-none" id="inline-comments-count">${len(c.inline_comments_flat)}</span>
764 </div>
764 </div>
765
765
766 <div class="right-sidebar-expanded-state pr-details-title">
766 <div class="right-sidebar-expanded-state pr-details-title">
767 <span class="sidebar-heading noselect" onclick="refreshComments(); return false">
767 <span class="sidebar-heading noselect" onclick="refreshComments(); return false">
768 <i class="icon-comment" style="color: #949494"></i>
768 <i class="icon-comment" style="color: #949494"></i>
769 ${_('Comments')}
769 ${_('Comments')}
770
770
771 ## % if outdated_comm_count_ver:
771 ## % if outdated_comm_count_ver:
772 ## <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">
772 ## <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">
773 ## (${_("{} Outdated").format(outdated_comm_count_ver)})
773 ## (${_("{} Outdated").format(outdated_comm_count_ver)})
774 ## </a>
774 ## </a>
775 ## <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated')}</a>
775 ## <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated')}</a>
776 ## <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated')}</a>
776 ## <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated')}</a>
777
777
778 ## % else:
778 ## % else:
779 ## (${_("{} Outdated").format(outdated_comm_count_ver)})
779 ## (${_("{} Outdated").format(outdated_comm_count_ver)})
780 ## % endif
780 ## % endif
781
781
782 </span>
782 </span>
783
783
784 % if outdated_comm_count_ver:
784 % if outdated_comm_count_ver:
785 <span class="block-right action_button last-item noselect" onclick="return toggleElement(this, '.hidden-comment');" data-toggle-on="Show outdated" data-toggle-off="Hide outdated">Show outdated</span>
785 <span class="block-right action_button last-item noselect" onclick="return toggleElement(this, '.hidden-comment');" data-toggle-on="Show outdated" data-toggle-off="Hide outdated">Show outdated</span>
786 % else:
786 % else:
787 <span class="block-right last-item noselect">Show hidden</span>
787 <span class="block-right last-item noselect">Show hidden</span>
788 % endif
788 % endif
789
789
790 </div>
790 </div>
791
791
792 <div class="right-sidebar-expanded-state pr-details-content">
792 <div class="right-sidebar-expanded-state pr-details-content">
793 % if c.inline_comments_flat + c.comments:
793 % if c.inline_comments_flat + c.comments:
794 ${sidebar.comments_table(c.inline_comments_flat + c.comments, len(c.inline_comments_flat+c.comments))}
794 ${sidebar.comments_table(c.inline_comments_flat + c.comments, len(c.inline_comments_flat+c.comments))}
795 % else:
795 % else:
796 <table class="comments-content-table">
796 <table class="comments-content-table">
797 <tr>
797 <tr>
798 <td>
798 <td>
799 ${_('No Comments yet')}
799 ${_('No Comments yet')}
800 </td>
800 </td>
801 </tr>
801 </tr>
802 </table>
802 </table>
803 % endif
803 % endif
804 </div>
804 </div>
805
805
806 </div>
806 </div>
807
807
808 ## Referenced Tickets
808 ## Referenced Tickets
809 <div class="sidebar-element clear-both">
809 <div class="sidebar-element clear-both">
810 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Referenced Tickets')}">
810 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Referenced Tickets')}">
811 <i class="icon-info-circled"></i>
811 <i class="icon-info-circled"></i>
812 ${(c.referenced_desc_issues.issues_unique_count + c.referenced_commit_issues.issues_unique_count)}
812 ${(c.referenced_desc_issues.issues_unique_count + c.referenced_commit_issues.issues_unique_count)}
813 </div>
813 </div>
814
814
815 <div class="right-sidebar-expanded-state pr-details-title">
815 <div class="right-sidebar-expanded-state pr-details-title">
816 <span class="sidebar-heading">
816 <span class="sidebar-heading">
817 <i class="icon-info-circled"></i>
817 <i class="icon-info-circled"></i>
818 ${_('Referenced Tickets')}
818 ${_('Referenced Tickets')}
819 </span>
819 </span>
820 </div>
820 </div>
821 <div class="right-sidebar-expanded-state pr-details-content">
821 <div class="right-sidebar-expanded-state pr-details-content">
822 <table>
822 <table>
823
823
824 <tr><td><code>${_('In pull request description')}:</code></td></tr>
824 <tr><td><code>${_('In pull request description')}:</code></td></tr>
825 % if c.referenced_desc_issues.issues:
825 % if c.referenced_desc_issues.issues:
826
826
827 % for ticket_id, ticket_dict in c.referenced_desc_issues.unique_issues.items():
827 % for ticket_id, ticket_dict in c.referenced_desc_issues.unique_issues.items():
828 <tr>
828 <tr>
829 <td>
829 <td>
830 <a href="${ticket_dict[0].get('url')}">
830 <a href="${ticket_dict[0].get('url')}">
831 ${ticket_id}
831 ${ticket_id}
832 </a>
832 </a>
833 </td>
833 </td>
834 </tr>
834 </tr>
835
835
836 % endfor
836 % endfor
837 % else:
837 % else:
838 <tr>
838 <tr>
839 <td>
839 <td>
840 ${_('No Ticket data found.')}
840 ${_('No Ticket data found.')}
841 </td>
841 </td>
842 </tr>
842 </tr>
843 % endif
843 % endif
844
844
845 <tr><td style="padding-top: 10px"><code>${_('In commit messages')}:</code></td></tr>
845 <tr><td style="padding-top: 10px"><code>${_('In commit messages')}:</code></td></tr>
846 % if c.referenced_commit_issues.issues:
846 % if c.referenced_commit_issues.issues:
847 % for ticket_id, ticket_dict in c.referenced_commit_issues.unique_issues.items():
847 % for ticket_id, ticket_dict in c.referenced_commit_issues.unique_issues.items():
848 <tr>
848 <tr>
849 <td>
849 <td>
850 <a href="${ticket_dict[0].get('url')}">
850 <a href="${ticket_dict[0].get('url')}">
851 ${ticket_id}
851 ${ticket_id}
852 </a>
852 </a>
853 - ${_ungettext('in %s commit', 'in %s commits', len(ticket_dict)) % (len(ticket_dict))}
853 - ${_ungettext('in %s commit', 'in %s commits', len(ticket_dict)) % (len(ticket_dict))}
854 </td>
854 </td>
855 </tr>
855 </tr>
856 % endfor
856 % endfor
857 % else:
857 % else:
858 <tr>
858 <tr>
859 <td>
859 <td>
860 ${_('No Ticket data found.')}
860 ${_('No Ticket data found.')}
861 </td>
861 </td>
862 </tr>
862 </tr>
863 % endif
863 % endif
864 </table>
864 </table>
865
865
866 </div>
866 </div>
867 </div>
867 </div>
868
868
869 </div>
869 </div>
870
870
871 </div>
871 </div>
872 </aside>
872 </aside>
873
873
874 ## This JS needs to be at the end
874 ## This JS needs to be at the end
875 <script type="text/javascript">
875 <script type="text/javascript">
876
876
877 versionController = new VersionController();
877 versionController = new VersionController();
878 versionController.init();
878 versionController.init();
879
879
880 reviewersController = new ReviewersController();
880 reviewersController = new ReviewersController();
881 commitsController = new CommitsController();
881 commitsController = new CommitsController();
882 commentsController = new CommentsController();
882 commentsController = new CommentsController();
883
883
884 updateController = new UpdatePrController();
884 updateController = new UpdatePrController();
885
885
886 window.reviewerRulesData = ${c.pull_request_default_reviewers_data_json | n};
886 window.reviewerRulesData = ${c.pull_request_default_reviewers_data_json | n};
887 window.setReviewersData = ${c.pull_request_set_reviewers_data_json | n};
887 window.setReviewersData = ${c.pull_request_set_reviewers_data_json | n};
888 window.setObserversData = ${c.pull_request_set_observers_data_json | n};
888 window.setObserversData = ${c.pull_request_set_observers_data_json | n};
889
889
890 (function () {
890 (function () {
891 "use strict";
891 "use strict";
892
892
893 // custom code mirror
893 // custom code mirror
894 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
894 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
895
895
896 PRDetails.init();
896 PRDetails.init();
897 ReviewersPanel.init(reviewersController, reviewerRulesData, setReviewersData);
897 ReviewersPanel.init(reviewersController, reviewerRulesData, setReviewersData);
898 ObserversPanel.init(reviewersController, reviewerRulesData, setObserversData);
898 ObserversPanel.init(reviewersController, reviewerRulesData, setObserversData);
899
899
900 window.showOutdated = function (self) {
900 window.showOutdated = function (self) {
901 $('.comment-inline.comment-outdated').show();
901 $('.comment-inline.comment-outdated').show();
902 $('.filediff-outdated').show();
902 $('.filediff-outdated').show();
903 $('.showOutdatedComments').hide();
903 $('.showOutdatedComments').hide();
904 $('.hideOutdatedComments').show();
904 $('.hideOutdatedComments').show();
905 };
905 };
906
906
907 window.hideOutdated = function (self) {
907 window.hideOutdated = function (self) {
908 $('.comment-inline.comment-outdated').hide();
908 $('.comment-inline.comment-outdated').hide();
909 $('.filediff-outdated').hide();
909 $('.filediff-outdated').hide();
910 $('.hideOutdatedComments').hide();
910 $('.hideOutdatedComments').hide();
911 $('.showOutdatedComments').show();
911 $('.showOutdatedComments').show();
912 };
912 };
913
913
914 window.refreshMergeChecks = function () {
914 window.refreshMergeChecks = function () {
915 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
915 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
916 $('.pull-request-merge').css('opacity', 0.3);
916 $('.pull-request-merge').css('opacity', 0.3);
917 $('.action-buttons-extra').css('opacity', 0.3);
917 $('.action-buttons-extra').css('opacity', 0.3);
918
918
919 $('.pull-request-merge').load(
919 $('.pull-request-merge').load(
920 loadUrl, function () {
920 loadUrl, function () {
921 $('.pull-request-merge').css('opacity', 1);
921 $('.pull-request-merge').css('opacity', 1);
922
922
923 $('.action-buttons-extra').css('opacity', 1);
923 $('.action-buttons-extra').css('opacity', 1);
924 }
924 }
925 );
925 );
926 };
926 };
927
927
928 window.submitDrafts = function (event) {
928 window.submitDrafts = function (event) {
929 var target = $(event.currentTarget);
929 var target = $(event.currentTarget);
930 var callback = function (result) {
930 var callback = function (result) {
931 target.removeAttr('onclick').html('saving...');
931 target.removeAttr('onclick').html('saving...');
932 }
932 }
933 var draftIds = [];
933 var draftIds = [];
934 $.each($('[name=submit_draft]:checked'), function (idx, val) {
934 $.each($('[name=submit_draft]:checked'), function (idx, val) {
935 draftIds.push(parseInt($(val).val()));
935 draftIds.push(parseInt($(val).val()));
936 })
936 })
937 if (draftIds.length > 0) {
937 if (draftIds.length > 0) {
938 Rhodecode.comments.finalizeDrafts(draftIds, callback);
938 Rhodecode.comments.finalizeDrafts(draftIds, callback);
939 }
939 }
940 else {
940 else {
941
941
942 }
942 }
943 }
943 }
944
944
945 window.selectDraftComments = function (event) {
946 var $target = $(event.currentTarget);
947 $('[name=submit_draft]').prop('checked', $target.prop('checked'))
948 }
949
945 window.closePullRequest = function (status) {
950 window.closePullRequest = function (status) {
946 if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) {
951 if (!confirm(_gettext('Are you sure to close this pull request without merging?'))) {
947 return false;
952 return false;
948 }
953 }
949 // inject closing flag
954 // inject closing flag
950 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
955 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
951 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
956 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
952 $(generalCommentForm.submitForm).submit();
957 $(generalCommentForm.submitForm).submit();
953 };
958 };
954
959
955 //TODO this functionality is now missing
960 //TODO this functionality is now missing
956 $('#show-outdated-comments').on('click', function (e) {
961 $('#show-outdated-comments').on('click', function (e) {
957 var button = $(this);
962 var button = $(this);
958 var outdated = $('.comment-outdated');
963 var outdated = $('.comment-outdated');
959
964
960 if (button.html() === "(Show)") {
965 if (button.html() === "(Show)") {
961 button.html("(Hide)");
966 button.html("(Hide)");
962 outdated.show();
967 outdated.show();
963 } else {
968 } else {
964 button.html("(Show)");
969 button.html("(Show)");
965 outdated.hide();
970 outdated.hide();
966 }
971 }
967 });
972 });
968
973
969 $('#merge_pull_request_form').submit(function () {
974 $('#merge_pull_request_form').submit(function () {
970 if (!$('#merge_pull_request').attr('disabled')) {
975 if (!$('#merge_pull_request').attr('disabled')) {
971 $('#merge_pull_request').attr('disabled', 'disabled');
976 $('#merge_pull_request').attr('disabled', 'disabled');
972 }
977 }
973 return true;
978 return true;
974 });
979 });
975
980
976 $('#edit_pull_request').on('click', function (e) {
981 $('#edit_pull_request').on('click', function (e) {
977 var title = $('#pr-title-input').val();
982 var title = $('#pr-title-input').val();
978 var description = codeMirrorInstance.getValue();
983 var description = codeMirrorInstance.getValue();
979 var renderer = $('#pr-renderer-input').val();
984 var renderer = $('#pr-renderer-input').val();
980 editPullRequest(
985 editPullRequest(
981 "${c.repo_name}", "${c.pull_request.pull_request_id}",
986 "${c.repo_name}", "${c.pull_request.pull_request_id}",
982 title, description, renderer);
987 title, description, renderer);
983 });
988 });
984
989
985 var $updateButtons = $('#update_reviewers,#update_observers');
990 var $updateButtons = $('#update_reviewers,#update_observers');
986 $updateButtons.on('click', function (e) {
991 $updateButtons.on('click', function (e) {
987 var role = $(this).data('role');
992 var role = $(this).data('role');
988 $updateButtons.attr('disabled', 'disabled');
993 $updateButtons.attr('disabled', 'disabled');
989 $updateButtons.addClass('disabled');
994 $updateButtons.addClass('disabled');
990 $updateButtons.html(_gettext('Saving...'));
995 $updateButtons.html(_gettext('Saving...'));
991 reviewersController.updateReviewers(
996 reviewersController.updateReviewers(
992 templateContext.repo_name,
997 templateContext.repo_name,
993 templateContext.pull_request_data.pull_request_id,
998 templateContext.pull_request_data.pull_request_id,
994 role
999 role
995 );
1000 );
996 });
1001 });
997
1002
998 // fixing issue with caches on firefox
1003 // fixing issue with caches on firefox
999 $('#update_commits').removeAttr("disabled");
1004 $('#update_commits').removeAttr("disabled");
1000
1005
1001 $('.show-inline-comments').on('click', function (e) {
1006 $('.show-inline-comments').on('click', function (e) {
1002 var boxid = $(this).attr('data-comment-id');
1007 var boxid = $(this).attr('data-comment-id');
1003 var button = $(this);
1008 var button = $(this);
1004
1009
1005 if (button.hasClass("comments-visible")) {
1010 if (button.hasClass("comments-visible")) {
1006 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
1011 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
1007 $(this).hide();
1012 $(this).hide();
1008 });
1013 });
1009 button.removeClass("comments-visible");
1014 button.removeClass("comments-visible");
1010 } else {
1015 } else {
1011 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
1016 $('#{0} .inline-comments'.format(boxid)).each(function (index) {
1012 $(this).show();
1017 $(this).show();
1013 });
1018 });
1014 button.addClass("comments-visible");
1019 button.addClass("comments-visible");
1015 }
1020 }
1016 });
1021 });
1017
1022
1018 $('.show-inline-comments').on('change', function (e) {
1023 $('.show-inline-comments').on('change', function (e) {
1019 var show = 'none';
1024 var show = 'none';
1020 var target = e.currentTarget;
1025 var target = e.currentTarget;
1021 if (target.checked) {
1026 if (target.checked) {
1022 show = ''
1027 show = ''
1023 }
1028 }
1024 var boxid = $(target).attr('id_for');
1029 var boxid = $(target).attr('id_for');
1025 var comments = $('#{0} .inline-comments'.format(boxid));
1030 var comments = $('#{0} .inline-comments'.format(boxid));
1026 var fn_display = function (idx) {
1031 var fn_display = function (idx) {
1027 $(this).css('display', show);
1032 $(this).css('display', show);
1028 };
1033 };
1029 $(comments).each(fn_display);
1034 $(comments).each(fn_display);
1030 var btns = $('#{0} .inline-comments-button'.format(boxid));
1035 var btns = $('#{0} .inline-comments-button'.format(boxid));
1031 $(btns).each(fn_display);
1036 $(btns).each(fn_display);
1032 });
1037 });
1033
1038
1034 // register submit callback on commentForm form to track TODOs, and refresh mergeChecks conditions
1039 // register submit callback on commentForm form to track TODOs, and refresh mergeChecks conditions
1035 window.commentFormGlobalSubmitSuccessCallback = function (comment) {
1040 window.commentFormGlobalSubmitSuccessCallback = function (comment) {
1036 if (!comment.draft) {
1041 if (!comment.draft) {
1037 refreshMergeChecks();
1042 refreshMergeChecks();
1038 }
1043 }
1039 };
1044 };
1040
1045
1041 ReviewerAutoComplete('#user', reviewersController);
1046 ReviewerAutoComplete('#user', reviewersController);
1042 ObserverAutoComplete('#observer', reviewersController);
1047 ObserverAutoComplete('#observer', reviewersController);
1043
1048
1044 })();
1049 })();
1045
1050
1046 $(document).ready(function () {
1051 $(document).ready(function () {
1047
1052
1048 var channel = '${c.pr_broadcast_channel}';
1053 var channel = '${c.pr_broadcast_channel}';
1049 new ReviewerPresenceController(channel)
1054 new ReviewerPresenceController(channel)
1050 // register globally so inject comment logic can re-use it.
1055 // register globally so inject comment logic can re-use it.
1051 window.commentsController = commentsController;
1056 window.commentsController = commentsController;
1052 })
1057 })
1053 </script>
1058 </script>
1054
1059
1055 </%def>
1060 </%def>
General Comments 1
Under Review
author

Auto status change to "Under Review"

You need to be logged in to leave comments. Login now