editing example clusters on main view
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
from export import export_to_xml
|
||||
from browser import window
|
||||
from lib.snabbdom import h
|
||||
import message
|
||||
|
||||
|
||||
NUM2STR = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
def show_toggle_cluster_buttons(sense, example):
|
||||
cls = example.get_cluster()
|
||||
if cls is None:
|
||||
return []
|
||||
|
||||
result = []
|
||||
for opt in sense.example_clusters():
|
||||
tag = "input.cluster-list-button"
|
||||
if opt == example.get_cluster():
|
||||
if opt == cls:
|
||||
tag += ".cluster-button-checked"
|
||||
|
||||
result.append(h(tag, {"attrs": {"value": NUM2STR[opt], "type": "button"}}, []))
|
||||
result.append(h(tag,
|
||||
{"attrs": {"value": NUM2STR[opt], "type": "button"},
|
||||
"on": {"click": message.msg(message.ExampleClusterEdit(example, opt))}}, []))
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user