diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js index fd256e2d..3e9cf02f 100644 --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -112,6 +112,8 @@ var _submitAjaxPOST = function(url, postData, successHandler, failHandler) { this.cancelButton = this.withLineNo('#cancel-btn'); this.commentType = this.withLineNo('#comment_type'); + this.fileUploadSection = this.withLineNo("#file-upload-section"); + this.resolvesId = null; this.resolvesActionId = null; @@ -407,6 +409,14 @@ var _submitAjaxPOST = function(url, postData, successHandler, failHandler) { self.setActionButtonsDisabled(false); }; + this.showUploadSection = function(show) { + if (show) { + $(this.fileUploadSection).show(); + } else { + $(this.fileUploadSection).hide(); + } + } + this.setActionButtonsDisabled = function(state, excludeCancelBtn, submitEvent) { excludeCancelBtn = excludeCancelBtn || false; submitEvent = submitEvent || false; @@ -468,10 +478,14 @@ var _submitAjaxPOST = function(url, postData, successHandler, failHandler) { $(self.editButton).parent().addClass('active'); $(self.editContainer).show(); + self.showUploadSection(true); }); $(this.previewButton).on('click', function(e) { e.preventDefault(); + + self.showUploadSection(false); + var text = self.cm.getValue(); if (text === "") { @@ -501,9 +515,7 @@ var _submitAjaxPOST = function(url, postData, successHandler, failHandler) { self.resetCommentFormState(text) }; - self.submitAjaxPOST( - self.previewUrl, postData, self.previewSuccessCallback, - previewFailCallback); + self.submitAjaxPOST(self.previewUrl, postData, self.previewSuccessCallback, previewFailCallback); $(self.previewButton).parent().addClass('active'); $(self.editButton).parent().removeClass('active'); diff --git a/rhodecode/templates/changeset/changeset_file_comment.mako b/rhodecode/templates/changeset/changeset_file_comment.mako index d4b84ea1..237b3b3d 100644 --- a/rhodecode/templates/changeset/changeset_file_comment.mako +++ b/rhodecode/templates/changeset/changeset_file_comment.mako @@ -466,7 +466,7 @@