From 6f587293c10daf63043167d692a4a62343fde7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Fri, 17 Jul 2015 10:12:10 +0200 Subject: Tied the 3 hint mockups to the 3 buttons. --- js/prolog.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/prolog.js b/js/prolog.js index df2a1b0..c405200 100644 --- a/js/prolog.js +++ b/js/prolog.js @@ -52,7 +52,7 @@ hintHandlers = { 'static': function (type, template, serverHint) { codeq.log.debug('Processing static hint'); - jqHints.append(template); // TODO: incorporate any serverHint.args + jqHints.append('
' + template + '
'); // TODO: incorporate any serverHint.args // no hint cleaner here, a static hint remains on the screen }, 'popup': function (type, template, serverHint) { @@ -96,8 +96,10 @@ mark = null; });*/ - jqMark.popover({content: template, html: true, placement: 'auto bottom', trigger: 'click', container: 'body'}); + jqMark.popover({content: template, html: true, placement: 'auto bottom', trigger: 'hover focus click', container: 'body'}); hintCleaners.push(function () { if (jqMark) { jqMark.popover('destroy'); jqMark = null; } }); + + mark.mark.on('', function () {}); }, 'dropdown': function (type, template, serverHint) { codeq.log.debug('Processing dropdown hint'); @@ -134,7 +136,7 @@ editor.setValue('sister(X, Y) :-\n female(X),\n parent(Z, X),\n parent(Z, Y),\n X \\== Y.'); // demo jqDescription.html(info.description); - return { + var handler = { destroy: function () { jqDescription.empty(); jqEditor.empty(); // TODO: perhaps you do not want to "free" the editor, just empty it @@ -186,5 +188,12 @@ } } }; + + var jqButtons = $('#block-toolbar button'); + $(jqButtons.get(0)).on('click', function () { handler.processServerHints([{id:'x_must_be_female'}]); }); + $(jqButtons.get(1)).on('click', function () { handler.processServerHints([{id:'popup_unknown', start: 20, end: 26}]); }); + $(jqButtons.get(2)).on('click', function () { handler.processServerHints([{id:'drop_down', start: 20, end: 26, choices:['ena', 'dva', 'tri']}]); }); + + return handler; }; })(); \ No newline at end of file -- cgit v1.2.1