diff options
| author | hallgren <hallgren@chalmers.se> | 2012-02-13 17:31:39 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-02-13 17:31:39 +0000 |
| commit | b126a28cc5f5b1a87994fff2f35f8e3b3d5f9111 (patch) | |
| tree | 1c67709b028853eec484f6938dc0365599b90601 /src/www/gfse/editor.js | |
| parent | 4c0e8c18c7a4d688ef2409724d6cf2876d698c3e (diff) | |
gfse: better integration of the minibar
The minibar is now displayed inside the editor, intead of on a separate page.
This makes the context clearer and makes it more obiovous how to return to the
editor.
Diffstat (limited to 'src/www/gfse/editor.js')
| -rw-r--r-- | src/www/gfse/editor.js | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js index dca939ec8..77573c20c 100644 --- a/src/www/gfse/editor.js +++ b/src/www/gfse/editor.js @@ -148,7 +148,7 @@ function draw_grammar(g) { function draw_namebar(g,files) { return div_class("namebar", [table([tr([td(draw_name(g)), - td_right([minibar_button(g), + td_right([minibar_button(g,files), compile_button(g), draw_plainbutton(g,files), draw_closebutton(g)])])])]) @@ -203,10 +203,33 @@ function compile_button(g) { return b; } -function minibar_button(g) { +function minibar_button(g,files) { + var b2; + function show_editor() { edit_grammar(g); } function goto_minibar(res) { show_compile_error(res); - if(res.errorcode=="OK") location.href=res.minibar_url; + if(res.errorcode=="OK") { + //location.href=res.minibar_url; + files.innerHTML=""; + files.appendChild(div_id("minibar")); + var online_options={grammars_url: local.get("dir")+"/", + grammar_list: [g.basename+".pgf"]} + var pgf_server=pgf_online(online_options) + var minibar_options= { + show_abstract: true, + show_trees: true, + show_grouped_translations: false, + default_source_language: "Eng", + try_google: true + } + var minibar=new Minibar(pgf_server,minibar_options); + b.style.display="none"; + if(b2) b2.style.display=""; + else { + b2=button("Show editor",show_editor); + insertAfter(b2,b); + } + } } var b=button("Minibar",function(){upload(g,goto_minibar);}); b.title="Upload the grammar and test it in the minibar"; |
