remove broken refactoring
This commit is contained in:
@ -286,61 +286,59 @@ $(function() {
|
|||||||
session.setUseSoftTabs(true);
|
session.setUseSoftTabs(true);
|
||||||
session.setUseWrapMode(true);
|
session.setUseWrapMode(true);
|
||||||
|
|
||||||
setAnnotations(editor, $(element).data('file-id'))
|
var file_id = $(element).data('file-id');
|
||||||
|
setAnnotations(editor, file_id);
|
||||||
|
|
||||||
session.on('annotationRemoval', handleAnnotationRemoval)
|
session.on('annotationRemoval', handleAnnotationRemoval)
|
||||||
session.on('annotationChange', handleAnnotationChange)
|
session.on('annotationChange', handleAnnotationChange)
|
||||||
|
|
||||||
// TODO refactor here
|
// TODO refactor here
|
||||||
// Code for clicks on gutter / sidepanel
|
// Code for clicks on gutter / sidepanel
|
||||||
editor.on("guttermousedown", handleGutterClick);
|
editor.on("guttermousedown", function(e){
|
||||||
})
|
var target = e.domEvent.target;
|
||||||
}
|
|
||||||
|
|
||||||
var handleGutterClick = function(e){
|
if (target.className.indexOf("ace_gutter-cell") == -1) return;
|
||||||
var file_id = $(element).data('file-id');
|
if (!editor.isFocused()) return;
|
||||||
var target = e.domEvent.target;
|
if (e.clientX > 25 + target.getBoundingClientRect().left) return;
|
||||||
|
|
||||||
if (target.className.indexOf("ace_gutter-cell") == -1) return;
|
var row = e.getDocumentPosition().row;
|
||||||
if (!editor.isFocused()) return;
|
e.stop();
|
||||||
if (e.clientX > 25 + target.getBoundingClientRect().left) return;
|
|
||||||
|
|
||||||
var row = e.getDocumentPosition().row;
|
var commentModal = $('#comment-modal')
|
||||||
e.stop();
|
|
||||||
|
|
||||||
var commentModal = $('#comment-modal')
|
if (hasCommentsInRow(editor, row)) {
|
||||||
|
var rowComments = getCommentsForRow(editor, row)
|
||||||
|
var comments = _.pluck(rowComments, 'text').join('\n')
|
||||||
|
commentModal.find('#other-comments').text(comments)
|
||||||
|
} else {
|
||||||
|
commentModal.find('#other-comments').text('none')
|
||||||
|
}
|
||||||
|
|
||||||
if (hasCommentsInRow(editor, row)) {
|
commentModal.find('#addCommentButton').off('click')
|
||||||
var rowComments = getCommentsForRow(editor, row)
|
commentModal.find('#removeAllButton').off('click')
|
||||||
var comments = _.pluck(rowComments, 'text').join('\n')
|
|
||||||
commentModal.find('#other-comments').text(comments)
|
|
||||||
} else {
|
|
||||||
commentModal.find('#other-comments').text('none')
|
|
||||||
}
|
|
||||||
|
|
||||||
commentModal.find('#addCommentButton').off('click')
|
commentModal.find('#addCommentButton').on('click', function(e){
|
||||||
commentModal.find('#removeAllButton').off('click')
|
var user_id = 18
|
||||||
|
var commenttext = commentModal.find('textarea').val()
|
||||||
|
|
||||||
commentModal.find('#addCommentButton').on('click', function(e){
|
if (commenttext !== "") {
|
||||||
var user_id = 18
|
createComment(user_id, file_id, row, editor, commenttext)
|
||||||
var commenttext = commentModal.find('textarea').val()
|
commentModal.modal('hide')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
if (commenttext !== "") {
|
commentModal.find('#removeAllButton').on('click', function(e){
|
||||||
createComment(user_id, file_id, row, editor, commenttext)
|
var user_id = 18;
|
||||||
commentModal.modal('hide')
|
deleteComment(user_id,file_id,row,editor);
|
||||||
}
|
commentModal.modal('hide')
|
||||||
})
|
})
|
||||||
|
|
||||||
commentModal.find('#removeAllButton').on('click', function(e){
|
commentModal.modal('show')
|
||||||
var user_id = 18;
|
});
|
||||||
deleteComment(user_id,file_id,row,editor);
|
});
|
||||||
commentModal.modal('hide')
|
};
|
||||||
})
|
|
||||||
|
|
||||||
commentModal.modal('show')
|
var hasCommentsInRow = function (editor, row){
|
||||||
}
|
|
||||||
|
|
||||||
var hasCommentsInRow = function (editor, row) {
|
|
||||||
return editor.getSession().getAnnotations().some(function(element) {
|
return editor.getSession().getAnnotations().some(function(element) {
|
||||||
return element.row === row
|
return element.row === row
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user