summaryrefslogtreecommitdiff
path: root/src/www
diff options
context:
space:
mode:
authorThomas Hallgren <th-github@altocumulus.org>2018-03-29 17:02:22 +0200
committerThomas Hallgren <th-github@altocumulus.org>2018-03-29 17:02:22 +0200
commit750a1349ffad116d57b46ea5f816e678018a1d7f (patch)
tree2a6af79a14c429e779d21aef3c455895ac702f4a /src/www
parent78cf1849574b8ba2709d1712202ebe34327c63f9 (diff)
gfse: allow public grammars to be deleted in more cases
The editor doesn't show delete buttons on grammars published by other users, but it was too picky when deciding which grammars you own. Now it should be possible to delete grammars from the device/browser you published it from, even if you don't have a private copy of it any more. On a related note, there seems to be problem with the way unique grammars names are created and maintained, causing published grammars to be duplicated in some cases. This needs to be overhauled.
Diffstat (limited to 'src/www')
-rw-r--r--src/www/gfse/editor.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js
index 42638090c..cb93c305a 100644
--- a/src/www/gfse/editor.js
+++ b/src/www/gfse/editor.js
@@ -158,15 +158,16 @@ function draw_grammar_list() {
clear(gt)
if(files.length>0) {
sort_grammars()
- //var unique_id=local.get("unique_id","-")
+ var unique_id=local.get("unique_id","-")
for(var i in files) {
var file=files[i].path
var parts=file.split(/[-.]/)
var basename=parts[0]
var unique_name=parts[1]+"-"+parts[2]
var mine = my_grammar(unique_name)!=null
- var del = mine
- ? delete_button(rmpublic(file),"Don't publish this grammar")
+ var from_me = parts[1] == unique_id
+ var del = from_me || mine
+ ? delete_button(rmpublic(file),"Remove this public grammar")
: []
var tip = mine
? "This is a copy of your grammar"