From 5958a3e3fadc47f8d986870a79c80f3b3588b37a Mon Sep 17 00:00:00 2001 From: Kasia Krasnowska <kasia.krasnowska@gmail.com> Date: Mon, 5 Jul 2021 11:24:15 +0200 Subject: [PATCH] last visited fix + css/html fixes/updates --- common/templates/base.html | 3 +-- entries/static/entries/css/entries.css | 2 ++ entries/static/entries/js/entries.js | 2 +- entries/templates/entries.html | 28 +++++++++++++++++--------- entries/templates/entry_display.html | 15 -------------- entries/views.py | 6 +++--- 6 files changed, 25 insertions(+), 31 deletions(-) diff --git a/common/templates/base.html b/common/templates/base.html index e131d1a..b516abc 100644 --- a/common/templates/base.html +++ b/common/templates/base.html @@ -48,8 +48,7 @@ {% trans "Hasła" %} </a> </li> - {% block lastvisited %}{% endblock %} - {% block settings %}{% endblock %} + {% block additional-nav-items %}{% endblock %} <li class="nav-item" id="nav-phrases"> <a class="nav-link" href="{% url 'phrase_expansions:phrase_expansions' %}"> {% trans "Typy fraz" %} diff --git a/entries/static/entries/css/entries.css b/entries/static/entries/css/entries.css index a091e47..1ba8fe8 100644 --- a/entries/static/entries/css/entries.css +++ b/entries/static/entries/css/entries.css @@ -177,6 +177,8 @@ legend { .sticky-bottom { position: sticky; bottom: 0; + /* on top of sticky top */ + z-index: 1021; } #entryTabs { diff --git a/entries/static/entries/js/entries.js b/entries/static/entries/js/entries.js index 41dbc35..12e6857 100644 --- a/entries/static/entries/js/entries.js +++ b/entries/static/entries/js/entries.js @@ -853,7 +853,7 @@ function update_last_visited(last_visited) { lv.empty(); for (var i in last_visited) { if (i > 0) { - lv.append('<a class="dropdown-item text-uppercase last-visited" data-entry="' + last_visited[i][1] + '" href="#">' + last_visited[i][0] + '</a>'); + lv.append('<a class="dropdown-item font-weight-bold text-dark text-uppercase last-visited" data-entry="' + last_visited[i][1] + '" href="#">' + last_visited[i][0] + '</a>'); } } bind_last_visited(); diff --git a/entries/templates/entries.html b/entries/templates/entries.html index d11d095..8ede0a2 100644 --- a/entries/templates/entries.html +++ b/entries/templates/entries.html @@ -28,20 +28,33 @@ <script src="{% static 'entries/js/entries.js' %}"></script> {% endblock %} -{% block lastvisited %} +{% block additional-nav-items %} +<li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" id="nav-filters" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + {% trans "Filtrowanie" %} + </a> + <div class="dropdown-menu" id="filters-visited-dropdown" aria-labelledby="nav-filters"> + <a href="#" class="dropdown-item font-weight-bold text-dark text-uppercase" id="filter-button" data-toggle="modal" data-target="#entry-filters"> + {% trans "Hasła" %} + </a> + <a href="#" class="dropdown-item font-weight-bold text-dark text-uppercase" id="filter-frames-button" data-toggle="modal" data-target="#frame-filters"> + {% trans "Ramy" %} + </a> + <a href="#" class="dropdown-item font-weight-bold text-dark text-uppercase" id="filter-schemata-button" data-toggle="modal" data-target="#schema-filters"> + {% trans "Schematy" %} + </a> + </div> +</li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="nav-last" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {% trans "Ostatnio oglądane" %} </a> <div class="dropdown-menu" id="last-visited-dropdown" aria-labelledby="nav-last"> {% for lemma, eid in request.session.last_visited|slice:":-1" %} - <a class="dropdown-item text-uppercase last-visited" data-entry="{{ eid }}" href="#">{{ lemma }}</a> + <a class="dropdown-item font-weight-bold text-dark text-uppercase last-visited" data-entry="{{ eid }}" href="#">{{ lemma }}</a> {% endfor %} </div> </li> -{% endblock %} - -{% block settings %} <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="nav-options" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {% trans "Opcje" %} @@ -62,11 +75,6 @@ <div class="row h-100 m-0 p-0 bg-secondary"> <!-- left panel: list of entries --> <div id="entries-list" class="col h-100 w-100 px-0"> - <div id="filter-div" class="col p-1"> - <button type="button" id='filter-button' class="btn btn-sm btn-block btn-outline-dark" data-toggle="modal" data-target="#entry-filters"> - {% trans "Filtrowanie haseł" %} - </button> - </div> <div id="entries-list-div" class="col p-0 h-100 w-100 overflow-auto"> {% include "entries_list.html" %} </div> diff --git a/entries/templates/entry_display.html b/entries/templates/entry_display.html index d187e45..de2ad14 100644 --- a/entries/templates/entry_display.html +++ b/entries/templates/entry_display.html @@ -23,19 +23,9 @@ <div class="row m-0 p-0" id="semantics-top-pane"> <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-frames-pane"> <div id="semantics-frames"></div> - <div class="sticky-bottom px-0 py-1 bg-white local-filter"> - <button type="button" id='semantics-filter-frames-button' class="btn btn-block btn-sm btn-outline-dark" data-toggle="modal" data-target="#frame-filters"> - {% trans "Filtrowanie ram" %} - </button> - </div> </div> <div class="col h-100 px-1 pt-0 pb-0 overflow-auto" id="semantics-schemata-pane"> <div id="semantics-schemata"></div> - <div class="sticky-bottom px-0 py-1 bg-white local-filter"> - <button type="button" id='semantics-filter-schemata-button' class="btn btn-block btn-sm btn-outline-dark" data-toggle="modal" data-target="#schema-filters"> - {% trans "Filtrowanie schematów" %} - </button> - </div> </div> </div> <div class="row m-0 p-0 overflow-auto" id="semantics-examples-pane"> @@ -56,11 +46,6 @@ <div class="col h-100 w-100 p-0 tab-pane" id="syntax" role="tabpanel" aria-labelledby="syntax-tab"> <div class="col w-100 px-1 pt-0 pb-0 overflow-auto" id="syntax-schemata-pane"> <div id="syntax-schemata"></div> - <div class="sticky-bottom px-0 py-1 bg-white local-filter"> - <button type="button" id='syntax-filter-schemata-button' class="btn btn-block btn-sm btn-outline-dark" data-toggle="modal" data-target="#schema-filters"> - {% trans "Filtrowanie schematów" %} - </button> - </div> </div> <div class="col w-100 p-0 overflow-auto" id="syntax-examples-pane"> <table id="syntax-examples" class="table table-sm table-hover"> diff --git a/entries/views.py b/entries/views.py index a33b075..b4b6e0e 100644 --- a/entries/views.py +++ b/entries/views.py @@ -413,9 +413,9 @@ def schema2dict(schema, negativity, lang): 'str' : str(pt), 'id' : '{}-{}-{}'.format(schema.id, p.id, pt.id), 'desc' : get_phrase_desc(pt, p, negativity, lang), - } for pt in p.phrase_types.all() + } for pt in p.sorted_phrase_types() ], - } for p in schema.positions.all() + } for p in schema.sorted_positions() ], } @@ -661,7 +661,7 @@ def get_entry(request): request.session['last_visited'].insert(0, (entry.name, entry.id)) request.session['last_visited'] = request.session['last_visited'][:(MAX_LAST_VISITED + 1)] request.session.modified = True - return JsonResponse({ 'subentries' : subentries, 'frames' : frames, 'alternations' : alternations, 'realisation_phrases' : realisation_phrases, 'realisation_descriptions' : realisation_descriptions, 'examples' : examples }) + return JsonResponse({ 'subentries' : subentries, 'frames' : frames, 'alternations' : alternations, 'realisation_phrases' : realisation_phrases, 'realisation_descriptions' : realisation_descriptions, 'examples' : examples, 'last_visited' : request.session['last_visited'] }) return JsonResponse({}) ''' -- GitLab