Merge pull request #1387 from okriuchykhin/ok_SCI_2877

Fix comments form for new results [SCI-2877]
This commit is contained in:
Alex Kriuchykhin 2018-11-22 10:28:09 +01:00 committed by GitHub
commit f811afc7e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 33 deletions

View file

@ -22,7 +22,6 @@ var Comments = (function() {
beforeSend: animateSpinner(that, true) })
.done(function(data) {
that.html(data.html);
})
.always(function() {
animateSpinner(that, false);
@ -51,7 +50,7 @@ var Comments = (function() {
// Initialize show more comments link.
function initCommentsLink($el) {
$el.find('.btn-more-comments')
$el.find('.btn-more-comments').off()
.on('ajax:success', function (e, data) {
if (data.html) {
var list = $(this).parents('ul');
@ -92,7 +91,7 @@ var Comments = (function() {
$('.help-block', $form).addClass('hide');
$form.on('ajax:send', function () {
$form.off().on('ajax:send', function () {
$('#comment_message', $form).attr('readonly', true);
})
.on('ajax:success', function (e, data) {
@ -164,33 +163,6 @@ var Comments = (function() {
});
}
// restore comments after update or when new element is created
function bindCommentInitializerToNewElement() {
if( document.getElementById('steps') !== null ) {
$('#steps')
.change(function() {
$('.step-save')
.on('click', function() {
$(document)
.on('ajax:success', function(){
initializeComments();
});
});
});
} else if ( document.getElementById('results') !== null ) {
$('#results')
.change(function() {
$('.save-result')
.on('click', function() {
$(document)
.on('ajax:success', function(){
initializeComments();
});
});
});
}
}
function initCommentOptions(scrollableContainer, useParentOffset) {
if ( ! _.isUndefined(useParentOffset) ) {
useParentOffset = useParentOffset;
@ -377,7 +349,6 @@ var Comments = (function() {
scrollBottom: scrollBottom,
moreComments: initCommentsLink,
form: initCommentForm,
bindNewElement: bindCommentInitializerToNewElement,
initCommentOptions: initCommentOptions,
initDeleteComments: initDeleteComments,
initEditComments: initEditComments

View file

@ -16,7 +16,6 @@ function init() {
initLoadFromRepository();
initRefreshStatusBar();
initImport();
Comments.bindNewElement();
setupAssetsLoading();
}

View file

@ -17,7 +17,6 @@
_expandAllResults();
applyCollapseLinkCallBack();
Comments.bindNewElement();
Comments.initialize();
Comments.initCommentOptions('ul.content-comments');