From 7484e5214205485383b7243d1fdda7cb47866cc6 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Wed, 27 Dec 2023 13:26:31 -0500 Subject: [PATCH] =?UTF-8?q?Improve=20maps=E2=80=99=20pagination=20for=20th?= =?UTF-8?q?e=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- umap/static/umap/content.css | 24 +++++++++++ umap/templates/auth/user_form.html | 2 +- umap/templates/umap/map_list.html | 2 +- umap/templates/umap/map_table.html | 56 ++++++++++++++++--------- umap/templates/umap/user_dashboard.html | 2 +- umap/views.py | 7 +++- 6 files changed, 70 insertions(+), 23 deletions(-) diff --git a/umap/static/umap/content.css b/umap/static/umap/content.css index dfd3848c..ccdb250f 100644 --- a/umap/static/umap/content.css +++ b/umap/static/umap/content.css @@ -134,6 +134,9 @@ h2.section { padding-top: 28px; } h2.tabs a { + color: #666; +} +h2.tabs a:not(.selected) { font-weight: normal; color: #666; } @@ -309,6 +312,12 @@ table.maps td { table.maps thead tr { line-height: 2em; } +table.maps .button { + margin-bottom: 2px; + padding:4px 6px; + height: 36px; + line-height: 23px; +} /* **************************** */ /* Dialog */ @@ -323,6 +332,21 @@ dialog::backdrop { } .close-dialog { text-align: center; + margin-bottom: 0; +} + +/* ********************************* */ +/* Pagination */ +/* ********************************* */ +.pagination { + display: flex; + flex-direction: row; + justify-content: space-around; + margin: 1rem; + border-top: 1px solid gray; +} +.pagination > * { + padding: 1rem; } diff --git a/umap/templates/auth/user_form.html b/umap/templates/auth/user_form.html index 67933eea..088b3be5 100644 --- a/umap/templates/auth/user_form.html +++ b/umap/templates/auth/user_form.html @@ -3,7 +3,7 @@ {% block maincontent %}

- {% trans "My Dashboard" %} | {% trans "My Profile" %} + {% trans "My Dashboard" %} | {% trans "My Profile" %}

diff --git a/umap/templates/umap/map_list.html b/umap/templates/umap/map_list.html index b0c74325..473c7a42 100644 --- a/umap/templates/umap/map_list.html +++ b/umap/templates/umap/map_list.html @@ -1,4 +1,4 @@ -{% load umap_tags umap_tags i18n %} +{% load umap_tags i18n %} {% for map_inst in maps %}
diff --git a/umap/templates/umap/map_table.html b/umap/templates/umap/map_table.html index 5ad884a0..3508d4fd 100644 --- a/umap/templates/umap/map_table.html +++ b/umap/templates/umap/map_table.html @@ -1,16 +1,15 @@ {% load umap_tags i18n %} - {% if not is_ajax %} - - - - - - - - - - {% endif %} + + + + + + + + + + {% for map_inst in maps %} {% with unique_id="map_"|addstr:map_inst.pk %} @@ -18,12 +17,14 @@ +
{% blocktrans %}Name{% endblocktrans %}{% blocktrans %}Who can see / edit{% endblocktrans %}{% blocktrans %}Last save{% endblocktrans %}{% blocktrans %}Owner{% endblocktrans %}{% blocktrans %}Actions{% endblocktrans %}
{% blocktrans %}Name{% endblocktrans %}{% blocktrans %}Preview{% endblocktrans %}{% blocktrans %}Who can see / edit{% endblocktrans %}{% blocktrans %}Last save{% endblocktrans %}{% blocktrans %}Owner{% endblocktrans %}{% blocktrans %}Actions{% endblocktrans %}
{{ map_inst.name }} - + +

- +

@@ -43,9 +44,26 @@ {% endfor %}
-{% if maps.has_next %} - -{% endif %} + diff --git a/umap/templates/umap/user_dashboard.html b/umap/templates/umap/user_dashboard.html index cb3d540a..6e5d4ac7 100644 --- a/umap/templates/umap/user_dashboard.html +++ b/umap/templates/umap/user_dashboard.html @@ -7,7 +7,7 @@ {% trans "Search my maps" as placeholder %}

- {% trans "My Dashboard" %} | {% trans "My profile" %} + {% trans "My Dashboard" %} | {% trans "My profile" %}

{% include "umap/search_bar.html" with action=request.get_full_path placeholder=placeholder %}
diff --git a/umap/views.py b/umap/views.py index 08631cb0..ff2f860f 100644 --- a/umap/views.py +++ b/umap/views.py @@ -270,7 +270,12 @@ class UserDashboard(PaginatorMixin, DetailView, SearchMixin): def get_context_data(self, **kwargs): kwargs.update( - {"maps": self.paginate(self.get_maps(), settings.UMAP_MAPS_PER_PAGE_OWNER)} + { + "q": self.request.GET.get("q"), + "maps": self.paginate( + self.get_maps(), settings.UMAP_MAPS_PER_PAGE_OWNER + ), + } ) return super().get_context_data(**kwargs)