default sense for example moving now chosen.
This commit is contained in:
parent
f5842c2536
commit
8eada0d246
|
@ -57,13 +57,25 @@ def edit_comment(comment):
|
||||||
|
|
||||||
|
|
||||||
def do_chosen_examples(example_list, entry):
|
def do_chosen_examples(example_list, entry):
|
||||||
|
# assert len(example_list) > 0
|
||||||
|
|
||||||
|
sense_of_first_example = None
|
||||||
|
for idx, sense in enumerate(entry.senses):
|
||||||
|
for ex in sense.examples:
|
||||||
|
if ex == example_list[0]:
|
||||||
|
sense_of_first_example = idx
|
||||||
|
break
|
||||||
|
|
||||||
options = [h("p", {}, "Choose sense for examples")]
|
options = [h("p", {}, "Choose sense for examples")]
|
||||||
for idx, sense in enumerate(entry.senses):
|
for idx, sense in enumerate(entry.senses):
|
||||||
text = "{}: {}".format(idx, sense.definition["indicator"])
|
text = "{}: {}".format(idx + 1, sense.definition["indicator"])
|
||||||
id_ = "choose-example-{}".format(idx)
|
id_ = "choose-example-{}".format(idx)
|
||||||
|
|
||||||
options.append(h("input#{}.checkable-input".format(id_),
|
props = {"type": "radio", "name": "choose-example"}
|
||||||
{"props": {"type": "radio", "name": "choose-example"}}, []))
|
if idx == sense_of_first_example:
|
||||||
|
props["checked"] = True
|
||||||
|
|
||||||
|
options.append(h("input#{}.checkable-input".format(id_), {"props": props}, []))
|
||||||
options.append(h("label.checkable", {"attrs": {"for": id_}}, text))
|
options.append(h("label.checkable", {"attrs": {"for": id_}}, text))
|
||||||
options.append(h("br", {}, []))
|
options.append(h("br", {}, []))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user