diff options
| author | hallgren <hallgren@chalmers.se> | 2012-02-28 17:24:34 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-02-28 17:24:34 +0000 |
| commit | 6f42f58f71e54ffdd89cb4d53c68e9212eb5a0ee (patch) | |
| tree | 46b183fac486510a8212eb9e4846b3a857b58f48 /src/www/gfse/editor.js | |
| parent | c1c1a73dc3db1f1ae8b298f836dfa7a2a17f2638 (diff) | |
gfse: Translation Quiz integration
Also moved the translation quiz from demos/TransQuiz to src/www/TransQuiz so
that it will be installed by 'cabal install' along with the other files that
are installed for use by gf -server mode.
Diffstat (limited to 'src/www/gfse/editor.js')
| -rw-r--r-- | src/www/gfse/editor.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js index 18782b91f..809aee4df 100644 --- a/src/www/gfse/editor.js +++ b/src/www/gfse/editor.js @@ -148,6 +148,7 @@ function draw_namebar(g,files) { return div_class("namebar", [table([tr([td(draw_name(g)), td_right([minibar_button(g,files), + quiz_button(g), compile_button(g), draw_plainbutton(g,files), draw_closebutton(g)])])])]) @@ -184,7 +185,7 @@ function show_compile_error(res) { var dst=compiler_output if(dst) { clear(dst); - var minibarlink=a(res.minibar_url,[text("Minibar")]) + //var minibarlink=a(res.minibar_url,[text("Minibar")]) if(res.errorcode=="OK") dst.appendChild(wrap("h3",text("OK"))) else @@ -243,6 +244,22 @@ function minibar_button(g,files) { return b; } +function quiz_button(g) { + function goto_quiz(res) { + show_compile_error(res); + if(res.errorcode=="OK") + location.href="../TransQuiz/translation_quiz.html?"+local.get("dir")+"/" + } + function compile() { + replaceInnerHTML(compiler_output,"<h3>Compiling...</h3>"); + upload(g,goto_quiz); + } + var b=button("Quiz",compile); + b.title="Upload the grammar and go to the translation quiz"; + return b; +} + + function lang(code,name) { return { code:code, name:name} } function lang1(name) { var ws=name.split("/"); |
