title of translation parent when editing example translation
This commit is contained in:
		
							parent
							
								
									81f3b4336a
								
							
						
					
					
						commit
						3299a34226
					
				@ -316,6 +316,10 @@
 | 
			
		||||
//   }
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
span.translation-original span {
 | 
			
		||||
  margin-right: 0.3em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.popup-menu {
 | 
			
		||||
  // DONE!
 | 
			
		||||
  position: absolute;
 | 
			
		||||
 | 
			
		||||
@ -55,17 +55,18 @@ class ShowEditTranslation(ClickMessage):
 | 
			
		||||
        translation.make_copy()
 | 
			
		||||
        num_clusters = len(parent.translations)
 | 
			
		||||
        model.modal_set(lambda: modals.edit_translation(
 | 
			
		||||
            translation, cidx, num_clusters, (EditTranslation, translation, cidx)))
 | 
			
		||||
            translation, parent, cidx, num_clusters, (EditTranslation, translation, cidx)))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ShowAddTranslation(ClickMessage):
 | 
			
		||||
    def update_model(self, model):
 | 
			
		||||
        chosen_sense_or_example = self.get_arg(0)
 | 
			
		||||
        
 | 
			
		||||
        translation = Translation()
 | 
			
		||||
        
 | 
			
		||||
        translation.make_copy()
 | 
			
		||||
        model.modal_set(lambda: modals.edit_translation(
 | 
			
		||||
            translation, 
 | 
			
		||||
            chosen_sense_or_example,
 | 
			
		||||
            -1,
 | 
			
		||||
            len(chosen_sense_or_example.translations),
 | 
			
		||||
            (AddTranslation, translation, -1, chosen_sense_or_example)))
 | 
			
		||||
 | 
			
		||||
@ -82,6 +82,9 @@ class Example(Data):
 | 
			
		||||
            h("div.example-clusters", 
 | 
			
		||||
              {"style": {"display": clusters_display }}, show_toggle_cluster_buttons(sense, self))])])
 | 
			
		||||
    
 | 
			
		||||
    def simple_view(self):
 | 
			
		||||
        return self.inner.view(self.components)
 | 
			
		||||
        
 | 
			
		||||
    def get_cluster(self):
 | 
			
		||||
        return self.inner.get_cluster()
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -2,18 +2,27 @@ from lib.snabbdom import h
 | 
			
		||||
import message
 | 
			
		||||
from view.modal_templates import *
 | 
			
		||||
from view.utils import show_toggle_cluster_buttons
 | 
			
		||||
import model
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def edit_translation(translation, cluster_idx, num_clusters, cls):
 | 
			
		||||
def edit_translation(translation, parent, cluster_idx, num_clusters, cls):
 | 
			
		||||
    def split_line2(left, right):
 | 
			
		||||
        return h("div.flex.two", {}, [
 | 
			
		||||
            h("span.third.span-left-of-input", {}, left), h("span.two-third", {}, right)])
 | 
			
		||||
    
 | 
			
		||||
    content = []
 | 
			
		||||
    if type(parent) is model.Example:
 | 
			
		||||
        content.extend([
 | 
			
		||||
            h("span.translation-original-title", {}, "Primer: "),
 | 
			
		||||
            h("span.translation-original", {}, parent.simple_view()),
 | 
			
		||||
            h("hr", {}, None)])
 | 
			
		||||
    
 | 
			
		||||
    # first line: transalation itself
 | 
			
		||||
    content = [split_line2("Prevedek:", 
 | 
			
		||||
    content.extend([
 | 
			
		||||
        split_line2("Prevedek:", 
 | 
			
		||||
                    h("input#etv", {"props": {"type": "text", "value": translation.translation}}, "")),
 | 
			
		||||
        split_line2("Razlaga:", 
 | 
			
		||||
                           h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))]
 | 
			
		||||
                    h("input#ete", {"props": {"type": "text", "value": translation.explanation}}, ""))])
 | 
			
		||||
               
 | 
			
		||||
    # cluster number
 | 
			
		||||
    options = [h("option", {"props": {"selected": idx == cluster_idx}}, str(idx + 1)) for idx in range(num_clusters + 1)]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user