unified example editing
This commit is contained in:
parent
575345f98f
commit
c2c5e94aa7
|
@ -116,6 +116,7 @@
|
||||||
|
|
||||||
.translation-div {
|
.translation-div {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
._hoverable();
|
||||||
|
|
||||||
.translation-tags {
|
.translation-tags {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
@ -142,8 +143,6 @@
|
||||||
content: ']';
|
content: ']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
._hoverable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.translation-add {
|
.translation-add {
|
||||||
|
@ -158,6 +157,7 @@
|
||||||
|
|
||||||
.example-dot, .example-rest {
|
.example-dot, .example-rest {
|
||||||
float: left;
|
float: left;
|
||||||
|
._hoverable();
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-arrow, .example-dot {
|
.example-arrow, .example-dot {
|
||||||
|
@ -171,14 +171,6 @@
|
||||||
.example-chosen {
|
.example-chosen {
|
||||||
border: 1px @gray solid;
|
border: 1px @gray solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-text {
|
|
||||||
._hoverable();
|
|
||||||
}
|
|
||||||
|
|
||||||
.example-translation-list {
|
|
||||||
._hoverable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ class ShowVariantsEdit(ClickMessage):
|
||||||
class ShowExampleEdit(KeyPlusClickMessage):
|
class ShowExampleEdit(KeyPlusClickMessage):
|
||||||
def update_model_default(self, model):
|
def update_model_default(self, model):
|
||||||
example = self.get_arg(0, Example)
|
example = self.get_arg(0, Example)
|
||||||
|
example.make_copy()
|
||||||
|
|
||||||
# if some are chosen, then show modal for choosing senses
|
# if some are chosen, then show modal for choosing senses
|
||||||
if len(model.chosen_examples) > 0 and example in model.chosen_examples:
|
if len(model.chosen_examples) > 0 and example in model.chosen_examples:
|
||||||
|
@ -73,12 +74,6 @@ class ShowExampleEdit(KeyPlusClickMessage):
|
||||||
def reset(self):
|
def reset(self):
|
||||||
# special case, when choosing messages dont reset
|
# special case, when choosing messages dont reset
|
||||||
return not (self.ctrl or self.shift)
|
return not (self.ctrl or self.shift)
|
||||||
|
|
||||||
class ShowExampleTranslationEdit(ClickMessage):
|
|
||||||
def update_model(self, model):
|
|
||||||
example = self.get_arg(0, Example)
|
|
||||||
example.make_copy()
|
|
||||||
model.modal_set(lambda: modals.edit_example_translation(example))
|
|
||||||
|
|
||||||
|
|
||||||
class ShowEditTranslation(ClickMessage):
|
class ShowEditTranslation(ClickMessage):
|
||||||
|
@ -118,3 +113,4 @@ class ShowEntryLabelsEdit(ClickMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
model.entry.make_copy()
|
model.entry.make_copy()
|
||||||
model.modal_set(lambda: modals.edit_entry_labels(model.entry))
|
model.modal_set(lambda: modals.edit_entry_labels(model.entry))
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,11 @@ class AddToLabelList(NoReset):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class EditExampleTranslation(Message):
|
class EditExampleTranslation(QuestionMessage):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
example = self.get_arg(0, Example)
|
example = self.get_arg(0, Example)
|
||||||
example.translations = common_accessors.generic_list_getter()
|
example.translations = common_accessors.generic_list_getter()
|
||||||
|
example.text = self.new_text
|
||||||
|
|
||||||
|
|
||||||
class AddSense(Message):
|
class AddSense(Message):
|
||||||
|
@ -63,12 +64,6 @@ class EditComment(QuestionMessage):
|
||||||
model.entry.comment = self.new_text
|
model.entry.comment = self.new_text
|
||||||
|
|
||||||
|
|
||||||
class EditExample(QuestionMessage):
|
|
||||||
def update_model(self, model):
|
|
||||||
example = self.get_arg(0, Example)
|
|
||||||
example.example = self.new_text
|
|
||||||
|
|
||||||
|
|
||||||
class DoChosenExamples(Message):
|
class DoChosenExamples(Message):
|
||||||
def update_model(self, model):
|
def update_model(self, model):
|
||||||
chosen_examples = self.get_arg(0, list)
|
chosen_examples = self.get_arg(0, list)
|
||||||
|
|
|
@ -29,10 +29,12 @@ def edit_sense_label(sense):
|
||||||
return modal_template(content, "Translation", message.EditSenseLabel(sense))
|
return modal_template(content, "Translation", message.EditSenseLabel(sense))
|
||||||
|
|
||||||
|
|
||||||
def edit_example_translation(example):
|
def edit_example(example):
|
||||||
|
content = question("Edit example", example.text)
|
||||||
etl_getter = lambda: example.copy().translations
|
etl_getter = lambda: example.copy().translations
|
||||||
content = generic_list_editor("Edit example translations", etl_getter)
|
content.extend(generic_list_editor("Edit example translations", etl_getter))
|
||||||
return modal_template(content, "Example Translations", message.EditExampleTranslation(example))
|
|
||||||
|
return modal_template(content, "Edit Example", message.EditExampleTranslation(example))
|
||||||
|
|
||||||
|
|
||||||
def edit_variants(entry):
|
def edit_variants(entry):
|
||||||
|
@ -54,10 +56,6 @@ def edit_comment(comment):
|
||||||
return modal_template(question("Edit comment", comment), "Comment", message.EditComment())
|
return modal_template(question("Edit comment", comment), "Comment", message.EditComment())
|
||||||
|
|
||||||
|
|
||||||
def edit_example(example):
|
|
||||||
return modal_template(question("Edit exmample", example.example), "Example", message.EditExample(example))
|
|
||||||
|
|
||||||
|
|
||||||
def do_chosen_examples(example_list, entry):
|
def do_chosen_examples(example_list, entry):
|
||||||
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):
|
||||||
|
|
|
@ -99,9 +99,9 @@ class View:
|
||||||
|
|
||||||
return h("div.example", {}, [
|
return h("div.example", {}, [
|
||||||
h("div.example-dot", {}, "▣"),
|
h("div.example-dot", {}, "▣"),
|
||||||
h(example_tag, {}, [
|
h(example_tag, {"on": {"click": msg(ShowExampleEdit(example))} }, [
|
||||||
h("span.example-text", {"on": {"click": msg(ShowExampleEdit(example))} }, example.text),
|
h("span.example-text", {}, example.text),
|
||||||
h("div.example-translation-list", { "on": {"click": msg(ShowExampleTranslationEdit(example))} }, [
|
h("div.example-translation-list", {}, [
|
||||||
h("div.example-translation", {}, [
|
h("div.example-translation", {}, [
|
||||||
h("span.example-arrow", {}, "↪"),
|
h("span.example-arrow", {}, "↪"),
|
||||||
h("span", {}, t)])
|
h("span", {}, t)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user