summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-07-17 10:12:10 +0200
committerAleš Smodiš <aless@guru.si>2015-07-17 10:12:10 +0200
commit6f587293c10daf63043167d692a4a62343fde7d5 (patch)
treefe331490eaf3cd3ca88d69c04e8fca086adedbeb
parenta97adcac7b3cf6de263c9d63533e1804ebcd79f8 (diff)
Tied the 3 hint mockups to the 3 buttons.
-rw-r--r--js/prolog.js15
1 files changed, 12 insertions, 3 deletions
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('<div class="hint-static">' + template + '</div>'); // 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