1
0
forked from GitHub/gf-core

Work on example-based grammar writing

+ Preparations to support more target languages. Tested with Swedish.
+ Don't enable example-based editing if there is less that two concrete
  languages in the grammar.
+ Don't show the "By example" button until the required lincat has been defined.
+ Remember the chosen language for examples.
This commit is contained in:
hallgren
2011-10-21 15:43:57 +00:00
parent a8b97caed4
commit a452274617
3 changed files with 47 additions and 20 deletions

View File

@@ -42,16 +42,28 @@ function upload(g) {
// Upload the grammar to store it in the cloud
function upload_json(cont) {
function upload3(resptext,status) {
local.put("json_uploaded",Date.now());
//debug("Upload complete")
if(cont) cont();
else {
var sharing=element("sharing");
if(sharing) sharing.innerHTML=resptext;
}
}
function upload2(dir) {
function upload3(resptext,status) {
local.put("json_uploaded",Date.now());
//debug("Upload complete")
if(cont) cont();
else {
var sharing=element("sharing");
if(sharing) {
if(status==204) {
var a=empty("a");
a.href="share.html#"+dir.substr(5) // skip "/tmp/"
a.innerHTML=a.href;
sharing.innerHTML="";
sharing.appendChild(text("Use the following link for shared access to your grammars from multiple devices: "))
sharing.appendChild(a)
}
else
sharing.innerHTML=resptext;
}
}
}
var prefix=dir.substr(10)+"-" // skip "/tmp/gfse."
//debug("New form data");
//var form=new FormData(); // !!! Doesn't work on Android 2.2!