summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-28 19:40:37 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-02-28 19:40:37 +0100
commit982522b5b9dfc39c10d08129b873aadf77b7293f (patch)
tree9f02558bec78b8466ce63da9cd81c11fab857be0
parent9de619cde9a51a8c7d2cf3e8dbffeca3b4fc94a0 (diff)
Experiment: add "teacher helped" link to Prolog screen
Records a {'typ': 'experiment', 'data': 'teacher help'} action when clicked. This will allow us to consider such traces specially when evaluating different hint types. This is specific to the prolog_hints experiment and should be reverted or generalized in the future.
-rw-r--r--css/codeq.css5
-rw-r--r--index.html6
-rw-r--r--js/codeq/prolog.js18
-rw-r--r--res/en.json2
-rw-r--r--res/sl.json2
5 files changed, 33 insertions, 0 deletions
diff --git a/css/codeq.css b/css/codeq.css
index bbb40c9..9b87baa 100644
--- a/css/codeq.css
+++ b/css/codeq.css
@@ -295,6 +295,11 @@ h2.group-title a.view-solutions {
/***** responsiveness *****/
/* md & ld */
@media (min-width: 992px) {
+ /* experiment: Prolog hints */
+ .teacher-help {
+ position: fixed; bottom: 0; left: 0; max-width: 30%;
+ }
+ /* end of experiment: Prolog hints */
/* BEGIN layouts */
/*~~ line-layout ~~*/
diff --git a/index.html b/index.html
index 9675f40..96e7504 100644
--- a/index.html
+++ b/index.html
@@ -364,6 +364,12 @@
<div class="description" data-dict="prolog" data-tkey="description"></div>
</div>
<div class="hints"></div>
+ <!-- experiment: Prolog hints -->
+ <div class="teacher-help"
+ style="display: none; background-color: white; border: 1px solid gray; font-size: small; padding: 0.2em 0.4em;">
+ <span data-tkey="teacher_help">If you received help from the teacher, please click</span> <a href="#" data-tkey="here">here</a>.
+ </div>
+ <!-- end of experiment: Prolog hints -->
</div>
<div class="col-lg-8 col-md-8 col-sm-12 block block-right ">
<div class="col-lg-6 col-md-12 col-sm-12 block block2">
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index 7cf9592..6e07784 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -28,6 +28,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
jqAllButtons = jqBtnPlan.add(jqBtnTest), // all the buttons
prologHandler;
+ // experiment: Prolog hints
+ var jqTeacherHelp = jqScreen.find('.teacher-help');
+ // end of experiment: Prolog hints
+
var enterFun = function(problemDef, commonDef, currentSolution) {
$('#navigation-problem-list').css('display', '');
var navigationProlog = $("#navigation-prolog");
@@ -55,6 +59,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
.done();
},
'exit': function () {
+ // experiment: Prolog hints
+ jqTeacherHelp.find('a').off('click');
+ jqTeacherHelp.hide();
+ // end of experiment: Prolog hints
+
jqAllButtons.off(); // unregister all event handlers
jqAllQuadrants.off();
jqScreen.css('display', 'none');
@@ -250,6 +259,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
.done();
});
+ // experiment: Prolog hints
+ jqTeacherHelp.find('a').on('click', function(e) {
+ e.preventDefault();
+ activityHandler.queueTrace({'typ': 'experiment', 'data': 'teacher help'});
+ jqTeacherHelp.hide();
+ });
+ jqTeacherHelp.show();
+ // end of experiment: Prolog hints
+
codeq.comms.loadProblem(problemDef.id).done();
activityHandler.queueTrace({
'typ': 'open',
diff --git a/res/en.json b/res/en.json
index 4f5e89d..5e172c9 100644
--- a/res/en.json
+++ b/res/en.json
@@ -1,4 +1,6 @@
{
+ "teacher_help": "If a teacher helped you solve this problem, please click",
+ "here": "here",
"language": "Language",
"ui_language_title": "Select the UI language.",
"passwords_do_not_match": "Passwords do not match.",
diff --git a/res/sl.json b/res/sl.json
index f3af40c..e17684a 100644
--- a/res/sl.json
+++ b/res/sl.json
@@ -1,4 +1,6 @@
{
+ "teacher_help": "Če ti je pri reševanju pomagal učitelj, klikni",
+ "here": "tukaj",
"language": "Jezik",
"ui_language_title": "Izberi jezik uporabniškega vmesnika.",
"passwords_do_not_match": "Gesli se ne ujemata.",