##// END OF EJS Templates
comments: improved comments form layout....
marcink -
r1281:71c01ca9 default
parent child Browse files
Show More
@@ -911,7 +911,6 b' input.filediff-collapse-state {'
911
911
912 .inline-comments {
912 .inline-comments {
913 border-radius: @border-radius;
913 border-radius: @border-radius;
914 background: @grey6;
915 .comment {
914 .comment {
916 margin: 0;
915 margin: 0;
917 border-radius: @border-radius;
916 border-radius: @border-radius;
@@ -194,7 +194,6 b' form.comment-form {'
194 .comment-inline-form .comment-block-ta,
194 .comment-inline-form .comment-block-ta,
195 .comment-form .comment-block-ta,
195 .comment-form .comment-block-ta,
196 .comment-form .preview-box {
196 .comment-form .preview-box {
197 border: @border-thickness solid @grey5;
198 .border-radius(@border-radius);
197 .border-radius(@border-radius);
199 .box-sizing(border-box);
198 .box-sizing(border-box);
200 background-color: white;
199 background-color: white;
@@ -259,6 +258,7 b' form.comment-form {'
259
258
260 .comment-footer {
259 .comment-footer {
261 margin-bottom: 110px;
260 margin-bottom: 110px;
261 margin-top: 10px;
262 }
262 }
263 }
263 }
264
264
@@ -276,11 +276,9 b' form.comment-form {'
276 }
276 }
277
277
278 .preview-box {
278 .preview-box {
279 padding: 10px;
279 min-height: 105px;
280 min-height: 100px;
281 margin-bottom: 15px;
280 margin-bottom: 15px;
282 background-color: white;
281 background-color: white;
283 border: @border-thickness solid #ccc;
284 .border-radius(@border-radius);
282 .border-radius(@border-radius);
285 .box-sizing(border-box);
283 .box-sizing(border-box);
286 }
284 }
@@ -299,7 +297,7 b' form.comment-form {'
299 // Inline Comment Form
297 // Inline Comment Form
300 .injected_diff .comment-inline-form,
298 .injected_diff .comment-inline-form,
301 .comment-inline-form {
299 .comment-inline-form {
302 background-color: @grey6;
300 background-color: white;
303 margin-top: 10px;
301 margin-top: 10px;
304 margin-bottom: 20px;
302 margin-bottom: 20px;
305 }
303 }
@@ -337,9 +335,73 b' form.comment-form {'
337 margin: 0px;
335 margin: 0px;
338 }
336 }
339
337
338 .comment-inline-form .comment-footer {
339 margin: 10px 0px 0px 0px;
340 }
341
340 .hide-inline-form-button {
342 .hide-inline-form-button {
341 margin-left: 5px;
343 margin-left: 5px;
342 }
344 }
343 .comment-button .hide-inline-form {
345 .comment-button .hide-inline-form {
344 background: white;
346 background: white;
345 }
347 }
348
349 .comment-area {
350 padding: 8px 12px;
351 border: 1px solid @grey5;
352 .border-radius(@border-radius);
353 }
354
355 .comment-area-header .nav-links {
356 display: flex;
357 flex-flow: row wrap;
358 -webkit-flex-flow: row wrap;
359 width: 100%;
360 }
361
362 .comment-area-footer {
363 display: flex;
364 }
365
366 .comment-footer .toolbar {
367
368 }
369
370 .nav-links {
371 padding: 0;
372 margin: 0;
373 list-style: none;
374 height: auto;
375 border-bottom: 1px solid @grey5;
376 }
377 .nav-links li {
378 display: inline-block;
379 }
380 .nav-links li:before {
381 content: "";
382 }
383 .nav-links li a.disabled {
384 cursor: not-allowed;
385 }
386
387 .nav-links li.active a {
388 border-bottom: 2px solid @rcblue;
389 color: #000;
390 font-weight: 600;
391 }
392 .nav-links li a {
393 display: inline-block;
394 padding: 0px 10px 5px 10px;
395 margin-bottom: -1px;
396 font-size: 14px;
397 line-height: 28px;
398 color: #8f8f8f;
399 border-bottom: 2px solid transparent;
400 }
401
402 .toolbar-text {
403 float: left;
404 margin: -5px 0px 0px 0px;
405 font-size: 12px;
406 }
407
@@ -216,10 +216,10 b' var CommentForm = (function() {'
216 content = content || '';
216 content = content || '';
217
217
218 $(this.editContainer).show();
218 $(this.editContainer).show();
219 $(this.editButton).hide();
219 $(this.editButton).parent().addClass('active');
220
220
221 $(this.previewContainer).hide();
221 $(this.previewContainer).hide();
222 $(this.previewButton).show();
222 $(this.previewButton).parent().removeClass('active');
223
223
224 this.setActionButtonsDisabled(true);
224 this.setActionButtonsDisabled(true);
225 self.cm.setValue(content);
225 self.cm.setValue(content);
@@ -292,9 +292,9 b' var CommentForm = (function() {'
292 $(self.previewBoxSelector).html(o);
292 $(self.previewBoxSelector).html(o);
293 $(self.previewBoxSelector).removeClass('unloaded');
293 $(self.previewBoxSelector).removeClass('unloaded');
294
294
295 // swap buttons
295 // swap buttons, making preview active
296 $(self.previewButton).hide();
296 $(self.previewButton).parent().addClass('active');
297 $(self.editButton).show();
297 $(self.editButton).parent().removeClass('active');
298
298
299 // unlock buttons
299 // unlock buttons
300 self.setActionButtonsDisabled(false);
300 self.setActionButtonsDisabled(false);
@@ -344,9 +344,10 b' var CommentForm = (function() {'
344 $(this.editButton).on('click', function(e) {
344 $(this.editButton).on('click', function(e) {
345 e.preventDefault();
345 e.preventDefault();
346
346
347 $(self.previewButton).show();
347 $(self.previewButton).parent().removeClass('active');
348 $(self.previewContainer).hide();
348 $(self.previewContainer).hide();
349 $(self.editButton).hide();
349
350 $(self.editButton).parent().addClass('active');
350 $(self.editContainer).show();
351 $(self.editContainer).show();
351
352
352 });
353 });
@@ -370,6 +371,7 b' var CommentForm = (function() {'
370
371
371 $(self.previewBoxSelector).addClass('unloaded');
372 $(self.previewBoxSelector).addClass('unloaded');
372 $(self.previewBoxSelector).html(_gettext('Loading ...'));
373 $(self.previewBoxSelector).html(_gettext('Loading ...'));
374
373 $(self.editContainer).hide();
375 $(self.editContainer).hide();
374 $(self.previewContainer).show();
376 $(self.previewContainer).show();
375
377
@@ -378,8 +380,11 b' var CommentForm = (function() {'
378 self.resetCommentFormState(text)
380 self.resetCommentFormState(text)
379 };
381 };
380 self.submitAjaxPOST(
382 self.submitAjaxPOST(
381 self.previewUrl, postData, self.previewSuccessCallback, previewFailCallback);
383 self.previewUrl, postData, self.previewSuccessCallback,
384 previewFailCallback);
382
385
386 $(self.previewButton).parent().addClass('active');
387 $(self.editButton).parent().removeClass('active');
383 });
388 });
384
389
385 $(this.submitForm).submit(function(e) {
390 $(this.submitForm).submit(function(e) {
@@ -606,7 +611,9 b' var CommentsController = function() { /*'
606 setTimeout(function() {
611 setTimeout(function() {
607 // callbacks
612 // callbacks
608 if (cm !== undefined) {
613 if (cm !== undefined) {
614 cm.setOption('placeholder', _gettext('Leave a comment on line {0}.').format(lineno));
609 cm.focus();
615 cm.focus();
616 cm.refresh();
610 }
617 }
611 }, 10);
618 }, 10);
612
619
@@ -131,36 +131,50 b''
131 </div>
131 </div>
132 %endif
132 %endif
133 <div class="comments">
133 <div class="comments">
134 %if c.rhodecode_user.username != h.DEFAULT_USER:
134 <%
135 if is_pull_request:
136 placeholder = _('Leave a comment on this Pull Request.')
137 elif is_compare:
138 placeholder = _('Leave a comment on all commits in this range.')
139 else:
140 placeholder = _('Leave a comment on this Commit.')
141 %>
142 % if c.rhodecode_user.username != h.DEFAULT_USER:
135 <div class="comment-form ac">
143 <div class="comment-form ac">
136 ${h.secure_form(post_url, id_=form_id)}
144 ${h.secure_form(post_url, id_=form_id)}
137 <div id="edit-container" class="clearfix">
145 <div class="comment-area">
138 <div class="comment-title pull-left">
146 <div class="comment-area-header">
139 %if is_pull_request:
147 <ul class="nav-links clearfix">
140 ${(_('Create a comment on this Pull Request.'))}
148 <li class="active">
141 %elif is_compare:
149 <a href="#edit-btn" tabindex="-1" id="edit-btn">${_('Write')}</a>
142 ${(_('Create comments on this Commit range.'))}
150 </li>
143 %else:
151 <li class="">
144 ${(_('Create a comment on this Commit.'))}
152 <a href="#preview-btn" tabindex="-1" id="preview-btn">${_('Preview')}</a>
145 %endif
153 </li>
154 </ul>
146 </div>
155 </div>
147 <div class="comment-help pull-right">
156
148 ${(_('Comments parsed using %s syntax with %s support.') % (
157 <div class="comment-area-write" style="display: block;">
149 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
158 <div id="edit-container">
150 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
159 <textarea id="text" name="text" class="comment-block-ta ac-input"></textarea>
151 )
160 </div>
152 )|n
161 <div id="preview-container" class="clearfix" style="display: none;">
153 }
162 <div id="preview-box" class="preview-box"></div>
163 </div>
154 </div>
164 </div>
155 <div style="clear: both"></div>
156 ${h.textarea('text', class_="comment-block-ta")}
157 </div>
158
165
159 <div id="preview-container" class="clearfix" style="display: none;">
166 <div class="comment-area-footer">
160 <div class="comment-title">
167 <div class="toolbar">
161 ${_('Comment preview')}
168 <div class="toolbar-text">
169 ${(_('Comments parsed using %s syntax with %s support.') % (
170 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
171 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
172 )
173 )|n
174 }
175 </div>
176 </div>
162 </div>
177 </div>
163 <div id="preview-box" class="preview-box"></div>
164 </div>
178 </div>
165
179
166 <div id="comment_form_extras">
180 <div id="comment_form_extras">
@@ -185,15 +199,54 b''
185 </div>
199 </div>
186 %endif
200 %endif
187 <div class="action-buttons">
201 <div class="action-buttons">
188 <button id="preview-btn" class="btn btn-secondary">${_('Preview')}</button>
189 <button id="edit-btn" class="btn btn-secondary" style="display:none;">${_('Edit')}</button>
190 <div class="comment-button">${h.submit('save', _('Comment'), class_="btn btn-success comment-button-input")}</div>
202 <div class="comment-button">${h.submit('save', _('Comment'), class_="btn btn-success comment-button-input")}</div>
191 </div>
203 </div>
192 </div>
204 </div>
193 ${h.end_form()}
205 ${h.end_form()}
194 </div>
206 </div>
195 %endif
207 % else:
208 <div class="comment-form ac">
209
210 <div class="comment-area">
211 <div class="comment-area-header">
212 <ul class="nav-links clearfix">
213 <li class="active">
214 <a class="disabled" href="#edit-btn" disabled="disabled" onclick="return false">${_('Write')}</a>
215 </li>
216 <li class="">
217 <a class="disabled" href="#preview-btn" disabled="disabled" onclick="return false">${_('Preview')}</a>
218 </li>
219 </ul>
220 </div>
221
222 <div class="comment-area-write" style="display: block;">
223 <div id="edit-container">
224 <div style="padding: 40px 0">
225 ${_('You need to be logged in to leave comments.')}
226 <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
227 </div>
228 </div>
229 <div id="preview-container" class="clearfix" style="display: none;">
230 <div id="preview-box" class="preview-box"></div>
231 </div>
232 </div>
233
234 <div class="comment-area-footer">
235 <div class="toolbar">
236 <div class="toolbar-text">
237 </div>
238 </div>
239 </div>
240 </div>
241
242 <div class="comment-footer">
243 </div>
244
245 </div>
246 % endif
247
196 </div>
248 </div>
249
197 <script>
250 <script>
198 // init active elements of commentForm
251 // init active elements of commentForm
199 var commitId = templateContext.commit_data.commit_id;
252 var commitId = templateContext.commit_data.commit_id;
@@ -203,6 +256,8 b''
203 var mainCommentForm = new CommentForm(
256 var mainCommentForm = new CommentForm(
204 "#${form_id}", commitId, pullRequestId, lineNo, true);
257 "#${form_id}", commitId, pullRequestId, lineNo, true);
205
258
259 mainCommentForm.cm.setOption('placeholder', "${placeholder}");
260
206 mainCommentForm.initStatusChangeSelector();
261 mainCommentForm.initStatusChangeSelector();
207 bindToggleButtons();
262 bindToggleButtons();
208 </script>
263 </script>
@@ -89,7 +89,7 b''
89
89
90 </div> <!-- end summary -->
90 </div> <!-- end summary -->
91
91
92 <div id="changeset_compare_view_content">
92 <div id="changeset_compare_view_content">
93 <div class="pull-left">
93 <div class="pull-left">
94 <div class="btn-group">
94 <div class="btn-group">
95 <a
95 <a
@@ -52,41 +52,52 b" return h.url('', **new_args)"
52 </div>
52 </div>
53 <div class="js-template" id="cb-comment-inline-form-template">
53 <div class="js-template" id="cb-comment-inline-form-template">
54 <div class="comment-inline-form ac">
54 <div class="comment-inline-form ac">
55
55 %if c.rhodecode_user.username != h.DEFAULT_USER:
56 %if c.rhodecode_user.username != h.DEFAULT_USER:
56 ${h.form('#', method='get')}
57 ${h.form('#', method='get')}
57 <div id="edit-container_{1}" class="clearfix">
58 <div class="comment-area">
58 <div class="comment-title pull-left">
59 <div class="comment-area-header">
59 ${_('Create a comment on line {1}.')}
60 <ul class="nav-links clearfix">
60 </div>
61 <li class="active">
61 <div class="comment-help pull-right">
62 <a href="#edit-btn" tabindex="-1" id="edit-btn_{1}">${_('Write')}</a>
62 ${(_('Comments parsed using %s syntax with %s support.') % (
63 </li>
63 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
64 <li class="">
64 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
65 <a href="#preview-btn" tabindex="-1" id="preview-btn_{1}">${_('Preview')}</a>
65 )
66 </li>
66 )|n
67 </ul>
67 }
68 </div>
68 </div>
69
69 <div style="clear: both"></div>
70 <div class="comment-area-write" style="display: block;">
70 <textarea id="text_{1}" name="text" class="comment-block-ta ac-input"></textarea>
71 <div id="edit-container_{1}">
72 <textarea id="text_{1}" name="text" class="comment-block-ta ac-input"></textarea>
73 </div>
74 <div id="preview-container_{1}" class="clearfix" style="display: none;">
75 <div id="preview-box_{1}" class="preview-box"></div>
76 </div>
77 </div>
78
79 <div class="comment-area-footer">
80 <div class="toolbar">
81 <div class="toolbar-text">
82 ${(_('Comments parsed using %s syntax with %s support.') % (
83 ('<a href="%s">%s</a>' % (h.url('%s_help' % c.visual.default_renderer), c.visual.default_renderer.upper())),
84 ('<span class="tooltip" title="%s">@mention</span>' % _('Use @username inside this text to send notification to this RhodeCode user'))
85 )
86 )|n
87 }
88 </div>
89 </div>
90 </div>
71 </div>
91 </div>
72 <div id="preview-container_{1}" class="clearfix" style="display: none;">
92
73 <div class="comment-help">
74 ${_('Comment preview')}
75 </div>
76 <div id="preview-box_{1}" class="preview-box"></div>
77 </div>
78 <div class="comment-footer">
93 <div class="comment-footer">
79 <div class="action-buttons">
94 <div class="action-buttons">
80 <input type="hidden" name="f_path" value="{0}">
95 <input type="hidden" name="f_path" value="{0}">
81 <input type="hidden" name="line" value="{1}">
96 <input type="hidden" name="line" value="{1}">
82 <button id="preview-btn_{1}" class="btn btn-secondary">${_('Preview')}</button>
97 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
83 <button id="edit-btn_{1}" class="btn btn-secondary" style="display: none;">${_('Edit')}</button>
98 ${_('Cancel')}
84 ${h.submit('save', _('Comment'), class_='btn btn-success save-inline-form')}
99 </button>
85 </div>
100 ${h.submit('save', _('Comment'), class_='btn btn-success save-inline-form')}
86 <div class="comment-button">
87 <button type="button" class="cb-comment-cancel" onclick="return Rhodecode.comments.cancelComment(this);">
88 ${_('Cancel')}
89 </button>
90 </div>
101 </div>
91 ${h.end_form()}
102 ${h.end_form()}
92 </div>
103 </div>
@@ -94,7 +105,7 b" return h.url('', **new_args)"
94 ${h.form('', class_='inline-form comment-form-login', method='get')}
105 ${h.form('', class_='inline-form comment-form-login', method='get')}
95 <div class="pull-left">
106 <div class="pull-left">
96 <div class="comment-help pull-right">
107 <div class="comment-help pull-right">
97 ${_('You need to be logged in to comment.')} <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
108 ${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
98 </div>
109 </div>
99 </div>
110 </div>
100 <div class="comment-button pull-right">
111 <div class="comment-button pull-right">
@@ -120,6 +131,7 b' collapse_all = len(diffset.files) > coll'
120 }
131 }
121 </style>
132 </style>
122 %endif
133 %endif
134
123 %if ruler_at_chars:
135 %if ruler_at_chars:
124 <style>
136 <style>
125 .diff table.cb .cb-content:after {
137 .diff table.cb .cb-content:after {
@@ -134,6 +146,7 b' collapse_all = len(diffset.files) > coll'
134 left: ${ruler_at_chars + 5}ch;
146 left: ${ruler_at_chars + 5}ch;
135 </style>
147 </style>
136 %endif
148 %endif
149
137 <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
150 <div class="diffset ${disable_new_comments and 'diffset-comments-disabled'}">
138 <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
151 <div class="diffset-heading ${diffset.limited_diff and 'diffset-heading-warning' or ''}">
139 %if commit:
152 %if commit:
@@ -26,10 +26,10 b''
26 </%def>
26 </%def>
27
27
28 <%def name="main()">
28 <%def name="main()">
29 <script type="text/javascript">
29 <script type="text/javascript">
30 // set fake commitId on this commit-range page
30 // set fake commitId on this commit-range page
31 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
31 templateContext.commit_data.commit_id = "${h.EmptyCommit().raw_id}";
32 </script>
32 </script>
33
33
34 <div class="box">
34 <div class="box">
35 <div class="title">
35 <div class="title">
@@ -153,16 +153,78 b''
153 </div>
153 </div>
154 </%doc>
154 </%doc>
155
155
156 ## commit status form
157 <div class="fieldset" id="compare_changeset_status" style="display: none; margin-bottom: -80px;">
158 <div class="left-label">
159 ${_('Commit status')}:
160 </div>
161 <div class="right-content">
162 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
163 ## main comment form and it status
164 <%
165 def revs(_revs):
166 form_inputs = []
167 for cs in _revs:
168 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
169 form_inputs.append(tmpl)
170 return form_inputs
171 %>
172 <div>
173 ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
174 <script type="text/javascript">
175
176 mainCommentForm.setHandleFormSubmit(function(o) {
177 var text = mainCommentForm.cm.getValue();
178 var status = mainCommentForm.getCommentStatus();
179
180 if (text === "" && !status) {
181 return;
182 }
183
184 // we can pick which commits we want to make the comment by
185 // selecting them via click on preview pane, this will alter the hidden inputs
186 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
187
188 var commitIds = [];
189 $('#changeset_compare_view_content .compare_select').each(function(el) {
190 var commitId = this.id.replace('row-', '');
191 if ($(this).hasClass('hl') || !cherryPicked) {
192 $("input[data-commit-id='{0}']".format(commitId)).val(commitId)
193 commitIds.push(commitId);
194 } else {
195 $("input[data-commit-id='{0}']".format(commitId)).val('')
196 }
197 });
198
199 mainCommentForm.setActionButtonsDisabled(true);
200 mainCommentForm.cm.setOption("readOnly", true);
201 var postData = {
202 'text': text,
203 'changeset_status': status,
204 'commit_ids': commitIds,
205 'csrf_token': CSRF_TOKEN
206 };
207
208 var submitSuccessCallback = function(o) {
209 location.reload(true);
210 };
211 var submitFailCallback = function(){
212 mainCommentForm.resetCommentFormState(text)
213 };
214 mainCommentForm.submitAjaxPOST(
215 mainCommentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
216 });
217 </script>
218 </div>
219 </div>
220 </div>
221
156 </div> <!-- end summary-detail -->
222 </div> <!-- end summary-detail -->
157
158 </div> <!-- end summary -->
223 </div> <!-- end summary -->
159
224
160
225 ## use JS script to load it quickly before potentially large diffs render long time
161 <div class="table">
226 ## this prevents from situation when large diffs block rendering of select2 fields
162
227 <script type="text/javascript">
163 ## use JS script to load it quickly before potentially large diffs render long time
164 ## this prevents from situation when large diffs block rendering of select2 fields
165 <script type="text/javascript">
166
228
167 var cache = {};
229 var cache = {};
168
230
@@ -277,69 +339,13 b''
277 $('#compare_changeset_status').toggle();
339 $('#compare_changeset_status').toggle();
278 });
340 });
279
341
280 </script>
342 </script>
281
282 ## changeset status form
283 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
284 ## main comment form and it status
285 <%
286 def revs(_revs):
287 form_inputs = []
288 for cs in _revs:
289 tmpl = '<input type="hidden" data-commit-id="%(cid)s" name="commit_ids" value="%(cid)s">' % {'cid': cs.raw_id}
290 form_inputs.append(tmpl)
291 return form_inputs
292 %>
293 <div id="compare_changeset_status" style="display: none;">
294 ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision='0'*16), None, is_compare=True, form_extras=revs(c.commit_ranges))}
295 <script type="text/javascript">
296
297 mainCommentForm.setHandleFormSubmit(function(o) {
298 var text = mainCommentForm.cm.getValue();
299 var status = mainCommentForm.getCommentStatus();
300
301 if (text === "" && !status) {
302 return;
303 }
304
305 // we can pick which commits we want to make the comment by
306 // selecting them via click on preview pane, this will alter the hidden inputs
307 var cherryPicked = $('#changeset_compare_view_content .compare_select.hl').length > 0;
308
343
309 var commitIds = [];
344 ## table diff data
310 $('#changeset_compare_view_content .compare_select').each(function(el) {
345 <div class="table">
311 var commitId = this.id.replace('row-', '');
312 if ($(this).hasClass('hl') || !cherryPicked) {
313 $("input[data-commit-id='{0}']".format(commitId)).val(commitId)
314 commitIds.push(commitId);
315 } else {
316 $("input[data-commit-id='{0}']".format(commitId)).val('')
317 }
318 });
319
346
320 mainCommentForm.setActionButtonsDisabled(true);
321 mainCommentForm.cm.setOption("readOnly", true);
322 var postData = {
323 'text': text,
324 'changeset_status': status,
325 'commit_ids': commitIds,
326 'csrf_token': CSRF_TOKEN
327 };
328
347
329 var submitSuccessCallback = function(o) {
348 % if not c.compare_home:
330 location.reload(true);
331 };
332 var submitFailCallback = function(){
333 mainCommentForm.resetCommentFormState(text)
334 };
335 mainCommentForm.submitAjaxPOST(
336 mainCommentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
337 });
338 </script>
339
340 </div>
341
342 %if not c.compare_home:
343 <div id="changeset_compare_view_content">
349 <div id="changeset_compare_view_content">
344 <div class="pull-left">
350 <div class="pull-left">
345 <div class="btn-group">
351 <div class="btn-group">
@@ -363,8 +369,9 b''
363 ${cbdiffs.render_diffset_menu()}
369 ${cbdiffs.render_diffset_menu()}
364 ${cbdiffs.render_diffset(c.diffset)}
370 ${cbdiffs.render_diffset(c.diffset)}
365 </div>
371 </div>
366 %endif
372 % endif
373
367 </div>
374 </div>
368 </div>
375 </div>
369 </div>
376
370 </%def>
377 </%def> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now