Commit 51cf554dc67c0d509f3e6ee014fd14ada389ffca
1 parent
8858009d
added ‘import in progress’ info
Showing
14 changed files
with
125 additions
and
69 deletions
common/management/commands/start_import.py
0 → 100644
common/models.py
common/static/common/js/init.js
common/static/common/js/utils.js
... | ... | @@ -7,6 +7,17 @@ jQuery.fn.immediateText = function() { |
7 | 7 | return this.contents().not(this.children()).text(); |
8 | 8 | }; |
9 | 9 | |
10 | +function tooltipped_span(text, tooltip_text, cls) { | |
11 | + var html = tooltip_text.includes('<') ? ' data-html="true"' : ''; | |
12 | + cls = cls ? ' class="' + cls + '"' : ''; | |
13 | + // https://www.w3schools.com/jsref/jsref_replace.asp /xyz/g to replace ALL occurrences of xyz | |
14 | + return '<span data-toggle="tooltip" data-placement="bottom"' + cls + html + ' title="' + tooltip_text.replace(/"/g, '"') + '">' + text + '</span>'; | |
15 | +} | |
16 | + | |
17 | +function tooltipped_info(text) { | |
18 | + return tooltipped_span('<img src="/static/common/img/info.svg" alt="info" width="14" height="14"/>', text); | |
19 | +} | |
20 | + | |
10 | 21 | function activate_tooltips(selector) { |
11 | 22 | selector.find('[data-toggle="tooltip"]').tooltip(); |
12 | 23 | } |
... | ... | @@ -50,3 +61,21 @@ function show_info_alert(text, insert_after) { |
50 | 61 | var alert = '<div class="alert alert-info alert-dismissible fade show" role="alert">' + text + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>'; |
51 | 62 | insert_after.after(alert); |
52 | 63 | } |
64 | + | |
65 | +function check_import_status() { | |
66 | + $.ajax({ | |
67 | + type : 'get', | |
68 | + url : '/' + lang + '/common/get_import_status/', | |
69 | + dataType : 'json', | |
70 | + success : function(response) { | |
71 | + if (response.status === 'in_progress') { | |
72 | + $('#import-status').html(gettext('Trwa import danych!')); | |
73 | + } else { | |
74 | + $('#import-status').empty(); | |
75 | + } | |
76 | + }, | |
77 | + error: function(request, errorType, errorMessage) { | |
78 | + show_error(errorType + ' (' + errorMessage + ')'); | |
79 | + } | |
80 | + }); | |
81 | +} | |
... | ... |
common/templates/base.html
... | ... | @@ -69,7 +69,9 @@ |
69 | 69 | </li> |
70 | 70 | </ul> |
71 | 71 | </div> |
72 | + <span id="import-status" class="navbar-text text-warning mr-3"></span> | |
72 | 73 | <a |
74 | + id="lang-btn" | |
73 | 75 | class="btn btn-sm btn-outline-light" |
74 | 76 | href="{% if LANGUAGE_CODE == "pl" %}/en{% else %}/pl{% endif %}{{ request.path|slice:"3:" }}" |
75 | 77 | > |
... | ... |
common/urls.py
0 → 100644
common/views.py
1 | +from django.http import JsonResponse | |
1 | 2 | from django.shortcuts import render |
2 | 3 | |
4 | +from common.decorators import ajax_required | |
5 | +from common.models import ImportInProgress | |
6 | + | |
3 | 7 | def dash(request): |
4 | 8 | return render(request, 'dash.html') |
5 | 9 | |
... | ... | @@ -8,3 +12,9 @@ def error_400(request, exception): |
8 | 12 | |
9 | 13 | def error_404(request, exception): |
10 | 14 | return render(request, 'base.html', status=404) |
15 | + | |
16 | +@ajax_required | |
17 | +def get_import_status(request): | |
18 | + if request.method == 'GET': | |
19 | + in_progress = bool(ImportInProgress.objects.all().count()) | |
20 | + return JsonResponse({'status' : 'in_progress' if in_progress else 'complete'}) | |
... | ... |
entries/static/entries/js/entries.js
... | ... | @@ -16,17 +16,6 @@ function make_opinion_row(item, span, width) { |
16 | 16 | return opinion_row; |
17 | 17 | } |
18 | 18 | |
19 | -function tooltipped_span(text, tooltip_text, cls) { | |
20 | - var html = tooltip_text.includes('<') ? ' data-html="true"' : ''; | |
21 | - cls = cls ? ' class="' + cls + '"' : ''; | |
22 | - // https://www.w3schools.com/jsref/jsref_replace.asp /xyz/g to replace ALL occurrences of xyz | |
23 | - return '<span data-toggle="tooltip" data-placement="bottom"' + cls + html + ' title="' + tooltip_text.replace(/"/g, '"') + '">' + text + '</span>'; | |
24 | -} | |
25 | - | |
26 | -function tooltipped_info(text) { | |
27 | - return tooltipped_span('<img src="/static/common/img/info.svg" alt="info" width="14" height="14"/>', text); | |
28 | -} | |
29 | - | |
30 | 19 | // TODO make schema2dom and frame2dom share as much code as possible |
31 | 20 | function schema2dom(schema) { |
32 | 21 | var div = document.createElement('div'); |
... | ... | @@ -795,6 +784,7 @@ function show_unmatched_examples() { |
795 | 784 | } |
796 | 785 | |
797 | 786 | function get_entry(entry_id) { |
787 | + check_import_status(); | |
798 | 788 | clear_entry(); |
799 | 789 | show_entry_spinners(); |
800 | 790 | var data = { 'forms' : serialize_forms($('#main-form')), 'entry' : entry_id }; |
... | ... |
entries/templates/entry_display.html
... | ... | @@ -19,10 +19,10 @@ |
19 | 19 | </ul> |
20 | 20 | |
21 | 21 | <div class="tab-content h-100 w-100 p-0" id="entryTabsContent"> |
22 | - <div class="col h-100 w-100 tab-pane show active" id="semantics" role="tabpanel" aria-labelledby="semantics-tab"> | |
22 | + <div class="col h-100 w-100 px-3 py-0 tab-pane show active" id="semantics" role="tabpanel" aria-labelledby="semantics-tab"> | |
23 | 23 | <div class="row p-0" id="semantics-top-pane"> |
24 | - <div class="col h-100 py-2 px-3 overflow-auto" id="semantics-frames"></div> | |
25 | - <div class="col h-100 py-2 px-3 overflow-auto" id="semantics-schemata"></div> | |
24 | + <div class="col h-100 p-2 overflow-auto" id="semantics-frames"></div> | |
25 | + <div class="col h-100 p-2 overflow-auto" id="semantics-schemata"></div> | |
26 | 26 | </div> |
27 | 27 | <div class="row p-2 overflow-auto" id="semantics-bottom-pane"> |
28 | 28 | <table id="semantics-examples" class="table table-sm table-hover"> |
... | ... | @@ -39,8 +39,8 @@ |
39 | 39 | <p class="mx-1 my-1"id="semantics-no-examples">{% trans "Brak przykładów" %}</p> |
40 | 40 | </div> |
41 | 41 | </div> |
42 | - <div class="col h-100 w-100 p-0 tab-pane" id="syntax" role="tabpanel" aria-labelledby="syntax-tab"> | |
43 | - <div class="col w-100 py-2 px-3 overflow-auto" id="syntax-schemata"></div> | |
42 | + <div class="col h-100 w-100 px-3 py-0 tab-pane" id="syntax" role="tabpanel" aria-labelledby="syntax-tab"> | |
43 | + <div class="col w-100 p-2 overflow-auto" id="syntax-schemata"></div> | |
44 | 44 | <div class="col w-100 p-2 overflow-auto" id="syntax-examples-pane"> |
45 | 45 | <table id="syntax-examples" class="table table-sm table-hover table-responsive"> |
46 | 46 | <thead> |
... | ... | @@ -55,10 +55,8 @@ |
55 | 55 | </table> |
56 | 56 | <p class="mx-1 my-1"id="syntax-no-examples">{% trans "Brak przykładów" %}</p> |
57 | 57 | </div> |
58 | - | |
59 | - | |
60 | 58 | </div> |
61 | - <div class="col h-100 w-100 tab-pane" id="examples" role="tabpanel" aria-labelledby="examples-tab"> | |
59 | + <div class="col h-100 w-100 p-3 tab-pane" id="examples" role="tabpanel" aria-labelledby="examples-tab"> | |
62 | 60 | <table id="unmatched-examples" class="table table-sm table-hover table-responsive"> |
63 | 61 | <thead> |
64 | 62 | <tr> |
... | ... |
entries/views.py
locale/en/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2021-05-28 10:56+0200\n" | |
11 | +"POT-Creation-Date: 2021-06-01 11:18+0200\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" |
... | ... | @@ -35,7 +35,7 @@ msgstr "Statistics" |
35 | 35 | msgid "Pobierz słownik" |
36 | 36 | msgstr "Download dictionary" |
37 | 37 | |
38 | -#: common/templates/base.html:81 | |
38 | +#: common/templates/base.html:77 | |
39 | 39 | msgid "EN" |
40 | 40 | msgstr "PL" |
41 | 41 | |
... | ... | @@ -300,7 +300,7 @@ msgstr "Semantic frame" |
300 | 300 | |
301 | 301 | #: entries/forms.py:546 entries/templates/entry_display.html:33 |
302 | 302 | #: entries/templates/entry_display.html:50 |
303 | -#: entries/templates/entry_display.html:67 | |
303 | +#: entries/templates/entry_display.html:65 | |
304 | 304 | msgid "Opinia" |
305 | 305 | msgstr "Opinion" |
306 | 306 | |
... | ... | @@ -932,8 +932,8 @@ msgid "" |
932 | 932 | "%(a1)s czasownika wymagającego bezokolicznika, którego własności są tożsame " |
933 | 933 | "z narzucanymi przez czasownik w bezokoliczniku, w tym brak podmiotu" |
934 | 934 | msgstr "" |
935 | -"%(a1)s of a verb requiring an infinitive, with properties identical to " | |
936 | -"those imposed by the infinitive, including no subject" | |
935 | +"%(a1)s of a verb requiring an infinitive, with properties identical to those " | |
936 | +"imposed by the infinitive, including no subject" | |
937 | 937 | |
938 | 938 | #. Translators: fraza, posesywna, odpowiadająca |
939 | 939 | #: entries/phrase_descriptions/polish_strings.py:288 |
... | ... | @@ -1640,7 +1640,8 @@ msgid "" |
1640 | 1640 | "mianownik na pozycji podmiotu, biernik albo dopełniacz w zależności od " |
1641 | 1641 | "negacji na pozycji dopełnienia" |
1642 | 1642 | msgstr "" |
1643 | -"nominative on a subject position, accusative or genitive depending on negation on a direct object position" | |
1643 | +"nominative on a subject position, accusative or genitive depending on " | |
1644 | +"negation on a direct object position" | |
1644 | 1645 | |
1645 | 1646 | #: entries/polish_strings.py:80 |
1646 | 1647 | msgid "mianownik" |
... | ... | @@ -1970,19 +1971,19 @@ msgstr "Unmatched examples" |
1970 | 1971 | |
1971 | 1972 | #: entries/templates/entry_display.html:31 |
1972 | 1973 | #: entries/templates/entry_display.html:48 |
1973 | -#: entries/templates/entry_display.html:65 | |
1974 | +#: entries/templates/entry_display.html:63 | |
1974 | 1975 | msgid "Przykład" |
1975 | 1976 | msgstr "Example" |
1976 | 1977 | |
1977 | 1978 | #: entries/templates/entry_display.html:32 |
1978 | 1979 | #: entries/templates/entry_display.html:49 |
1979 | -#: entries/templates/entry_display.html:66 | |
1980 | +#: entries/templates/entry_display.html:64 | |
1980 | 1981 | msgid "Źródło" |
1981 | 1982 | msgstr "Source" |
1982 | 1983 | |
1983 | 1984 | #: entries/templates/entry_display.html:39 |
1984 | 1985 | #: entries/templates/entry_display.html:56 |
1985 | -#: entries/templates/entry_display.html:73 | |
1986 | +#: entries/templates/entry_display.html:71 | |
1986 | 1987 | msgid "Brak przykładów" |
1987 | 1988 | msgstr "No examples" |
1988 | 1989 | |
... | ... |
locale/en/LC_MESSAGES/djangojs.mo
No preview for this file type
locale/en/LC_MESSAGES/djangojs.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2021-05-28 10:56+0200\n" | |
11 | +"POT-Creation-Date: 2021-06-01 11:18+0200\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" |
... | ... | @@ -18,6 +18,10 @@ msgstr "" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" |
20 | 20 | |
21 | +#: common/static/common/js/init.js:17 | |
22 | +msgid "Trwa import danych!" | |
23 | +msgstr "Data import in progress!" | |
24 | + | |
21 | 25 | #: entries/static/entries/js/entries.js:14 |
22 | 26 | msgid "Opinia" |
23 | 27 | msgstr "Opinion" |
... | ... | @@ -50,125 +54,125 @@ msgstr "Selectional preferences" |
50 | 54 | msgid "brak ram" |
51 | 55 | msgstr "no frames" |
52 | 56 | |
53 | -#: entries/static/entries/js/entries.js:222 | |
57 | +#: entries/static/entries/js/entries.js:223 | |
54 | 58 | msgid "Kliknij, aby wyświetlić przykłady dla tego schematu." |
55 | 59 | msgstr "Click to show examples for this schema." |
56 | 60 | |
57 | -#: entries/static/entries/js/entries.js:259 | |
61 | +#: entries/static/entries/js/entries.js:260 | |
58 | 62 | msgid "Kliknij, aby cofnąć wyświetlanie przykładów dla tego schematu." |
59 | 63 | msgstr "Click to undo showing examples for this schema." |
60 | 64 | |
61 | -#: entries/static/entries/js/entries.js:271 | |
62 | -#: entries/static/entries/js/entries.js:461 | |
63 | -#: entries/static/entries/js/entries.js:493 | |
64 | -#: entries/static/entries/js/entries.js:539 | |
65 | +#: entries/static/entries/js/entries.js:272 | |
66 | +#: entries/static/entries/js/entries.js:463 | |
67 | +#: entries/static/entries/js/entries.js:495 | |
68 | +#: entries/static/entries/js/entries.js:541 | |
65 | 69 | msgid "" |
66 | 70 | "Kliknij, aby cofnąć ograniczenie wyświetlanych przykładów do powiązanych z" |
67 | 71 | msgstr "Click to undo restriction to examples linked to" |
68 | 72 | |
69 | -#: entries/static/entries/js/entries.js:271 | |
70 | -#: entries/static/entries/js/entries.js:273 | |
73 | +#: entries/static/entries/js/entries.js:272 | |
74 | +#: entries/static/entries/js/entries.js:274 | |
71 | 75 | msgid "tą pozycją" |
72 | 76 | msgstr "this position" |
73 | 77 | |
74 | -#: entries/static/entries/js/entries.js:271 | |
75 | -#: entries/static/entries/js/entries.js:273 | |
78 | +#: entries/static/entries/js/entries.js:272 | |
79 | +#: entries/static/entries/js/entries.js:274 | |
76 | 80 | msgid "tą frazą" |
77 | 81 | msgstr "this phrase" |
78 | 82 | |
79 | -#: entries/static/entries/js/entries.js:273 | |
80 | -#: entries/static/entries/js/entries.js:463 | |
81 | -#: entries/static/entries/js/entries.js:495 | |
82 | -#: entries/static/entries/js/entries.js:541 | |
83 | +#: entries/static/entries/js/entries.js:274 | |
84 | +#: entries/static/entries/js/entries.js:465 | |
85 | +#: entries/static/entries/js/entries.js:497 | |
86 | +#: entries/static/entries/js/entries.js:543 | |
83 | 87 | msgid "Kliknij, aby wyświetlić wyłącznie przykłady powiązane z" |
84 | 88 | msgstr "Click to show only examples linked to" |
85 | 89 | |
86 | -#: entries/static/entries/js/entries.js:358 | |
90 | +#: entries/static/entries/js/entries.js:360 | |
87 | 91 | msgid "" |
88 | 92 | "Kliknij, aby wyświetlić przykłady dla tej ramy oraz jej realizacje " |
89 | 93 | "składniowe." |
90 | 94 | msgstr "" |
91 | 95 | "Click to show examples linked to this frame and its syntactic realisations." |
92 | 96 | |
93 | -#: entries/static/entries/js/entries.js:461 | |
94 | 97 | #: entries/static/entries/js/entries.js:463 |
98 | +#: entries/static/entries/js/entries.js:465 | |
95 | 99 | msgid "tym znaczeniem" |
96 | 100 | msgstr "this meaning" |
97 | 101 | |
98 | -#: entries/static/entries/js/entries.js:493 | |
99 | 102 | #: entries/static/entries/js/entries.js:495 |
103 | +#: entries/static/entries/js/entries.js:497 | |
100 | 104 | msgid "tą rolą" |
101 | 105 | msgstr "this role" |
102 | 106 | |
103 | -#: entries/static/entries/js/entries.js:539 | |
104 | 107 | #: entries/static/entries/js/entries.js:541 |
108 | +#: entries/static/entries/js/entries.js:543 | |
105 | 109 | msgid "tym schematem" |
106 | 110 | msgstr "this schema" |
107 | 111 | |
108 | -#: entries/static/entries/js/entries.js:569 | |
112 | +#: entries/static/entries/js/entries.js:571 | |
109 | 113 | msgid "Kliknij, aby cofnąć wybór tej ramy." |
110 | 114 | msgstr "Click to undo choice if this frame." |
111 | 115 | |
112 | -#: entries/static/entries/js/entries.js:672 | |
113 | -#: entries/static/entries/js/entries.js:778 | |
116 | +#: entries/static/entries/js/entries.js:674 | |
117 | +#: entries/static/entries/js/entries.js:780 | |
114 | 118 | msgid "Komentarz" |
115 | 119 | msgstr "Comment" |
116 | 120 | |
117 | -#: entries/static/entries/js/entries.js:689 | |
121 | +#: entries/static/entries/js/entries.js:691 | |
118 | 122 | msgid "" |
119 | 123 | "Kliknij, aby cofnąć wyświetlanie typów fraz powiązanych z tym przykładem." |
120 | 124 | msgstr "Click to undo showing phrase types linked to this example." |
121 | 125 | |
122 | -#: entries/static/entries/js/entries.js:691 | |
126 | +#: entries/static/entries/js/entries.js:693 | |
123 | 127 | msgid "Kliknij, aby wyświetlić typy fraz powiązane z tym przykładem." |
124 | 128 | msgstr "Click to show phrase types linked to this example." |
125 | 129 | |
126 | -#: entries/static/entries/js/entries.js:730 | |
130 | +#: entries/static/entries/js/entries.js:732 | |
127 | 131 | msgid "" |
128 | 132 | "Kliknij, aby cofnąć wyświetlanie argumentów i typów fraz powiązanych z tym " |
129 | 133 | "przykładem." |
130 | 134 | msgstr "" |
131 | 135 | "Click to undo showing arguments and phrase types linked to this example." |
132 | 136 | |
133 | -#: entries/static/entries/js/entries.js:732 | |
137 | +#: entries/static/entries/js/entries.js:734 | |
134 | 138 | msgid "" |
135 | 139 | "Kliknij, aby wyświetlić argumenty i typy fraz powiązane z tym przykładem." |
136 | 140 | msgstr "Click to show arguments and phrase types linked to this example." |
137 | 141 | |
138 | -#: entries/static/entries/js/entries.js:950 | |
142 | +#: entries/static/entries/js/entries.js:968 | |
139 | 143 | msgid "Przetwarzanie..." |
140 | 144 | msgstr "Processing" |
141 | 145 | |
142 | -#: entries/static/entries/js/entries.js:951 | |
143 | -#: entries/static/entries/js/entries.js:1007 | |
146 | +#: entries/static/entries/js/entries.js:969 | |
147 | +#: entries/static/entries/js/entries.js:1025 | |
144 | 148 | msgid "Szukaj:" |
145 | 149 | msgstr "Search:" |
146 | 150 | |
147 | -#: entries/static/entries/js/entries.js:952 | |
151 | +#: entries/static/entries/js/entries.js:970 | |
148 | 152 | msgid "Liczba haseł: _TOTAL_" |
149 | 153 | msgstr "_TOTAL_ entries" |
150 | 154 | |
151 | -#: entries/static/entries/js/entries.js:953 | |
152 | -#: entries/static/entries/js/entries.js:1008 | |
155 | +#: entries/static/entries/js/entries.js:971 | |
156 | +#: entries/static/entries/js/entries.js:1026 | |
153 | 157 | msgid "Liczba haseł: 0" |
154 | 158 | msgstr "0 entries" |
155 | 159 | |
156 | -#: entries/static/entries/js/entries.js:954 | |
160 | +#: entries/static/entries/js/entries.js:972 | |
157 | 161 | msgid "(spośród _MAX_)" |
158 | 162 | msgstr "(out of _MAX_)" |
159 | 163 | |
160 | -#: entries/static/entries/js/entries.js:955 | |
161 | -#: entries/static/entries/js/entries.js:1009 | |
164 | +#: entries/static/entries/js/entries.js:973 | |
165 | +#: entries/static/entries/js/entries.js:1027 | |
162 | 166 | msgid "Brak haseł do wyświetlenia." |
163 | 167 | msgstr "No entries to display." |
164 | 168 | |
165 | -#: entries/static/entries/js/entries.js:957 | |
166 | -#: entries/static/entries/js/entries.js:1011 | |
169 | +#: entries/static/entries/js/entries.js:975 | |
170 | +#: entries/static/entries/js/entries.js:1029 | |
167 | 171 | msgid ": sortuj kolumnę rosnąco" |
168 | 172 | msgstr ": sort column in ascending order" |
169 | 173 | |
170 | -#: entries/static/entries/js/entries.js:958 | |
171 | -#: entries/static/entries/js/entries.js:1012 | |
174 | +#: entries/static/entries/js/entries.js:976 | |
175 | +#: entries/static/entries/js/entries.js:1030 | |
172 | 176 | msgid ": sortuj kolumnę malejąco" |
173 | 177 | msgstr ": sort column in descending order" |
174 | 178 | |
... | ... |
shellvalier/urls.py
... | ... | @@ -8,6 +8,7 @@ from common.views import dash, error_400, error_404 |
8 | 8 | |
9 | 9 | # prepend non default-language to the urls |
10 | 10 | urlpatterns = i18n_patterns( |
11 | + path('common/', include('common.urls')), | |
11 | 12 | path('entries/', include('entries.urls')), |
12 | 13 | path('phrase_expansions/', include('phrase_expansions.urls')), |
13 | 14 | path('dictionary_statistics/', include('dictionary_statistics.urls')), |
... | ... |