Commit 376a8d99eb44ffa7836e08c0dab105433f5239b5
1 parent
618177cc
kolorowanie segmentów w formach bazowych
Showing
2 changed files
with
17 additions
and
5 deletions
dictionary/models.py
... | ... | @@ -492,7 +492,10 @@ class Lexeme(Model): |
492 | 492 | 'qualifiers').select_related('pattern__type', 'gender') |
493 | 493 | if gender: |
494 | 494 | lips = lips.filter(gender=gender) |
495 | - tables = [lip.inflection_table(variant, qualifiers=qualifiers) | |
495 | + span = unicode(variant) == u'0' | |
496 | + tables = [ | |
497 | + lip.inflection_table( | |
498 | + variant, qualifiers=qualifiers, span=span) | |
496 | 499 | for lip in lips] |
497 | 500 | table1 = tables[0] |
498 | 501 | for table2 in tables[1:]: |
... | ... | @@ -775,7 +778,7 @@ class LexemeInflectionPattern(Model): |
775 | 778 | return self.pattern.base_endings(label_filter) |
776 | 779 | |
777 | 780 | def inflection_table(self, variant, separated=False, qualifiers=None, |
778 | - edit_view=False, attr_vals=None): | |
781 | + edit_view=False, attr_vals=None, span=False): | |
779 | 782 | try: |
780 | 783 | tt = self.table_template(variant) |
781 | 784 | except TableTemplate.DoesNotExist: |
... | ... | @@ -786,7 +789,7 @@ class LexemeInflectionPattern(Model): |
786 | 789 | return tt.render_with_pattern( |
787 | 790 | self.pattern, self.gender, attr_vals, |
788 | 791 | self.root, separated, qualifiers, edit_view, self.index, |
789 | - lip_qualifiers) | |
792 | + lip_qualifiers, span=span) | |
790 | 793 | |
791 | 794 | def all_forms(self, separator=u'', label_filter=None, |
792 | 795 | variant='1', qualifiers=None, span=True): |
... | ... | @@ -1059,7 +1062,7 @@ class TableTemplate(Model): |
1059 | 1062 | |
1060 | 1063 | def render(self, pattern_type, gender, attr_vals, base_endings, root=u'', |
1061 | 1064 | separated=True, qualifiers=None, edit_view=True, lip_index=0, |
1062 | - lip_qualifiers=None, numbers=False): | |
1065 | + lip_qualifiers=None, numbers=False, span=False): | |
1063 | 1066 | table_cells = self.filter_table_cells(pattern_type, gender, attr_vals) |
1064 | 1067 | headers = self.filter_table_headers(pattern_type, gender, attr_vals) |
1065 | 1068 | rows = set() |
... | ... | @@ -1098,7 +1101,8 @@ class TableTemplate(Model): |
1098 | 1101 | assert table_cell['type'] != 'span' |
1099 | 1102 | separator = u'·' if separated else u'' |
1100 | 1103 | forms = tc.forms(base_endings, separator, root, lip_qualifiers, |
1101 | - lip_index, qualifiers=qualifiers, edit_view=edit_view) | |
1104 | + lip_index, qualifiers=qualifiers, edit_view=edit_view, | |
1105 | + span=span) | |
1102 | 1106 | if not forms: |
1103 | 1107 | continue |
1104 | 1108 | if table_cell['type'] == 'empty': |
... | ... |
media/css/inflection_table.css
... | ... | @@ -174,4 +174,12 @@ table.cross-references tr th.head { |
174 | 174 | text-decoration: underline; |
175 | 175 | color: blue; |
176 | 176 | cursor: pointer; |
177 | +} | |
178 | + | |
179 | +span.ending { | |
180 | + color: red; | |
181 | +} | |
182 | + | |
183 | +span.suffix { | |
184 | + color: purple; | |
177 | 185 | } |
178 | 186 | \ No newline at end of file |
... | ... |