diff options
-rw-r--r-- | public/js/index.js | 10 | ||||
-rw-r--r-- | templates/repo/diff/comment_form.tmpl | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/public/js/index.js b/public/js/index.js index c04af8cbe4..46ff00d01c 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1,6 +1,6 @@ /* globals wipPrefixes, issuesTribute, emojiTribute */ /* exported timeAddManual, toggleStopwatch, cancelStopwatch, initHeatmap */ -/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */ +/* exported toggleDeadlineForm, setDeadline, deleteDependencyModal, submitReply, cancelCodeComment, onOAuthLoginClick */ 'use strict'; function htmlEncode(text) { @@ -3171,6 +3171,14 @@ function cancelCodeComment(btn) { form.closest('.comment-code-cloud').remove() } } + +function submitReply(btn) { + const form = $(btn).closest('form'); + if (form.length > 0 && form.hasClass('comment-form')) { + form.submit(); + } +} + function onOAuthLoginClick() { const oauthLoader = $('#oauth2-login-loader'); const oauthNav = $('#oauth2-login-navigator'); diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 38fd3fa7fb..5f3bbc4483 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -26,7 +26,8 @@ <span class="markdown-info"><i class="octicon octicon-markdown"></i> {{$.root.i18n.Tr "repo.diff.comment.markdown_info"}}</span> <div class="ui right floated"> {{if $.reply}} - <button name="reply" value="{{$.reply}}" class="ui submit green tiny button btn-reply">{{$.root.i18n.Tr "repo.diff.comment.reply"}}</button> + <input type="hidden" name="reply" value="{{$.reply}}"> + <button class="ui submit green tiny button btn-reply" onclick="submitReply(this);">{{$.root.i18n.Tr "repo.diff.comment.reply"}}</button> {{else}} {{if $.root.CurrentReview}} <button name="is_review" value="true" type="submit" |