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