Show More
@@ -1,219 +1,342 b'' | |||||
1 | // # Copyright (C) 2010-2017 RhodeCode GmbH |
|
1 | // # Copyright (C) 2010-2017 RhodeCode GmbH | |
2 | // # |
|
2 | // # | |
3 | // # This program is free software: you can redistribute it and/or modify |
|
3 | // # This program is free software: you can redistribute it and/or modify | |
4 | // # it under the terms of the GNU Affero General Public License, version 3 |
|
4 | // # it under the terms of the GNU Affero General Public License, version 3 | |
5 | // # (only), as published by the Free Software Foundation. |
|
5 | // # (only), as published by the Free Software Foundation. | |
6 | // # |
|
6 | // # | |
7 | // # This program is distributed in the hope that it will be useful, |
|
7 | // # This program is distributed in the hope that it will be useful, | |
8 | // # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
8 | // # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
9 | // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | // # GNU General Public License for more details. |
|
10 | // # GNU General Public License for more details. | |
11 | // # |
|
11 | // # | |
12 | // # You should have received a copy of the GNU Affero General Public License |
|
12 | // # You should have received a copy of the GNU Affero General Public License | |
13 | // # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
13 | // # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
14 | // # |
|
14 | // # | |
15 | // # This program is dual-licensed. If you wish to learn more about the |
|
15 | // # This program is dual-licensed. If you wish to learn more about the | |
16 | // # RhodeCode Enterprise Edition, including its added features, Support services, |
|
16 | // # RhodeCode Enterprise Edition, including its added features, Support services, | |
17 | // # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
17 | // # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
18 |
|
18 | |||
19 | /** |
|
19 | /** | |
20 | * Pull request reviewers |
|
20 | * Pull request reviewers | |
21 | */ |
|
21 | */ | |
22 | var removeReviewMember = function(reviewer_id, mark_delete){ |
|
22 | var removeReviewMember = function(reviewer_id, mark_delete){ | |
23 | var reviewer = $('#reviewer_{0}'.format(reviewer_id)); |
|
23 | var reviewer = $('#reviewer_{0}'.format(reviewer_id)); | |
24 |
|
24 | |||
25 | if(typeof(mark_delete) === undefined){ |
|
25 | if(typeof(mark_delete) === undefined){ | |
26 | mark_delete = false; |
|
26 | mark_delete = false; | |
27 | } |
|
27 | } | |
28 |
|
28 | |||
29 | if(mark_delete === true){ |
|
29 | if(mark_delete === true){ | |
30 | if (reviewer){ |
|
30 | if (reviewer){ | |
31 | // mark as to-remove |
|
31 | // mark as to-remove | |
32 | var obj = $('#reviewer_{0}_name'.format(reviewer_id)); |
|
32 | var obj = $('#reviewer_{0}_name'.format(reviewer_id)); | |
33 | obj.addClass('to-delete'); |
|
33 | obj.addClass('to-delete'); | |
34 | // now delete the input |
|
34 | // now delete the input | |
35 | $('#reviewer_{0} input'.format(reviewer_id)).remove(); |
|
35 | $('#reviewer_{0} input'.format(reviewer_id)).remove(); | |
36 | } |
|
36 | } | |
37 | } |
|
37 | } | |
38 | else{ |
|
38 | else{ | |
39 | $('#reviewer_{0}'.format(reviewer_id)).remove(); |
|
39 | $('#reviewer_{0}'.format(reviewer_id)).remove(); | |
40 | } |
|
40 | } | |
41 | }; |
|
41 | }; | |
42 |
|
42 | |||
43 | var addReviewMember = function(id, fname, lname, nname, gravatar_link, reasons) { |
|
43 | var addReviewMember = function(id, fname, lname, nname, gravatar_link, reasons) { | |
44 | var members = $('#review_members').get(0); |
|
44 | var members = $('#review_members').get(0); | |
45 | var reasons_html = ''; |
|
45 | var reasons_html = ''; | |
46 | var reasons_inputs = ''; |
|
46 | var reasons_inputs = ''; | |
47 | var reasons = reasons || []; |
|
47 | var reasons = reasons || []; | |
48 | if (reasons) { |
|
48 | if (reasons) { | |
49 | for (var i = 0; i < reasons.length; i++) { |
|
49 | for (var i = 0; i < reasons.length; i++) { | |
50 | reasons_html += '<div class="reviewer_reason">- {0}</div>'.format(reasons[i]); |
|
50 | reasons_html += '<div class="reviewer_reason">- {0}</div>'.format(reasons[i]); | |
51 | reasons_inputs += '<input type="hidden" name="reason" value="' + escapeHtml(reasons[i]) + '">'; |
|
51 | reasons_inputs += '<input type="hidden" name="reason" value="' + escapeHtml(reasons[i]) + '">'; | |
52 | } |
|
52 | } | |
53 | } |
|
53 | } | |
54 | var tmpl = '<li id="reviewer_{2}">'+ |
|
54 | var tmpl = '<li id="reviewer_{2}">'+ | |
55 | '<input type="hidden" name="__start__" value="reviewer:mapping">'+ |
|
55 | '<input type="hidden" name="__start__" value="reviewer:mapping">'+ | |
56 | '<div class="reviewer_status">'+ |
|
56 | '<div class="reviewer_status">'+ | |
57 | '<div class="flag_status not_reviewed pull-left reviewer_member_status"></div>'+ |
|
57 | '<div class="flag_status not_reviewed pull-left reviewer_member_status"></div>'+ | |
58 | '</div>'+ |
|
58 | '</div>'+ | |
59 | '<img alt="gravatar" class="gravatar" src="{0}"/>'+ |
|
59 | '<img alt="gravatar" class="gravatar" src="{0}"/>'+ | |
60 | '<span class="reviewer_name user">{1}</span>'+ |
|
60 | '<span class="reviewer_name user">{1}</span>'+ | |
61 | reasons_html + |
|
61 | reasons_html + | |
62 | '<input type="hidden" name="user_id" value="{2}">'+ |
|
62 | '<input type="hidden" name="user_id" value="{2}">'+ | |
63 | '<input type="hidden" name="__start__" value="reasons:sequence">'+ |
|
63 | '<input type="hidden" name="__start__" value="reasons:sequence">'+ | |
64 | '{3}'+ |
|
64 | '{3}'+ | |
65 | '<input type="hidden" name="__end__" value="reasons:sequence">'+ |
|
65 | '<input type="hidden" name="__end__" value="reasons:sequence">'+ | |
66 | '<div class="reviewer_member_remove action_button" onclick="removeReviewMember({2})">' + |
|
66 | '<div class="reviewer_member_remove action_button" onclick="removeReviewMember({2})">' + | |
67 | '<i class="icon-remove-sign"></i>'+ |
|
67 | '<i class="icon-remove-sign"></i>'+ | |
68 | '</div>'+ |
|
68 | '</div>'+ | |
69 | '</div>'+ |
|
69 | '</div>'+ | |
70 | '<input type="hidden" name="__end__" value="reviewer:mapping">'+ |
|
70 | '<input type="hidden" name="__end__" value="reviewer:mapping">'+ | |
71 | '</li>' ; |
|
71 | '</li>' ; | |
72 |
|
72 | |||
73 | var displayname = "{0} ({1} {2})".format( |
|
73 | var displayname = "{0} ({1} {2})".format( | |
74 | nname, escapeHtml(fname), escapeHtml(lname)); |
|
74 | nname, escapeHtml(fname), escapeHtml(lname)); | |
75 | var element = tmpl.format(gravatar_link,displayname,id,reasons_inputs); |
|
75 | var element = tmpl.format(gravatar_link,displayname,id,reasons_inputs); | |
76 | // check if we don't have this ID already in |
|
76 | // check if we don't have this ID already in | |
77 | var ids = []; |
|
77 | var ids = []; | |
78 | var _els = $('#review_members li').toArray(); |
|
78 | var _els = $('#review_members li').toArray(); | |
79 | for (el in _els){ |
|
79 | for (el in _els){ | |
80 | ids.push(_els[el].id) |
|
80 | ids.push(_els[el].id) | |
81 | } |
|
81 | } | |
82 | if(ids.indexOf('reviewer_'+id) == -1){ |
|
82 | if(ids.indexOf('reviewer_'+id) == -1){ | |
83 | // only add if it's not there |
|
83 | // only add if it's not there | |
84 | members.innerHTML += element; |
|
84 | members.innerHTML += element; | |
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 | }; |
|
87 | }; | |
88 |
|
88 | |||
89 | var _updatePullRequest = function(repo_name, pull_request_id, postData) { |
|
89 | var _updatePullRequest = function(repo_name, pull_request_id, postData) { | |
90 | var url = pyroutes.url( |
|
90 | var url = pyroutes.url( | |
91 | 'pullrequest_update', |
|
91 | 'pullrequest_update', | |
92 | {"repo_name": repo_name, "pull_request_id": pull_request_id}); |
|
92 | {"repo_name": repo_name, "pull_request_id": pull_request_id}); | |
93 | if (typeof postData === 'string' ) { |
|
93 | if (typeof postData === 'string' ) { | |
94 | postData += '&csrf_token=' + CSRF_TOKEN; |
|
94 | postData += '&csrf_token=' + CSRF_TOKEN; | |
95 | } else { |
|
95 | } else { | |
96 | postData.csrf_token = CSRF_TOKEN; |
|
96 | postData.csrf_token = CSRF_TOKEN; | |
97 | } |
|
97 | } | |
98 | var success = function(o) { |
|
98 | var success = function(o) { | |
99 | window.location.reload(); |
|
99 | window.location.reload(); | |
100 | }; |
|
100 | }; | |
101 | ajaxPOST(url, postData, success); |
|
101 | ajaxPOST(url, postData, success); | |
102 | }; |
|
102 | }; | |
103 |
|
103 | |||
104 | var updateReviewers = function(reviewers_ids, repo_name, pull_request_id){ |
|
104 | var updateReviewers = function(reviewers_ids, repo_name, pull_request_id){ | |
105 | if (reviewers_ids === undefined){ |
|
105 | if (reviewers_ids === undefined){ | |
106 | var postData = '_method=put&' + $('#reviewers input').serialize(); |
|
106 | var postData = '_method=put&' + $('#reviewers input').serialize(); | |
107 | _updatePullRequest(repo_name, pull_request_id, postData); |
|
107 | _updatePullRequest(repo_name, pull_request_id, postData); | |
108 | } |
|
108 | } | |
109 | }; |
|
109 | }; | |
110 |
|
110 | |||
111 | /** |
|
111 | /** | |
112 | * PULL REQUEST reject & close |
|
112 | * PULL REQUEST reject & close | |
113 | */ |
|
113 | */ | |
114 | var closePullRequest = function(repo_name, pull_request_id) { |
|
114 | var closePullRequest = function(repo_name, pull_request_id) { | |
115 | var postData = { |
|
115 | var postData = { | |
116 | '_method': 'put', |
|
116 | '_method': 'put', | |
117 | 'close_pull_request': true}; |
|
117 | 'close_pull_request': true}; | |
118 | _updatePullRequest(repo_name, pull_request_id, postData); |
|
118 | _updatePullRequest(repo_name, pull_request_id, postData); | |
119 | }; |
|
119 | }; | |
120 |
|
120 | |||
121 | /** |
|
121 | /** | |
122 | * PULL REQUEST update commits |
|
122 | * PULL REQUEST update commits | |
123 | */ |
|
123 | */ | |
124 | var updateCommits = function(repo_name, pull_request_id) { |
|
124 | var updateCommits = function(repo_name, pull_request_id) { | |
125 | var postData = { |
|
125 | var postData = { | |
126 | '_method': 'put', |
|
126 | '_method': 'put', | |
127 | 'update_commits': true}; |
|
127 | 'update_commits': true}; | |
128 | _updatePullRequest(repo_name, pull_request_id, postData); |
|
128 | _updatePullRequest(repo_name, pull_request_id, postData); | |
129 | }; |
|
129 | }; | |
130 |
|
130 | |||
131 |
|
131 | |||
132 | /** |
|
132 | /** | |
133 | * PULL REQUEST edit info |
|
133 | * PULL REQUEST edit info | |
134 | */ |
|
134 | */ | |
135 | var editPullRequest = function(repo_name, pull_request_id, title, description) { |
|
135 | var editPullRequest = function(repo_name, pull_request_id, title, description) { | |
136 | var url = pyroutes.url( |
|
136 | var url = pyroutes.url( | |
137 | 'pullrequest_update', |
|
137 | 'pullrequest_update', | |
138 | {"repo_name": repo_name, "pull_request_id": pull_request_id}); |
|
138 | {"repo_name": repo_name, "pull_request_id": pull_request_id}); | |
139 |
|
139 | |||
140 | var postData = { |
|
140 | var postData = { | |
141 | '_method': 'put', |
|
141 | '_method': 'put', | |
142 | 'title': title, |
|
142 | 'title': title, | |
143 | 'description': description, |
|
143 | 'description': description, | |
144 | 'edit_pull_request': true, |
|
144 | 'edit_pull_request': true, | |
145 | 'csrf_token': CSRF_TOKEN |
|
145 | 'csrf_token': CSRF_TOKEN | |
146 | }; |
|
146 | }; | |
147 | var success = function(o) { |
|
147 | var success = function(o) { | |
148 | window.location.reload(); |
|
148 | window.location.reload(); | |
149 | }; |
|
149 | }; | |
150 | ajaxPOST(url, postData, success); |
|
150 | ajaxPOST(url, postData, success); | |
151 | }; |
|
151 | }; | |
152 |
|
152 | |||
153 | var initPullRequestsCodeMirror = function (textAreaId) { |
|
153 | var initPullRequestsCodeMirror = function (textAreaId) { | |
154 | var ta = $(textAreaId).get(0); |
|
154 | var ta = $(textAreaId).get(0); | |
155 | var initialHeight = '100px'; |
|
155 | var initialHeight = '100px'; | |
156 |
|
156 | |||
157 | // default options |
|
157 | // default options | |
158 | var codeMirrorOptions = { |
|
158 | var codeMirrorOptions = { | |
159 | mode: "text", |
|
159 | mode: "text", | |
160 | lineNumbers: false, |
|
160 | lineNumbers: false, | |
161 | indentUnit: 4, |
|
161 | indentUnit: 4, | |
162 | theme: 'rc-input' |
|
162 | theme: 'rc-input' | |
163 | }; |
|
163 | }; | |
164 |
|
164 | |||
165 | var codeMirrorInstance = CodeMirror.fromTextArea(ta, codeMirrorOptions); |
|
165 | var codeMirrorInstance = CodeMirror.fromTextArea(ta, codeMirrorOptions); | |
166 | // marker for manually set description |
|
166 | // marker for manually set description | |
167 | codeMirrorInstance._userDefinedDesc = false; |
|
167 | codeMirrorInstance._userDefinedDesc = false; | |
168 | codeMirrorInstance.setSize(null, initialHeight); |
|
168 | codeMirrorInstance.setSize(null, initialHeight); | |
169 | codeMirrorInstance.on("change", function(instance, changeObj) { |
|
169 | codeMirrorInstance.on("change", function(instance, changeObj) { | |
170 | var height = initialHeight; |
|
170 | var height = initialHeight; | |
171 | var lines = instance.lineCount(); |
|
171 | var lines = instance.lineCount(); | |
172 | if (lines > 6 && lines < 20) { |
|
172 | if (lines > 6 && lines < 20) { | |
173 | height = "auto" |
|
173 | height = "auto" | |
174 | } |
|
174 | } | |
175 | else if (lines >= 20) { |
|
175 | else if (lines >= 20) { | |
176 | height = 20 * 15; |
|
176 | height = 20 * 15; | |
177 | } |
|
177 | } | |
178 | instance.setSize(null, height); |
|
178 | instance.setSize(null, height); | |
179 |
|
179 | |||
180 | // detect if the change was trigger by auto desc, or user input |
|
180 | // detect if the change was trigger by auto desc, or user input | |
181 | changeOrigin = changeObj.origin; |
|
181 | changeOrigin = changeObj.origin; | |
182 |
|
182 | |||
183 | if (changeOrigin === "setValue") { |
|
183 | if (changeOrigin === "setValue") { | |
184 | cmLog.debug('Change triggered by setValue'); |
|
184 | cmLog.debug('Change triggered by setValue'); | |
185 | } |
|
185 | } | |
186 | else { |
|
186 | else { | |
187 | cmLog.debug('user triggered change !'); |
|
187 | cmLog.debug('user triggered change !'); | |
188 | // set special marker to indicate user has created an input. |
|
188 | // set special marker to indicate user has created an input. | |
189 | instance._userDefinedDesc = true; |
|
189 | instance._userDefinedDesc = true; | |
190 | } |
|
190 | } | |
191 |
|
191 | |||
192 | }); |
|
192 | }); | |
193 |
|
193 | |||
194 | return codeMirrorInstance |
|
194 | return codeMirrorInstance | |
195 | }; |
|
195 | }; | |
196 |
|
196 | |||
197 | /** |
|
197 | /** | |
198 | * Reviewer autocomplete |
|
198 | * Reviewer autocomplete | |
199 | */ |
|
199 | */ | |
200 | var ReviewerAutoComplete = function(input_id) { |
|
200 | var ReviewerAutoComplete = function(input_id) { | |
201 | $('#'+input_id).autocomplete({ |
|
201 | $('#'+input_id).autocomplete({ | |
202 | serviceUrl: pyroutes.url('user_autocomplete_data'), |
|
202 | serviceUrl: pyroutes.url('user_autocomplete_data'), | |
203 | minChars:2, |
|
203 | minChars:2, | |
204 | maxHeight:400, |
|
204 | maxHeight:400, | |
205 | deferRequestBy: 300, //miliseconds |
|
205 | deferRequestBy: 300, //miliseconds | |
206 | showNoSuggestionNotice: true, |
|
206 | showNoSuggestionNotice: true, | |
207 | tabDisabled: true, |
|
207 | tabDisabled: true, | |
208 | autoSelectFirst: true, |
|
208 | autoSelectFirst: true, | |
209 | formatResult: autocompleteFormatResult, |
|
209 | formatResult: autocompleteFormatResult, | |
210 | lookupFilter: autocompleteFilterResult, |
|
210 | lookupFilter: autocompleteFilterResult, | |
211 | onSelect: function(suggestion, data){ |
|
211 | onSelect: function(suggestion, data){ | |
212 | var msg = _gettext('added manually by "{0}"'); |
|
212 | var msg = _gettext('added manually by "{0}"'); | |
213 | var reasons = [msg.format(templateContext.rhodecode_user.username)]; |
|
213 | var reasons = [msg.format(templateContext.rhodecode_user.username)]; | |
214 | addReviewMember(data.id, data.first_name, data.last_name, |
|
214 | addReviewMember(data.id, data.first_name, data.last_name, | |
215 | data.username, data.icon_link, reasons); |
|
215 | data.username, data.icon_link, reasons); | |
216 | $('#'+input_id).val(''); |
|
216 | $('#'+input_id).val(''); | |
217 | } |
|
217 | } | |
218 | }); |
|
218 | }); | |
219 | }; |
|
219 | }; | |
|
220 | ||||
|
221 | ||||
|
222 | VersionController = function () { | |||
|
223 | var self = this; | |||
|
224 | this.$verSource = $('input[name=ver_source]'); | |||
|
225 | this.$verTarget = $('input[name=ver_target]'); | |||
|
226 | this.$showVersionDiff = $('#show-version-diff'); | |||
|
227 | ||||
|
228 | this.adjustRadioSelectors = function (curNode) { | |||
|
229 | var getVal = function (item) { | |||
|
230 | if (item == 'latest') { | |||
|
231 | return Number.MAX_SAFE_INTEGER | |||
|
232 | } | |||
|
233 | else { | |||
|
234 | return parseInt(item) | |||
|
235 | } | |||
|
236 | }; | |||
|
237 | ||||
|
238 | var curVal = getVal($(curNode).val()); | |||
|
239 | var cleared = false; | |||
|
240 | ||||
|
241 | $.each(self.$verSource, function (index, value) { | |||
|
242 | var elVal = getVal($(value).val()); | |||
|
243 | ||||
|
244 | if (elVal > curVal) { | |||
|
245 | if ($(value).is(':checked')) { | |||
|
246 | cleared = true; | |||
|
247 | } | |||
|
248 | $(value).attr('disabled', 'disabled'); | |||
|
249 | $(value).removeAttr('checked'); | |||
|
250 | $(value).css({'opacity': 0.1}); | |||
|
251 | } | |||
|
252 | else { | |||
|
253 | $(value).css({'opacity': 1}); | |||
|
254 | $(value).removeAttr('disabled'); | |||
|
255 | } | |||
|
256 | }); | |||
|
257 | ||||
|
258 | if (cleared) { | |||
|
259 | // if we unchecked an active, set the next one to same loc. | |||
|
260 | $(this.$verSource).filter('[value={0}]'.format( | |||
|
261 | curVal)).attr('checked', 'checked'); | |||
|
262 | } | |||
|
263 | ||||
|
264 | self.setLockAction(false, | |||
|
265 | $(curNode).data('verPos'), | |||
|
266 | $(this.$verSource).filter(':checked').data('verPos') | |||
|
267 | ); | |||
|
268 | }; | |||
|
269 | ||||
|
270 | ||||
|
271 | this.attachVersionListener = function () { | |||
|
272 | self.$verTarget.change(function (e) { | |||
|
273 | self.adjustRadioSelectors(this) | |||
|
274 | }); | |||
|
275 | self.$verSource.change(function (e) { | |||
|
276 | self.adjustRadioSelectors(self.$verTarget.filter(':checked')) | |||
|
277 | }); | |||
|
278 | }; | |||
|
279 | ||||
|
280 | this.init = function () { | |||
|
281 | ||||
|
282 | var curNode = self.$verTarget.filter(':checked'); | |||
|
283 | self.adjustRadioSelectors(curNode); | |||
|
284 | self.setLockAction(true); | |||
|
285 | self.attachVersionListener(); | |||
|
286 | ||||
|
287 | }; | |||
|
288 | ||||
|
289 | this.setLockAction = function (state, selectedVersion, otherVersion) { | |||
|
290 | var $showVersionDiff = this.$showVersionDiff; | |||
|
291 | ||||
|
292 | if (state) { | |||
|
293 | $showVersionDiff.attr('disabled', 'disabled'); | |||
|
294 | $showVersionDiff.addClass('disabled'); | |||
|
295 | $showVersionDiff.html($showVersionDiff.data('labelTextLocked')); | |||
|
296 | } | |||
|
297 | else { | |||
|
298 | $showVersionDiff.removeAttr('disabled'); | |||
|
299 | $showVersionDiff.removeClass('disabled'); | |||
|
300 | ||||
|
301 | if (selectedVersion == otherVersion) { | |||
|
302 | $showVersionDiff.html($showVersionDiff.data('labelTextShow')); | |||
|
303 | } else { | |||
|
304 | $showVersionDiff.html($showVersionDiff.data('labelTextDiff')); | |||
|
305 | } | |||
|
306 | } | |||
|
307 | ||||
|
308 | }; | |||
|
309 | ||||
|
310 | this.showVersionDiff = function () { | |||
|
311 | var target = self.$verTarget.filter(':checked'); | |||
|
312 | var source = self.$verSource.filter(':checked'); | |||
|
313 | ||||
|
314 | if (target.val() && source.val()) { | |||
|
315 | var params = { | |||
|
316 | 'pull_request_id': templateContext.pull_request_data.pull_request_id, | |||
|
317 | 'repo_name': templateContext.repo_name, | |||
|
318 | 'version': target.val(), | |||
|
319 | 'from_version': source.val() | |||
|
320 | }; | |||
|
321 | window.location = pyroutes.url('pullrequest_show', params) | |||
|
322 | } | |||
|
323 | ||||
|
324 | return false; | |||
|
325 | }; | |||
|
326 | ||||
|
327 | this.toggleVersionView = function (elem) { | |||
|
328 | ||||
|
329 | if (this.$showVersionDiff.is(':visible')) { | |||
|
330 | $('.version-pr').hide(); | |||
|
331 | this.$showVersionDiff.hide(); | |||
|
332 | $(elem).html($(elem).data('toggleOn')) | |||
|
333 | } else { | |||
|
334 | $('.version-pr').show(); | |||
|
335 | this.$showVersionDiff.show(); | |||
|
336 | $(elem).html($(elem).data('toggleOff')) | |||
|
337 | } | |||
|
338 | ||||
|
339 | return false | |||
|
340 | } | |||
|
341 | ||||
|
342 | }; No newline at end of file |
@@ -1,915 +1,796 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 | · ${h.branding(c.rhodecode_name)} |
|
7 | · ${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 | G:${len(c.comment_versions[ver_pr]['at'])} / I:${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="6"> |
|
228 | <td colspan="6"> | |
229 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" |
|
229 | <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none" | |
230 | data-label-text-locked="${_('select versions to show changes')}" |
|
230 | data-label-text-locked="${_('select versions to show changes')}" | |
231 | data-label-text-diff="${_('show changes between versions')}" |
|
231 | data-label-text-diff="${_('show changes between versions')}" | |
232 | data-label-text-show="${_('show pull request for this version')}" |
|
232 | data-label-text-show="${_('show pull request for this version')}" | |
233 | > |
|
233 | > | |
234 | ${_('select versions to show changes')} |
|
234 | ${_('select versions to show changes')} | |
235 | </button> |
|
235 | </button> | |
236 | </td> |
|
236 | </td> | |
237 | </tr> |
|
237 | </tr> | |
238 |
|
238 | |||
239 | ## show comment/inline comments summary |
|
239 | ## show comment/inline comments summary | |
240 | <%def name="comments_summary()"> |
|
240 | <%def name="comments_summary()"> | |
241 | <tr> |
|
241 | <tr> | |
242 | <td colspan="6" class="comments-summary-td"> |
|
242 | <td colspan="6" class="comments-summary-td"> | |
243 |
|
243 | |||
244 | % if c.at_version: |
|
244 | % if c.at_version: | |
245 | <% 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']) %> | |
246 | <% 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']) %> | |
247 | ${_('Comments at this version')}: |
|
247 | ${_('Comments at this version')}: | |
248 | % else: |
|
248 | % else: | |
249 | <% 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']) %> | |
250 | <% 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']) %> | |
251 | ${_('Comments for this pull request')}: |
|
251 | ${_('Comments for this pull request')}: | |
252 | % endif |
|
252 | % endif | |
253 |
|
253 | |||
254 |
|
254 | |||
255 | %if general_comm_count_ver: |
|
255 | %if general_comm_count_ver: | |
256 | <a href="#comments">${_("%d General ") % general_comm_count_ver}</a> |
|
256 | <a href="#comments">${_("%d General ") % general_comm_count_ver}</a> | |
257 | %else: |
|
257 | %else: | |
258 | ${_("%d General ") % general_comm_count_ver} |
|
258 | ${_("%d General ") % general_comm_count_ver} | |
259 | %endif |
|
259 | %endif | |
260 |
|
260 | |||
261 | %if inline_comm_count_ver: |
|
261 | %if inline_comm_count_ver: | |
262 | , <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> | |
263 | %else: |
|
263 | %else: | |
264 | , ${_("%d Inline") % inline_comm_count_ver} |
|
264 | , ${_("%d Inline") % inline_comm_count_ver} | |
265 | %endif |
|
265 | %endif | |
266 |
|
266 | |||
267 | %if outdated_comm_count_ver: |
|
267 | %if outdated_comm_count_ver: | |
268 | , <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> | |
269 | <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> | |
270 | <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> | |
271 | %else: |
|
271 | %else: | |
272 | , ${_("%d Outdated") % outdated_comm_count_ver} |
|
272 | , ${_("%d Outdated") % outdated_comm_count_ver} | |
273 | %endif |
|
273 | %endif | |
274 | </td> |
|
274 | </td> | |
275 | </tr> |
|
275 | </tr> | |
276 | </%def> |
|
276 | </%def> | |
277 | ${comments_summary()} |
|
277 | ${comments_summary()} | |
278 | </table> |
|
278 | </table> | |
279 | % else: |
|
279 | % else: | |
280 | <div class="input"> |
|
280 | <div class="input"> | |
281 | ${_('Pull request versions not available')}. |
|
281 | ${_('Pull request versions not available')}. | |
282 | </div> |
|
282 | </div> | |
283 | <div> |
|
283 | <div> | |
284 | <table> |
|
284 | <table> | |
285 | ${comments_summary()} |
|
285 | ${comments_summary()} | |
286 | </table> |
|
286 | </table> | |
287 | </div> |
|
287 | </div> | |
288 | % endif |
|
288 | % endif | |
289 | </div> |
|
289 | </div> | |
290 | </div> |
|
290 | </div> | |
291 |
|
291 | |||
292 | <div id="pr-save" class="field" style="display: none;"> |
|
292 | <div id="pr-save" class="field" style="display: none;"> | |
293 | <div class="label-summary"></div> |
|
293 | <div class="label-summary"></div> | |
294 | <div class="input"> |
|
294 | <div class="input"> | |
295 | <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> | |
296 | </div> |
|
296 | </div> | |
297 | </div> |
|
297 | </div> | |
298 | </div> |
|
298 | </div> | |
299 | </div> |
|
299 | </div> | |
300 | <div> |
|
300 | <div> | |
301 | ## AUTHOR |
|
301 | ## AUTHOR | |
302 | <div class="reviewers-title block-right"> |
|
302 | <div class="reviewers-title block-right"> | |
303 | <div class="pr-details-title"> |
|
303 | <div class="pr-details-title"> | |
304 | ${_('Author')} |
|
304 | ${_('Author')} | |
305 | </div> |
|
305 | </div> | |
306 | </div> |
|
306 | </div> | |
307 | <div class="block-right pr-details-content reviewers"> |
|
307 | <div class="block-right pr-details-content reviewers"> | |
308 | <ul class="group_members"> |
|
308 | <ul class="group_members"> | |
309 | <li> |
|
309 | <li> | |
310 | ${self.gravatar_with_user(c.pull_request.author.email, 16)} |
|
310 | ${self.gravatar_with_user(c.pull_request.author.email, 16)} | |
311 | </li> |
|
311 | </li> | |
312 | </ul> |
|
312 | </ul> | |
313 | </div> |
|
313 | </div> | |
314 | ## REVIEWERS |
|
314 | ## REVIEWERS | |
315 | <div class="reviewers-title block-right"> |
|
315 | <div class="reviewers-title block-right"> | |
316 | <div class="pr-details-title"> |
|
316 | <div class="pr-details-title"> | |
317 | ${_('Pull request reviewers')} |
|
317 | ${_('Pull request reviewers')} | |
318 | %if c.allowed_to_update: |
|
318 | %if c.allowed_to_update: | |
319 | <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> | |
320 | <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> | |
321 | %endif |
|
321 | %endif | |
322 | </div> |
|
322 | </div> | |
323 | </div> |
|
323 | </div> | |
324 | <div id="reviewers" class="block-right pr-details-content reviewers"> |
|
324 | <div id="reviewers" class="block-right pr-details-content reviewers"> | |
325 | ## members goes here ! |
|
325 | ## members goes here ! | |
326 | <input type="hidden" name="__start__" value="review_members:sequence"> |
|
326 | <input type="hidden" name="__start__" value="review_members:sequence"> | |
327 | <ul id="review_members" class="group_members"> |
|
327 | <ul id="review_members" class="group_members"> | |
328 | %for member,reasons,status in c.pull_request_reviewers: |
|
328 | %for member,reasons,status in c.pull_request_reviewers: | |
329 | <li id="reviewer_${member.user_id}"> |
|
329 | <li id="reviewer_${member.user_id}"> | |
330 | <div class="reviewers_member"> |
|
330 | <div class="reviewers_member"> | |
331 | <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'))}"> | |
332 | <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> | |
333 | </div> |
|
333 | </div> | |
334 | <div id="reviewer_${member.user_id}_name" class="reviewer_name"> |
|
334 | <div id="reviewer_${member.user_id}_name" class="reviewer_name"> | |
335 | ${self.gravatar_with_user(member.email, 16)} |
|
335 | ${self.gravatar_with_user(member.email, 16)} | |
336 | </div> |
|
336 | </div> | |
337 | <input type="hidden" name="__start__" value="reviewer:mapping"> |
|
337 | <input type="hidden" name="__start__" value="reviewer:mapping"> | |
338 | <input type="hidden" name="__start__" value="reasons:sequence"> |
|
338 | <input type="hidden" name="__start__" value="reasons:sequence"> | |
339 | %for reason in reasons: |
|
339 | %for reason in reasons: | |
340 | <div class="reviewer_reason">- ${reason}</div> |
|
340 | <div class="reviewer_reason">- ${reason}</div> | |
341 | <input type="hidden" name="reason" value="${reason}"> |
|
341 | <input type="hidden" name="reason" value="${reason}"> | |
342 |
|
342 | |||
343 | %endfor |
|
343 | %endfor | |
344 | <input type="hidden" name="__end__" value="reasons:sequence"> |
|
344 | <input type="hidden" name="__end__" value="reasons:sequence"> | |
345 | <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" /> | |
346 | <input type="hidden" name="__end__" value="reviewer:mapping"> |
|
346 | <input type="hidden" name="__end__" value="reviewer:mapping"> | |
347 | %if c.allowed_to_update: |
|
347 | %if c.allowed_to_update: | |
348 | <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;"> | |
349 | <i class="icon-remove-sign" ></i> |
|
349 | <i class="icon-remove-sign" ></i> | |
350 | </div> |
|
350 | </div> | |
351 | %endif |
|
351 | %endif | |
352 | </div> |
|
352 | </div> | |
353 | </li> |
|
353 | </li> | |
354 | %endfor |
|
354 | %endfor | |
355 | </ul> |
|
355 | </ul> | |
356 | <input type="hidden" name="__end__" value="review_members:sequence"> |
|
356 | <input type="hidden" name="__end__" value="review_members:sequence"> | |
357 | %if not c.pull_request.is_closed(): |
|
357 | %if not c.pull_request.is_closed(): | |
358 | <div id="add_reviewer_input" class='ac' style="display: none;"> |
|
358 | <div id="add_reviewer_input" class='ac' style="display: none;"> | |
359 | %if c.allowed_to_update: |
|
359 | %if c.allowed_to_update: | |
360 | <div class="reviewer_ac"> |
|
360 | <div class="reviewer_ac"> | |
361 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer'))} |
|
361 | ${h.text('user', class_='ac-input', placeholder=_('Add reviewer'))} | |
362 | <div id="reviewers_container"></div> |
|
362 | <div id="reviewers_container"></div> | |
363 | </div> |
|
363 | </div> | |
364 | <div> |
|
364 | <div> | |
365 | <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> | |
366 | </div> |
|
366 | </div> | |
367 | %endif |
|
367 | %endif | |
368 | </div> |
|
368 | </div> | |
369 | %endif |
|
369 | %endif | |
370 | </div> |
|
370 | </div> | |
371 | </div> |
|
371 | </div> | |
372 | </div> |
|
372 | </div> | |
373 | <div class="box"> |
|
373 | <div class="box"> | |
374 | ##DIFF |
|
374 | ##DIFF | |
375 | <div class="table" > |
|
375 | <div class="table" > | |
376 | <div id="changeset_compare_view_content"> |
|
376 | <div id="changeset_compare_view_content"> | |
377 | ##CS |
|
377 | ##CS | |
378 | % if c.missing_requirements: |
|
378 | % if c.missing_requirements: | |
379 | <div class="box"> |
|
379 | <div class="box"> | |
380 | <div class="alert alert-warning"> |
|
380 | <div class="alert alert-warning"> | |
381 | <div> |
|
381 | <div> | |
382 | <strong>${_('Missing requirements:')}</strong> |
|
382 | <strong>${_('Missing requirements:')}</strong> | |
383 | ${_('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.')} | |
384 | </div> |
|
384 | </div> | |
385 | </div> |
|
385 | </div> | |
386 | </div> |
|
386 | </div> | |
387 | % elif c.missing_commits: |
|
387 | % elif c.missing_commits: | |
388 | <div class="box"> |
|
388 | <div class="box"> | |
389 | <div class="alert alert-warning"> |
|
389 | <div class="alert alert-warning"> | |
390 | <div> |
|
390 | <div> | |
391 | <strong>${_('Missing commits')}:</strong> |
|
391 | <strong>${_('Missing commits')}:</strong> | |
392 | ${_('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.')} | |
393 | ${_('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.')} | |
394 | </div> |
|
394 | </div> | |
395 | </div> |
|
395 | </div> | |
396 | </div> |
|
396 | </div> | |
397 | % endif |
|
397 | % endif | |
398 |
|
398 | |||
399 | <div class="compare_view_commits_title"> |
|
399 | <div class="compare_view_commits_title"> | |
400 | % if not c.compare_mode: |
|
400 | % if not c.compare_mode: | |
401 |
|
401 | |||
402 | % if c.at_version_pos: |
|
402 | % if c.at_version_pos: | |
403 | <h4> |
|
403 | <h4> | |
404 | ${_('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} | |
405 | </h4> |
|
405 | </h4> | |
406 | % endif |
|
406 | % endif | |
407 |
|
407 | |||
408 | <div class="pull-left"> |
|
408 | <div class="pull-left"> | |
409 | <div class="btn-group"> |
|
409 | <div class="btn-group"> | |
410 | <a |
|
410 | <a | |
411 | class="btn" |
|
411 | class="btn" | |
412 | href="#" |
|
412 | href="#" | |
413 | onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false"> |
|
413 | onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false"> | |
414 | ${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)} | |
415 | </a> |
|
415 | </a> | |
416 | <a |
|
416 | <a | |
417 | class="btn" |
|
417 | class="btn" | |
418 | href="#" |
|
418 | href="#" | |
419 | onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false"> |
|
419 | onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false"> | |
420 | ${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)} | |
421 | </a> |
|
421 | </a> | |
422 | </div> |
|
422 | </div> | |
423 | </div> |
|
423 | </div> | |
424 |
|
424 | |||
425 | <div class="pull-right"> |
|
425 | <div class="pull-right"> | |
426 | % 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(): | |
427 | <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> | |
428 | % else: |
|
428 | % else: | |
429 | <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> | |
430 | % endif |
|
430 | % endif | |
431 |
|
431 | |||
432 | </div> |
|
432 | </div> | |
433 | % endif |
|
433 | % endif | |
434 | </div> |
|
434 | </div> | |
435 |
|
435 | |||
436 | % if not c.missing_commits: |
|
436 | % if not c.missing_commits: | |
437 | % if c.compare_mode: |
|
437 | % if c.compare_mode: | |
438 | % if c.at_version: |
|
438 | % if c.at_version: | |
439 | <h4> |
|
439 | <h4> | |
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')}: |
|
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')}: | |
441 | </h4> |
|
441 | </h4> | |
442 |
|
442 | |||
443 | <div class="subtitle-compare"> |
|
443 | <div class="subtitle-compare"> | |
444 | ${_('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))} | |
445 | </div> |
|
445 | </div> | |
446 |
|
446 | |||
447 | <div class="container"> |
|
447 | <div class="container"> | |
448 | <table class="rctable compare_view_commits"> |
|
448 | <table class="rctable compare_view_commits"> | |
449 | <tr> |
|
449 | <tr> | |
450 | <th></th> |
|
450 | <th></th> | |
451 | <th>${_('Time')}</th> |
|
451 | <th>${_('Time')}</th> | |
452 | <th>${_('Author')}</th> |
|
452 | <th>${_('Author')}</th> | |
453 | <th>${_('Commit')}</th> |
|
453 | <th>${_('Commit')}</th> | |
454 | <th></th> |
|
454 | <th></th> | |
455 | <th>${_('Description')}</th> |
|
455 | <th>${_('Description')}</th> | |
456 | </tr> |
|
456 | </tr> | |
457 |
|
457 | |||
458 | % for c_type, commit in c.commit_changes: |
|
458 | % for c_type, commit in c.commit_changes: | |
459 | % if c_type in ['a', 'r']: |
|
459 | % if c_type in ['a', 'r']: | |
460 | <% |
|
460 | <% | |
461 | if c_type == 'a': |
|
461 | if c_type == 'a': | |
462 | cc_title = _('Commit added in displayed changes') |
|
462 | cc_title = _('Commit added in displayed changes') | |
463 | elif c_type == 'r': |
|
463 | elif c_type == 'r': | |
464 | cc_title = _('Commit removed in displayed changes') |
|
464 | cc_title = _('Commit removed in displayed changes') | |
465 | else: |
|
465 | else: | |
466 | cc_title = '' |
|
466 | cc_title = '' | |
467 | %> |
|
467 | %> | |
468 | <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"> | |
469 | <td> |
|
469 | <td> | |
470 | <div class="commit-change-indicator color-${c_type}-border"> |
|
470 | <div class="commit-change-indicator color-${c_type}-border"> | |
471 | <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}"> | |
472 | ${c_type.upper()} |
|
472 | ${c_type.upper()} | |
473 | </div> |
|
473 | </div> | |
474 | </div> |
|
474 | </div> | |
475 | </td> |
|
475 | </td> | |
476 | <td class="td-time"> |
|
476 | <td class="td-time"> | |
477 | ${h.age_component(commit.date)} |
|
477 | ${h.age_component(commit.date)} | |
478 | </td> |
|
478 | </td> | |
479 | <td class="td-user"> |
|
479 | <td class="td-user"> | |
480 | ${base.gravatar_with_user(commit.author, 16)} |
|
480 | ${base.gravatar_with_user(commit.author, 16)} | |
481 | </td> |
|
481 | </td> | |
482 | <td class="td-hash"> |
|
482 | <td class="td-hash"> | |
483 | <code> |
|
483 | <code> | |
484 | <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)}"> | |
485 | r${commit.revision}:${h.short_id(commit.raw_id)} |
|
485 | r${commit.revision}:${h.short_id(commit.raw_id)} | |
486 | </a> |
|
486 | </a> | |
487 | ${h.hidden('revisions', commit.raw_id)} |
|
487 | ${h.hidden('revisions', commit.raw_id)} | |
488 | </code> |
|
488 | </code> | |
489 | </td> |
|
489 | </td> | |
490 | <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')}"> | |
491 | <div class="show_more_col"> |
|
491 | <div class="show_more_col"> | |
492 | <i class="show_more"></i> |
|
492 | <i class="show_more"></i> | |
493 | </div> |
|
493 | </div> | |
494 | </td> |
|
494 | </td> | |
495 | <td class="mid td-description"> |
|
495 | <td class="mid td-description"> | |
496 | <div class="log-container truncate-wrap"> |
|
496 | <div class="log-container truncate-wrap"> | |
497 | <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}"> | |
498 | ${h.urlify_commit_message(commit.message, c.repo_name)} |
|
498 | ${h.urlify_commit_message(commit.message, c.repo_name)} | |
499 | </div> |
|
499 | </div> | |
500 | </div> |
|
500 | </div> | |
501 | </td> |
|
501 | </td> | |
502 | </tr> |
|
502 | </tr> | |
503 | % endif |
|
503 | % endif | |
504 | % endfor |
|
504 | % endfor | |
505 | </table> |
|
505 | </table> | |
506 | </div> |
|
506 | </div> | |
507 |
|
507 | |||
508 | <script> |
|
508 | <script> | |
509 | $('.expand_commit').on('click',function(e){ |
|
509 | $('.expand_commit').on('click',function(e){ | |
510 | var target_expand = $(this); |
|
510 | var target_expand = $(this); | |
511 | var cid = target_expand.data('commitId'); |
|
511 | var cid = target_expand.data('commitId'); | |
512 |
|
512 | |||
513 | if (target_expand.hasClass('open')){ |
|
513 | if (target_expand.hasClass('open')){ | |
514 | $('#c-'+cid).css({ |
|
514 | $('#c-'+cid).css({ | |
515 | 'height': '1.5em', |
|
515 | 'height': '1.5em', | |
516 | 'white-space': 'nowrap', |
|
516 | 'white-space': 'nowrap', | |
517 | 'text-overflow': 'ellipsis', |
|
517 | 'text-overflow': 'ellipsis', | |
518 | 'overflow':'hidden' |
|
518 | 'overflow':'hidden' | |
519 | }); |
|
519 | }); | |
520 | target_expand.removeClass('open'); |
|
520 | target_expand.removeClass('open'); | |
521 | } |
|
521 | } | |
522 | else { |
|
522 | else { | |
523 | $('#c-'+cid).css({ |
|
523 | $('#c-'+cid).css({ | |
524 | 'height': 'auto', |
|
524 | 'height': 'auto', | |
525 | 'white-space': 'pre-line', |
|
525 | 'white-space': 'pre-line', | |
526 | 'text-overflow': 'initial', |
|
526 | 'text-overflow': 'initial', | |
527 | 'overflow':'visible' |
|
527 | 'overflow':'visible' | |
528 | }); |
|
528 | }); | |
529 | target_expand.addClass('open'); |
|
529 | target_expand.addClass('open'); | |
530 | } |
|
530 | } | |
531 | }); |
|
531 | }); | |
532 | </script> |
|
532 | </script> | |
533 |
|
533 | |||
534 | % endif |
|
534 | % endif | |
535 |
|
535 | |||
536 | % else: |
|
536 | % else: | |
537 | <%include file="/compare/compare_commits.mako" /> |
|
537 | <%include file="/compare/compare_commits.mako" /> | |
538 | % endif |
|
538 | % endif | |
539 |
|
539 | |||
540 | <div class="cs_files"> |
|
540 | <div class="cs_files"> | |
541 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> |
|
541 | <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/> | |
542 | ${cbdiffs.render_diffset_menu()} |
|
542 | ${cbdiffs.render_diffset_menu()} | |
543 | ${cbdiffs.render_diffset( |
|
543 | ${cbdiffs.render_diffset( | |
544 | c.diffset, use_comments=True, |
|
544 | c.diffset, use_comments=True, | |
545 | collapse_when_files_over=30, |
|
545 | collapse_when_files_over=30, | |
546 | disable_new_comments=not c.allowed_to_comment, |
|
546 | disable_new_comments=not c.allowed_to_comment, | |
547 | deleted_files_comments=c.deleted_files_comments)} |
|
547 | deleted_files_comments=c.deleted_files_comments)} | |
548 | </div> |
|
548 | </div> | |
549 | % else: |
|
549 | % else: | |
550 | ## skipping commits we need to clear the view for missing commits |
|
550 | ## skipping commits we need to clear the view for missing commits | |
551 | <div style="clear:both;"></div> |
|
551 | <div style="clear:both;"></div> | |
552 | % endif |
|
552 | % endif | |
553 |
|
553 | |||
554 | </div> |
|
554 | </div> | |
555 | </div> |
|
555 | </div> | |
556 |
|
556 | |||
557 | ## template for inline comment form |
|
557 | ## template for inline comment form | |
558 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> |
|
558 | <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> | |
559 |
|
559 | |||
560 | ## render general comments |
|
560 | ## render general comments | |
561 |
|
561 | |||
562 | <div id="comment-tr-show"> |
|
562 | <div id="comment-tr-show"> | |
563 | <div class="comment"> |
|
563 | <div class="comment"> | |
564 | % if general_outdated_comm_count_ver: |
|
564 | % if general_outdated_comm_count_ver: | |
565 | <div class="meta"> |
|
565 | <div class="meta"> | |
566 | % if general_outdated_comm_count_ver == 1: |
|
566 | % if general_outdated_comm_count_ver == 1: | |
567 | ${_('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)}, | |
568 | <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> | |
569 | % else: |
|
569 | % else: | |
570 | ${_('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)}, | |
571 | <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> | |
572 | % endif |
|
572 | % endif | |
573 | </div> |
|
573 | </div> | |
574 | % endif |
|
574 | % endif | |
575 | </div> |
|
575 | </div> | |
576 | </div> |
|
576 | </div> | |
577 |
|
577 | |||
578 | ${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)} | |
579 |
|
579 | |||
580 | % if not c.pull_request.is_closed(): |
|
580 | % if not c.pull_request.is_closed(): | |
581 | ## merge status, and merge action |
|
581 | ## merge status, and merge action | |
582 | <div class="pull-request-merge"> |
|
582 | <div class="pull-request-merge"> | |
583 | <%include file="/pullrequests/pullrequest_merge_checks.mako"/> |
|
583 | <%include file="/pullrequests/pullrequest_merge_checks.mako"/> | |
584 | </div> |
|
584 | </div> | |
585 |
|
585 | |||
586 | ## main comment form and it status |
|
586 | ## main comment form and it status | |
587 | ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name, |
|
587 | ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name, | |
588 | pull_request_id=c.pull_request.pull_request_id), |
|
588 | pull_request_id=c.pull_request.pull_request_id), | |
589 | c.pull_request_review_status, |
|
589 | c.pull_request_review_status, | |
590 | is_pull_request=True, change_status=c.allowed_to_change_status)} |
|
590 | is_pull_request=True, change_status=c.allowed_to_change_status)} | |
591 | %endif |
|
591 | %endif | |
592 |
|
592 | |||
593 | <script type="text/javascript"> |
|
593 | <script type="text/javascript"> | |
594 | if (location.hash) { |
|
594 | if (location.hash) { | |
595 | var result = splitDelimitedHash(location.hash); |
|
595 | var result = splitDelimitedHash(location.hash); | |
596 | var line = $('html').find(result.loc); |
|
596 | var line = $('html').find(result.loc); | |
597 | // show hidden comments if we use location.hash |
|
597 | // show hidden comments if we use location.hash | |
598 | if (line.hasClass('comment-general')) { |
|
598 | if (line.hasClass('comment-general')) { | |
599 | $(line).show(); |
|
599 | $(line).show(); | |
600 | } else if (line.hasClass('comment-inline')) { |
|
600 | } else if (line.hasClass('comment-inline')) { | |
601 | $(line).show(); |
|
601 | $(line).show(); | |
602 | var $cb = $(line).closest('.cb'); |
|
602 | var $cb = $(line).closest('.cb'); | |
603 | $cb.removeClass('cb-collapsed') |
|
603 | $cb.removeClass('cb-collapsed') | |
604 | } |
|
604 | } | |
605 | if (line.length > 0){ |
|
605 | if (line.length > 0){ | |
606 | offsetScroll(line, 70); |
|
606 | offsetScroll(line, 70); | |
607 | } |
|
607 | } | |
608 | } |
|
608 | } | |
609 |
|
609 | |||
610 | VersionController = function() { |
|
|||
611 | var self = this; |
|
|||
612 | this.$verSource = $('input[name=ver_source]'); |
|
|||
613 | this.$verTarget = $('input[name=ver_target]'); |
|
|||
614 |
|
||||
615 | this.adjustRadioSelectors = function (curNode) { |
|
|||
616 | var getVal = function(item) { |
|
|||
617 | if (item == 'latest'){ |
|
|||
618 | return Number.MAX_SAFE_INTEGER |
|
|||
619 | } |
|
|||
620 | else { |
|
|||
621 | return parseInt(item) |
|
|||
622 | } |
|
|||
623 | }; |
|
|||
624 |
|
||||
625 | var curVal = getVal($(curNode).val()); |
|
|||
626 | var cleared = false; |
|
|||
627 |
|
||||
628 | $.each(self.$verSource, function(index, value){ |
|
|||
629 | var elVal = getVal($(value).val()); |
|
|||
630 |
|
||||
631 | if(elVal > curVal){ |
|
|||
632 | if ($(value).is(':checked')) { |
|
|||
633 | cleared = true; |
|
|||
634 | } |
|
|||
635 | $(value).attr('disabled', 'disabled'); |
|
|||
636 | $(value).removeAttr('checked'); |
|
|||
637 | $(value).css({'opacity': 0.1}); |
|
|||
638 | } |
|
|||
639 | else{ |
|
|||
640 | $(value).css({'opacity': 1}); |
|
|||
641 | $(value).removeAttr('disabled'); |
|
|||
642 | } |
|
|||
643 | }); |
|
|||
644 |
|
||||
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 | ); |
|
|||
655 | }; |
|
|||
656 |
|
||||
657 |
|
||||
658 | this.attachVersionListener = function () { |
|
|||
659 | self.$verTarget.change(function(e){ |
|
|||
660 | self.adjustRadioSelectors(this) |
|
|||
661 | }); |
|
|||
662 | self.$verSource.change(function(e){ |
|
|||
663 | self.adjustRadioSelectors(self.$verTarget.filter(':checked')) |
|
|||
664 | }); |
|
|||
665 | }; |
|
|||
666 |
|
||||
667 | this.init = function () { |
|
|||
668 |
|
||||
669 | var curNode = self.$verTarget.filter(':checked'); |
|
|||
670 | self.adjustRadioSelectors(curNode); |
|
|||
671 | self.setLockAction(true); |
|
|||
672 | self.attachVersionListener(); |
|
|||
673 |
|
||||
674 | }; |
|
|||
675 |
|
||||
676 | this.setLockAction = function (state, selectedVersion, otherVersion) { |
|
|||
677 | if (state) { |
|
|||
678 | $('#show-version-diff').attr('disabled', 'disabled'); |
|
|||
679 | $('#show-version-diff').addClass('disabled'); |
|
|||
680 | $('#show-version-diff').html($('#show-version-diff').data('labelTextLocked')); |
|
|||
681 | } |
|
|||
682 | else { |
|
|||
683 | $('#show-version-diff').removeAttr('disabled'); |
|
|||
684 | $('#show-version-diff').removeClass('disabled'); |
|
|||
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 | } |
|
|||
691 | } |
|
|||
692 |
|
||||
693 | }; |
|
|||
694 |
|
||||
695 | this.showVersionDiff = function(){ |
|
|||
696 | var target = self.$verTarget.filter(':checked'); |
|
|||
697 | var source = self.$verSource.filter(':checked'); |
|
|||
698 |
|
||||
699 | if (target.val() && source.val()) { |
|
|||
700 | var params = { |
|
|||
701 | 'pull_request_id': ${c.pull_request.pull_request_id}, |
|
|||
702 | 'repo_name': templateContext.repo_name, |
|
|||
703 | 'version': target.val(), |
|
|||
704 | 'from_version': source.val() |
|
|||
705 | }; |
|
|||
706 | window.location = pyroutes.url('pullrequest_show', params) |
|
|||
707 | } |
|
|||
708 |
|
||||
709 | return false; |
|
|||
710 | }; |
|
|||
711 |
|
||||
712 | this.toggleVersionView = function (elem) { |
|
|||
713 |
|
||||
714 | if ($('#show-version-diff').is(':visible')) { |
|
|||
715 | $('.version-pr').hide(); |
|
|||
716 | $('#show-version-diff').hide(); |
|
|||
717 | $(elem).html($(elem).data('toggleOn')) |
|
|||
718 | } else { |
|
|||
719 | $('.version-pr').show(); |
|
|||
720 | $('#show-version-diff').show(); |
|
|||
721 | $(elem).html($(elem).data('toggleOff')) |
|
|||
722 | } |
|
|||
723 |
|
||||
724 | return false |
|
|||
725 | } |
|
|||
726 |
|
||||
727 | }; |
|
|||
728 |
|
||||
729 | versionController = new VersionController(); |
|
610 | versionController = new VersionController(); | |
730 | versionController.init(); |
|
611 | versionController.init(); | |
731 |
|
612 | |||
732 |
|
613 | |||
733 | $(function(){ |
|
614 | $(function(){ | |
734 | ReviewerAutoComplete('user'); |
|
615 | ReviewerAutoComplete('user'); | |
735 | // custom code mirror |
|
616 | // custom code mirror | |
736 | var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input'); |
|
617 | var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input'); | |
737 |
|
618 | |||
738 | var PRDetails = { |
|
619 | var PRDetails = { | |
739 | editButton: $('#open_edit_pullrequest'), |
|
620 | editButton: $('#open_edit_pullrequest'), | |
740 | closeButton: $('#close_edit_pullrequest'), |
|
621 | closeButton: $('#close_edit_pullrequest'), | |
741 | deleteButton: $('#delete_pullrequest'), |
|
622 | deleteButton: $('#delete_pullrequest'), | |
742 | viewFields: $('#pr-desc, #pr-title'), |
|
623 | viewFields: $('#pr-desc, #pr-title'), | |
743 | editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'), |
|
624 | editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'), | |
744 |
|
625 | |||
745 | init: function() { |
|
626 | init: function() { | |
746 | var that = this; |
|
627 | var that = this; | |
747 | this.editButton.on('click', function(e) { that.edit(); }); |
|
628 | this.editButton.on('click', function(e) { that.edit(); }); | |
748 | this.closeButton.on('click', function(e) { that.view(); }); |
|
629 | this.closeButton.on('click', function(e) { that.view(); }); | |
749 | }, |
|
630 | }, | |
750 |
|
631 | |||
751 | edit: function(event) { |
|
632 | edit: function(event) { | |
752 | this.viewFields.hide(); |
|
633 | this.viewFields.hide(); | |
753 | this.editButton.hide(); |
|
634 | this.editButton.hide(); | |
754 | this.deleteButton.hide(); |
|
635 | this.deleteButton.hide(); | |
755 | this.closeButton.show(); |
|
636 | this.closeButton.show(); | |
756 | this.editFields.show(); |
|
637 | this.editFields.show(); | |
757 | codeMirrorInstance.refresh(); |
|
638 | codeMirrorInstance.refresh(); | |
758 | }, |
|
639 | }, | |
759 |
|
640 | |||
760 | view: function(event) { |
|
641 | view: function(event) { | |
761 | this.editButton.show(); |
|
642 | this.editButton.show(); | |
762 | this.deleteButton.show(); |
|
643 | this.deleteButton.show(); | |
763 | this.editFields.hide(); |
|
644 | this.editFields.hide(); | |
764 | this.closeButton.hide(); |
|
645 | this.closeButton.hide(); | |
765 | this.viewFields.show(); |
|
646 | this.viewFields.show(); | |
766 | } |
|
647 | } | |
767 | }; |
|
648 | }; | |
768 |
|
649 | |||
769 | var ReviewersPanel = { |
|
650 | var ReviewersPanel = { | |
770 | editButton: $('#open_edit_reviewers'), |
|
651 | editButton: $('#open_edit_reviewers'), | |
771 | closeButton: $('#close_edit_reviewers'), |
|
652 | closeButton: $('#close_edit_reviewers'), | |
772 | addButton: $('#add_reviewer_input'), |
|
653 | addButton: $('#add_reviewer_input'), | |
773 | removeButtons: $('.reviewer_member_remove'), |
|
654 | removeButtons: $('.reviewer_member_remove'), | |
774 |
|
655 | |||
775 | init: function() { |
|
656 | init: function() { | |
776 | var that = this; |
|
657 | var that = this; | |
777 | this.editButton.on('click', function(e) { that.edit(); }); |
|
658 | this.editButton.on('click', function(e) { that.edit(); }); | |
778 | this.closeButton.on('click', function(e) { that.close(); }); |
|
659 | this.closeButton.on('click', function(e) { that.close(); }); | |
779 | }, |
|
660 | }, | |
780 |
|
661 | |||
781 | edit: function(event) { |
|
662 | edit: function(event) { | |
782 | this.editButton.hide(); |
|
663 | this.editButton.hide(); | |
783 | this.closeButton.show(); |
|
664 | this.closeButton.show(); | |
784 | this.addButton.show(); |
|
665 | this.addButton.show(); | |
785 | this.removeButtons.css('visibility', 'visible'); |
|
666 | this.removeButtons.css('visibility', 'visible'); | |
786 | }, |
|
667 | }, | |
787 |
|
668 | |||
788 | close: function(event) { |
|
669 | close: function(event) { | |
789 | this.editButton.show(); |
|
670 | this.editButton.show(); | |
790 | this.closeButton.hide(); |
|
671 | this.closeButton.hide(); | |
791 | this.addButton.hide(); |
|
672 | this.addButton.hide(); | |
792 | this.removeButtons.css('visibility', 'hidden'); |
|
673 | this.removeButtons.css('visibility', 'hidden'); | |
793 | } |
|
674 | } | |
794 | }; |
|
675 | }; | |
795 |
|
676 | |||
796 | PRDetails.init(); |
|
677 | PRDetails.init(); | |
797 | ReviewersPanel.init(); |
|
678 | ReviewersPanel.init(); | |
798 |
|
679 | |||
799 | showOutdated = function(self){ |
|
680 | showOutdated = function(self){ | |
800 | $('.comment-inline.comment-outdated').show(); |
|
681 | $('.comment-inline.comment-outdated').show(); | |
801 | $('.filediff-outdated').show(); |
|
682 | $('.filediff-outdated').show(); | |
802 | $('.showOutdatedComments').hide(); |
|
683 | $('.showOutdatedComments').hide(); | |
803 | $('.hideOutdatedComments').show(); |
|
684 | $('.hideOutdatedComments').show(); | |
804 | }; |
|
685 | }; | |
805 |
|
686 | |||
806 | hideOutdated = function(self){ |
|
687 | hideOutdated = function(self){ | |
807 | $('.comment-inline.comment-outdated').hide(); |
|
688 | $('.comment-inline.comment-outdated').hide(); | |
808 | $('.filediff-outdated').hide(); |
|
689 | $('.filediff-outdated').hide(); | |
809 | $('.hideOutdatedComments').hide(); |
|
690 | $('.hideOutdatedComments').hide(); | |
810 | $('.showOutdatedComments').show(); |
|
691 | $('.showOutdatedComments').show(); | |
811 | }; |
|
692 | }; | |
812 |
|
693 | |||
813 | refreshMergeChecks = function(){ |
|
694 | refreshMergeChecks = function(){ | |
814 | var loadUrl = "${h.url.current(merge_checks=1)}"; |
|
695 | var loadUrl = "${h.url.current(merge_checks=1)}"; | |
815 | $('.pull-request-merge').css('opacity', 0.3); |
|
696 | $('.pull-request-merge').css('opacity', 0.3); | |
816 | $('.pull-request-merge').load( |
|
697 | $('.pull-request-merge').load( | |
817 | loadUrl,function() { |
|
698 | loadUrl,function() { | |
818 | $('.pull-request-merge').css('opacity', 1); |
|
699 | $('.pull-request-merge').css('opacity', 1); | |
819 | } |
|
700 | } | |
820 | ); |
|
701 | ); | |
821 | }; |
|
702 | }; | |
822 |
|
703 | |||
823 | $('#show-outdated-comments').on('click', function(e){ |
|
704 | $('#show-outdated-comments').on('click', function(e){ | |
824 | var button = $(this); |
|
705 | var button = $(this); | |
825 | var outdated = $('.comment-outdated'); |
|
706 | var outdated = $('.comment-outdated'); | |
826 |
|
707 | |||
827 | if (button.html() === "(Show)") { |
|
708 | if (button.html() === "(Show)") { | |
828 | button.html("(Hide)"); |
|
709 | button.html("(Hide)"); | |
829 | outdated.show(); |
|
710 | outdated.show(); | |
830 | } else { |
|
711 | } else { | |
831 | button.html("(Show)"); |
|
712 | button.html("(Show)"); | |
832 | outdated.hide(); |
|
713 | outdated.hide(); | |
833 | } |
|
714 | } | |
834 | }); |
|
715 | }); | |
835 |
|
716 | |||
836 | $('.show-inline-comments').on('change', function(e){ |
|
717 | $('.show-inline-comments').on('change', function(e){ | |
837 | var show = 'none'; |
|
718 | var show = 'none'; | |
838 | var target = e.currentTarget; |
|
719 | var target = e.currentTarget; | |
839 | if(target.checked){ |
|
720 | if(target.checked){ | |
840 | show = '' |
|
721 | show = '' | |
841 | } |
|
722 | } | |
842 | var boxid = $(target).attr('id_for'); |
|
723 | var boxid = $(target).attr('id_for'); | |
843 | var comments = $('#{0} .inline-comments'.format(boxid)); |
|
724 | var comments = $('#{0} .inline-comments'.format(boxid)); | |
844 | var fn_display = function(idx){ |
|
725 | var fn_display = function(idx){ | |
845 | $(this).css('display', show); |
|
726 | $(this).css('display', show); | |
846 | }; |
|
727 | }; | |
847 | $(comments).each(fn_display); |
|
728 | $(comments).each(fn_display); | |
848 | var btns = $('#{0} .inline-comments-button'.format(boxid)); |
|
729 | var btns = $('#{0} .inline-comments-button'.format(boxid)); | |
849 | $(btns).each(fn_display); |
|
730 | $(btns).each(fn_display); | |
850 | }); |
|
731 | }); | |
851 |
|
732 | |||
852 | $('#merge_pull_request_form').submit(function() { |
|
733 | $('#merge_pull_request_form').submit(function() { | |
853 | if (!$('#merge_pull_request').attr('disabled')) { |
|
734 | if (!$('#merge_pull_request').attr('disabled')) { | |
854 | $('#merge_pull_request').attr('disabled', 'disabled'); |
|
735 | $('#merge_pull_request').attr('disabled', 'disabled'); | |
855 | } |
|
736 | } | |
856 | return true; |
|
737 | return true; | |
857 | }); |
|
738 | }); | |
858 |
|
739 | |||
859 | $('#edit_pull_request').on('click', function(e){ |
|
740 | $('#edit_pull_request').on('click', function(e){ | |
860 | var title = $('#pr-title-input').val(); |
|
741 | var title = $('#pr-title-input').val(); | |
861 | var description = codeMirrorInstance.getValue(); |
|
742 | var description = codeMirrorInstance.getValue(); | |
862 | editPullRequest( |
|
743 | editPullRequest( | |
863 | "${c.repo_name}", "${c.pull_request.pull_request_id}", |
|
744 | "${c.repo_name}", "${c.pull_request.pull_request_id}", | |
864 | title, description); |
|
745 | title, description); | |
865 | }); |
|
746 | }); | |
866 |
|
747 | |||
867 | $('#update_pull_request').on('click', function(e){ |
|
748 | $('#update_pull_request').on('click', function(e){ | |
868 | updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
749 | updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
869 | }); |
|
750 | }); | |
870 |
|
751 | |||
871 | $('#update_commits').on('click', function(e){ |
|
752 | $('#update_commits').on('click', function(e){ | |
872 | var isDisabled = !$(e.currentTarget).attr('disabled'); |
|
753 | var isDisabled = !$(e.currentTarget).attr('disabled'); | |
873 | $(e.currentTarget).text(_gettext('Updating...')); |
|
754 | $(e.currentTarget).text(_gettext('Updating...')); | |
874 | $(e.currentTarget).attr('disabled', 'disabled'); |
|
755 | $(e.currentTarget).attr('disabled', 'disabled'); | |
875 | if(isDisabled){ |
|
756 | if(isDisabled){ | |
876 | updateCommits("${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
757 | updateCommits("${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
877 | } |
|
758 | } | |
878 |
|
759 | |||
879 | }); |
|
760 | }); | |
880 | // fixing issue with caches on firefox |
|
761 | // fixing issue with caches on firefox | |
881 | $('#update_commits').removeAttr("disabled"); |
|
762 | $('#update_commits').removeAttr("disabled"); | |
882 |
|
763 | |||
883 | $('#close_pull_request').on('click', function(e){ |
|
764 | $('#close_pull_request').on('click', function(e){ | |
884 | closePullRequest("${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
765 | closePullRequest("${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
885 | }); |
|
766 | }); | |
886 |
|
767 | |||
887 | $('.show-inline-comments').on('click', function(e){ |
|
768 | $('.show-inline-comments').on('click', function(e){ | |
888 | var boxid = $(this).attr('data-comment-id'); |
|
769 | var boxid = $(this).attr('data-comment-id'); | |
889 | var button = $(this); |
|
770 | var button = $(this); | |
890 |
|
771 | |||
891 | if(button.hasClass("comments-visible")) { |
|
772 | if(button.hasClass("comments-visible")) { | |
892 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
773 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ | |
893 | $(this).hide(); |
|
774 | $(this).hide(); | |
894 | }); |
|
775 | }); | |
895 | button.removeClass("comments-visible"); |
|
776 | button.removeClass("comments-visible"); | |
896 | } else { |
|
777 | } else { | |
897 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ |
|
778 | $('#{0} .inline-comments'.format(boxid)).each(function(index){ | |
898 | $(this).show(); |
|
779 | $(this).show(); | |
899 | }); |
|
780 | }); | |
900 | button.addClass("comments-visible"); |
|
781 | button.addClass("comments-visible"); | |
901 | } |
|
782 | } | |
902 | }); |
|
783 | }); | |
903 |
|
784 | |||
904 | // register submit callback on commentForm form to track TODOs |
|
785 | // register submit callback on commentForm form to track TODOs | |
905 | window.commentFormGlobalSubmitSuccessCallback = function(){ |
|
786 | window.commentFormGlobalSubmitSuccessCallback = function(){ | |
906 | refreshMergeChecks(); |
|
787 | refreshMergeChecks(); | |
907 | }; |
|
788 | }; | |
908 |
|
789 | |||
909 | }) |
|
790 | }) | |
910 | </script> |
|
791 | </script> | |
911 |
|
792 | |||
912 | </div> |
|
793 | </div> | |
913 | </div> |
|
794 | </div> | |
914 |
|
795 | |||
915 | </%def> |
|
796 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now