Commit 4d9921c9076cbf4ec85ef0bc290189e3d9fe5232

Authored by Katarzyna Krasnowska
1 parent 4b5ab697

subform description fixes + translations

entries/static/entries/js/forms.js
... ... @@ -42,43 +42,52 @@ function bind_remove_subforms(selector) {
42 42 });
43 43 }
44 44  
45   -function collapsed_subform_desc(element, negated) {
  45 +function collapsed_attr_vals(element, negated) {
46 46 var tag = element.tagName();
47   - var ret = '';
  47 + var vals = [];
48 48 var neg_prefix = (negated ? (gettext('nie') + ' ') : '');
  49 + if (tag === 'input') {
  50 + if (element.prop('type') === 'checkbox') {
  51 + if (element.prop('checked')) {
  52 + vals.push(neg_prefix + '<i>' + element.siblings('label').immediateText().trim() + '</i>');
  53 + }
  54 + } else if (element.prop('type') === 'text') {
  55 + var val = element.val();
  56 + if (val && val !== ".*") {
  57 + vals.push(neg_prefix + '<i>"' + val + '"</i>');
  58 + }
  59 + } else {
  60 + vals.push('??? ' + element.attr('class') + ' ???');
  61 + }
  62 + } else if (tag === 'select') {
  63 + return element.val().map(x => neg_prefix + '<i>' + element.find('option[value="' + x + '"]').html() + '</i>');
  64 + } else {
  65 + element.children().each(function() {
  66 + vals = vals.concat(collapsed_attr_vals($(this), negated));
  67 + });
  68 + }
  69 + return vals;
  70 +}
  71 +
  72 +function collapsed_subform_desc(element) {
  73 + var tag = element.tagName();
  74 + var ret = '';
49 75 if (tag === 'label') {
50 76 var input_siblings = element.siblings('input');
51 77 if (input_siblings.length === 0) {
52 78 var neg = element.hasClass('negated2');
53   - var values = [];
  79 + var vals = [];
54 80 element.next().children().each(function() {
55   - var val = collapsed_subform_desc($(this), neg);
56   - if (val) {
57   - values.push(val);
58   - }
  81 + vals = vals.concat(collapsed_attr_vals($(this), neg));
59 82 });
60   - if (values.length > 0) {
  83 + if (vals.length > 0) {
61 84 ret += '<b>' + element.html().trim() + ': </b>';
62   - ret += values.join(' ' + (neg ? gettext('i') : gettext('lub')) + ' ');
  85 + ret += vals.join(' ' + (neg ? gettext('i') : gettext('lub')) + ' ');
63 86 }
64 87 return ret;
65 88 } else {
66 89 return '';
67 90 }
68   - } else if (tag === 'input') {
69   - if (element.prop('type') === 'checkbox') {
70   - if (element.prop('checked')) {
71   - return neg_prefix + '<i>' + element.siblings('label').immediateText().trim() + '</i>';
72   - } else {
73   - return '';
74   - }
75   - } else if (element.prop('type') === 'text') {
76   - return neg_prefix + '<i>"' + element.val() + '"</i>';
77   - } else {
78   - return '??? ' + element.attr('class') + ' ???';
79   - }
80   - } else if (tag === 'select') {
81   - return element.val().map(x => neg_prefix + '<i>' + element.find('option[value="' + x + '"]').html() + '</i>').join(' ' + (negated ? gettext('i') : gettext('lub')) + ' ');
82 91 } else if (tag === 'form') {
83 92 var attributes = [];
84 93 element.children('fieldset').children('.form-group.row').children('label').each(function() {
... ... @@ -95,7 +104,7 @@ function collapsed_subform_desc(element, negated) {
95 104 return '';
96 105 } else {
97 106 element.children().each(function() {
98   - ret += collapsed_subform_desc($(this), negated);
  107 + ret += collapsed_subform_desc($(this));
99 108 });
100 109 return ret;
101 110 }
... ... @@ -114,7 +123,7 @@ function bind_collapse_subforms(selector) {
114 123 $(this).data('collapsed', false);
115 124 } else {
116 125 $(this).closest('legend').nextAll().hide();
117   - $(this).closest('legend').find('.collapsed-info').html(collapsed_subform_desc($(this).closest('.subform'), false));
  126 + $(this).closest('legend').find('.collapsed-info').html(collapsed_subform_desc($(this).closest('.subform')));
118 127 $(this).html(gettext('rozwiń'));
119 128 $(this).data('collapsed', true);
120 129 }
... ...
locale/en/LC_MESSAGES/django.po
... ... @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 8 msgstr ""
9 9 "Project-Id-Version: PACKAGE VERSION\n"
10 10 "Report-Msgid-Bugs-To: \n"
11   -"POT-Creation-Date: 2021-01-13 17:18+0100\n"
  11 +"POT-Creation-Date: 2021-01-19 10:57+0100\n"
12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
... ...
locale/en/LC_MESSAGES/djangojs.mo
No preview for this file type
locale/en/LC_MESSAGES/djangojs.po
... ... @@ -8,7 +8,7 @@ msgid &quot;&quot;
8 8 msgstr ""
9 9 "Project-Id-Version: PACKAGE VERSION\n"
10 10 "Report-Msgid-Bugs-To: \n"
11   -"POT-Creation-Date: 2021-01-13 17:18+0100\n"
  11 +"POT-Creation-Date: 2021-01-19 10:57+0100\n"
12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14 "Language-Team: LANGUAGE <LL@li.org>\n"
... ... @@ -179,22 +179,22 @@ msgid &quot;Formularz filtrowania zawiera błędy.&quot;
179 179 msgstr "The filtering form contains errors."
180 180  
181 181 #: entries/static/entries/js/entries2.js:107
182   -#: entries/static/entries/js/forms.js:51
  182 +#: entries/static/entries/js/forms.js:113
183 183 msgid "zwiń"
184 184 msgstr "collapse"
185 185  
186 186 #: entries/static/entries/js/entries2.js:112
187   -#: entries/static/entries/js/forms.js:56
  187 +#: entries/static/entries/js/forms.js:118
188 188 msgid "rozwiń"
189 189 msgstr "expand"
190 190  
191 191 #: entries/static/entries/js/entries2.js:149
192   -#: entries/static/entries/js/forms.js:127
  192 +#: entries/static/entries/js/forms.js:189
193 193 msgid "LUB"
194 194 msgstr "OR"
195 195  
196 196 #: entries/static/entries/js/entries2.js:149
197   -#: entries/static/entries/js/forms.js:127
  197 +#: entries/static/entries/js/forms.js:189
198 198 msgid "Usuń"
199 199 msgstr "Remove"
200 200  
... ... @@ -212,7 +212,19 @@ msgstr &quot;Click to show arguments and phrases linked to this example.&quot;
212 212 msgid "brak haseł"
213 213 msgstr "no entries"
214 214  
215   -#: entries/static/entries/js/forms.js:69
  215 +#: entries/static/entries/js/forms.js:48
  216 +msgid "nie"
  217 +msgstr "not"
  218 +
  219 +#: entries/static/entries/js/forms.js:62 entries/static/entries/js/forms.js:81
  220 +msgid "i"
  221 +msgstr "and"
  222 +
  223 +#: entries/static/entries/js/forms.js:62 entries/static/entries/js/forms.js:81
  224 +msgid "lub"
  225 +msgstr "or"
  226 +
  227 +#: entries/static/entries/js/forms.js:131
216 228 msgid ""
217 229 "Łączenie negacji elementu z operatorem ‹inny› na jednym poziomie formularza "
218 230 "jest niemożliwe."
... ... @@ -220,33 +232,33 @@ msgstr &quot;&quot;
220 232 "Mixing element negation with ‹other› operator on the same level is not "
221 233 "possible."
222 234  
223   -#: entries/static/entries/js/forms.js:86
  235 +#: entries/static/entries/js/forms.js:148
224 236 msgid "Kliknij, aby wyłączyć negację tego atrybutu."
225 237 msgstr "Click to switch off negation of this attribute."
226 238  
227   -#: entries/static/entries/js/forms.js:88
  239 +#: entries/static/entries/js/forms.js:150
228 240 msgid "Kliknij, aby zanegować ten atrybut."
229 241 msgstr "Click to negate this attribute."
230 242  
231   -#: entries/static/entries/js/forms.js:112
  243 +#: entries/static/entries/js/forms.js:174
232 244 msgid ""
233 245 "Łączenie operatorów ‹lub› i ‹inny› na jednym poziomie formularza jest "
234 246 "niemożliwe."
235 247 msgstr "Mixing ‹or› and ‹other› operators on the same level is not possible."
236 248  
237   -#: entries/static/entries/js/forms.js:119
  249 +#: entries/static/entries/js/forms.js:181
238 250 msgid "Proszę najpierw dodać element,"
239 251 msgstr "First add an element"
240 252  
241   -#: entries/static/entries/js/forms.js:119
  253 +#: entries/static/entries/js/forms.js:181
242 254 msgid "aby użyć operatora ‹lub›"
243 255 msgstr "in order to use ‹or› operator"
244 256  
245   -#: entries/static/entries/js/forms.js:119
  257 +#: entries/static/entries/js/forms.js:181
246 258 msgid "aby użyć operatora ‹inny›"
247 259 msgstr "in order to use ‹other› operator"
248 260  
249   -#: entries/static/entries/js/forms.js:123
  261 +#: entries/static/entries/js/forms.js:185
250 262 msgid ""
251 263 "Łączenie operatora ‹inny› z negacją elementu na jednym poziomie formularza "
252 264 "jest niemożliwe."
... ... @@ -254,16 +266,16 @@ msgstr &quot;&quot;
254 266 "Mixing ‹other› operator with element negation on the same level is not "
255 267 "possible."
256 268  
257   -#: entries/static/entries/js/forms.js:127
  269 +#: entries/static/entries/js/forms.js:189
258 270 msgid "INNY"
259 271 msgstr "OTHER"
260 272  
261   -#: entries/static/entries/js/forms.js:138
  273 +#: entries/static/entries/js/forms.js:200
262 274 msgid "Wykonanie zapytania z operatorem ‹inny› może trwać zauważalnie dłużej."
263 275 msgstr ""
264 276 "Execution of a query using the ‹other› operator can take considerably longer."
265 277  
266   -#: entries/static/entries/js/forms.js:229
  278 +#: entries/static/entries/js/forms.js:291
267 279 msgid ""
268 280 "Dodanie elementu jest niemożliwe: osiągnięto maksymalny poziom zagnieżdżenia."
269 281 msgstr "Can’t add an element: maximum depth reached."
... ...