Commit c0b6aa5c1ca491ba21d204dd95d854bbc59c46dc

Authored by janek37
1 parent 91d28ed3

trochę porządku w zarządzaniu klasyfikacjami

dictionary/models.py
... ... @@ -62,7 +62,8 @@ class Qualifier(Model):
62 62  
63 63 class Classification(Model):
64 64 name = CharField(
65   - unique=True, max_length=64, db_column='nazwa', verbose_name=u'nazwa')
  65 + unique=True, max_length=64, db_column='nazwa',
  66 + verbose_name=u'nazwa klasyfikacji')
66 67  
67 68 def value_tree(self):
68 69 parts = []
... ... @@ -86,11 +87,13 @@ def make_choices(tree):
86 87  
87 88 class ClassificationValue(Model):
88 89 label = CharField(
89   - unique=True, max_length=64, db_column='nazwa', verbose_name=u'nazwa')
  90 + unique=True, max_length=64, db_column='nazwa',
  91 + verbose_name=u'nazwa wartości')
90 92 classification = ForeignKey(Classification, db_column='klas_id',
91 93 related_name='values')
92   - parent_node = ForeignKey('self', db_column='rodzic', null=True, blank=True,
93   - verbose_name=u'rodzic', related_name='child_nodes')
  94 + parent_node = ForeignKey(
  95 + 'self', db_column='rodzic', null=True, blank=True,
  96 + verbose_name=u'rodzic wartości', related_name='child_nodes')
94 97 lexemes = ManyToManyField('Lexeme', blank=True)
95 98 deleted = BooleanField(db_column='usunieta')
96 99  
... ...
dictionary/templates/manage_classifications.html
... ... @@ -9,44 +9,50 @@
9 9 {% block title %}Klasyfikacje{% endblock %}
10 10  
11 11 {% block content %}
12   - <form action="" method="post">
  12 + <form action="" method="post" class="add-classification">
13 13 {% csrf_token %}
14 14 {{ add_form.as_p }}
15 15 <p>
16   - <input type="submit" value="Dodaj klasyfikację"/>
  16 + <button type="submit">Dodaj klasyfikację</button>
17 17 </p>
18 18 </form>
19 19 {% for classification, value_form, vocab_form, using in classification_forms %}
20   - <h4>{{ classification.name }}</h4>
21   - <p>Wartości:</p>
22   - {% with tree=classification.value_tree %}
23   - {% if tree %}
24   - {% value_tree tree %}
25   - {% endif %}
26   - {% endwith %}
27   - <form action="" method="post">
28   - {% csrf_token %}
29   - {{ value_form.as_p }}
30   - <p>
31   - <input type="submit" value="Dodaj wartość"/>
32   - </p>
33   - </form>
34   - <p>Używające słowniki:</p>
35   - {% if using %}
36   - <ul>
37   - {% for vocab in using %}
38   - <li>{{ vocab.id }}</li>
39   - {% endfor %}
40   - </ul>
41   - {% else %}
42   - <p>brak</p>
43   - {% endif %}
44   - <form action="" method="post">
45   - {% csrf_token %}
46   - {{ vocab_form.as_p }}
47   - <p>
48   - <input type="submit" value="Dodaj słownik"/>
49   - </p>
50   - </form>
  20 + <div class="classification">
  21 + <div class="classification-controls">
  22 + <form action="" method="post" class="add-value">
  23 + {% csrf_token %}
  24 + {{ value_form.as_p }}
  25 + <p>
  26 + <button type="submit">Dodaj wartość</button>
  27 + </p>
  28 + </form>
  29 + <div class="vocabs">
  30 + <p>Używające słowniki:</p>
  31 + {% if using %}
  32 + <ul>
  33 + {% for vocab in using %}
  34 + <li>{{ vocab.id }}</li>
  35 + {% endfor %}
  36 + </ul>
  37 + {% else %}
  38 + <p>brak</p>
  39 + {% endif %}
  40 + <form action="" method="post">
  41 + {% csrf_token %}
  42 + {{ vocab_form.as_p }}
  43 + <p>
  44 + <button type="submit">Dodaj słownik"</button>
  45 + </p>
  46 + </form>
  47 + </div>
  48 + </div>
  49 + <h4>{{ classification.name }}</h4>
  50 + <p>Wartości:</p>
  51 + {% with tree=classification.value_tree %}
  52 + {% if tree %}
  53 + {% value_tree tree %}
  54 + {% endif %}
  55 + {% endwith %}
  56 + </div>
51 57 {% endfor %}
52 58 {% endblock %}
... ...
media/css/general.css
... ... @@ -50,6 +50,11 @@ div#user-tools {
50 50  
51 51 /* layout */
52 52  
  53 +#content {
  54 + margin-left: 10px;
  55 + margin-right: 10px;
  56 +}
  57 +
53 58 body {
54 59 margin: 0;
55 60 }
... ...
media/css/jqgrid.css
  1 +#content {
  2 + margin-left: 0px;
  3 +}
  4 +
1 5 p {
2 6 font-size: 1em;
3 7 margin: 1ex 0;
... ...
media/css/manage_classifications.css
... ... @@ -9,3 +9,18 @@
9 9 .value-controls form {
10 10 display: inline;
11 11 }
  12 +
  13 +.add-classification, .classification, .add-value, .vocabs {
  14 + border: solid black 1px;
  15 + margin: 10px 0 10px 0;
  16 + padding: 10px;
  17 +}
  18 +
  19 +.classification {
  20 + overflow: auto;
  21 + width: auto;
  22 +}
  23 +
  24 +.classification-controls {
  25 + float: right;
  26 +}
... ...