editing example clusters on main view

This commit is contained in:
2020-01-28 23:22:52 +01:00
parent ec5f72969c
commit 9a184011c1
4 changed files with 20 additions and 7 deletions

View File

@@ -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