Finalize merge of commenting functionality

This commit is contained in:
Felix Wolff
2015-03-27 12:20:53 +01:00
parent a70053532b
commit ca63415533
2 changed files with 41 additions and 42 deletions

View File

@ -17,7 +17,6 @@ $(function() {
var active_frame; var active_frame;
var running = false; var running = false;
var flowrUrl = 'http://vm-teusner-webrtc.eaalab.hpi.uni-potsdam.de:3000/api/exceptioninfo?id=&lang=auto'
var flowrResultHtml = '<div class="panel panel-default"><div id="{{headingId}}" role="tab" class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#flowrHint" href="#{{collapseId}}" aria-expanded="true" aria-controls="{{collapseId}}"></a></h4></div><div id="{{collapseId}}" role="tabpanel" aria-labelledby="{{headingId}}" class="panel-collapse collapse"><div class="panel-body"></div></div></div>' var flowrResultHtml = '<div class="panel panel-default"><div id="{{headingId}}" role="tab" class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#flowrHint" href="#{{collapseId}}" aria-expanded="true" aria-controls="{{collapseId}}"></a></h4></div><div id="{{collapseId}}" role="tabpanel" aria-labelledby="{{headingId}}" class="panel-collapse collapse"><div class="panel-body"></div></div></div>'
var ajax = function(options) { var ajax = function(options) {
@ -233,6 +232,7 @@ $(function() {
return return
} }
var flowrUrl = $('#flowrHint').data('url')
var flowrHintBody = $('#flowrHint .panel-body') var flowrHintBody = $('#flowrHint .panel-body')
var queryParameters = { var queryParameters = {
query: stderrOutput query: stderrOutput
@ -286,23 +286,24 @@ $(function() {
session.setUseSoftTabs(true); session.setUseSoftTabs(true);
session.setUseWrapMode(true); session.setUseWrapMode(true);
var file_id = $(element).data('file-id'); setAnnotations(editor, $(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", function(e){ editor.on("guttermousedown", handleGutterClick);
var target = e.domEvent.target; })
if (target.className.indexOf("ace_gutter-cell") == -1) }
return;
if (!editor.isFocused())
return;
if (e.clientX > 25 + target.getBoundingClientRect().left)
return;
var handleGutterClick = function(e){
var file_id = $(element).data('file-id');
var target = e.domEvent.target;
if (target.className.indexOf("ace_gutter-cell") == -1) return;
if (!editor.isFocused()) return;
if (e.clientX > 25 + target.getBoundingClientRect().left) return;
var row = e.getDocumentPosition().row; var row = e.getDocumentPosition().row;
e.stop(); e.stop();
@ -337,9 +338,7 @@ $(function() {
}) })
commentModal.modal('show') 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) {

View File

@ -54,7 +54,7 @@ button i.fa-spin {
} }
#files { #files {
overflow: scroll; overflow: auto;
} }
#hint { #hint {