mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-26 11:18:55 -06:00
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.
This commit is contained in:
@@ -158,15 +158,16 @@ function draw_grammar_list() {
|
|||||||
clear(gt)
|
clear(gt)
|
||||||
if(files.length>0) {
|
if(files.length>0) {
|
||||||
sort_grammars()
|
sort_grammars()
|
||||||
//var unique_id=local.get("unique_id","-")
|
var unique_id=local.get("unique_id","-")
|
||||||
for(var i in files) {
|
for(var i in files) {
|
||||||
var file=files[i].path
|
var file=files[i].path
|
||||||
var parts=file.split(/[-.]/)
|
var parts=file.split(/[-.]/)
|
||||||
var basename=parts[0]
|
var basename=parts[0]
|
||||||
var unique_name=parts[1]+"-"+parts[2]
|
var unique_name=parts[1]+"-"+parts[2]
|
||||||
var mine = my_grammar(unique_name)!=null
|
var mine = my_grammar(unique_name)!=null
|
||||||
var del = mine
|
var from_me = parts[1] == unique_id
|
||||||
? delete_button(rmpublic(file),"Don't publish this grammar")
|
var del = from_me || mine
|
||||||
|
? delete_button(rmpublic(file),"Remove this public grammar")
|
||||||
: []
|
: []
|
||||||
var tip = mine
|
var tip = mine
|
||||||
? "This is a copy of your grammar"
|
? "This is a copy of your grammar"
|
||||||
|
|||||||
Reference in New Issue
Block a user