From 037014d0241a93c4e695a1e532575114220900bc Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Sun, 5 Jan 2025 01:22:14 -0300 Subject: [PATCH 1/6] feat(categories): add tab to show archived categories --- app/apps/transactions/urls.py | 10 ++++ app/apps/transactions/views/categories.py | 26 +++++++- app/templates/categories/fragments/list.html | 59 ++++--------------- app/templates/categories/fragments/table.html | 59 +++++++++++++++++++ app/templates/categories/pages/index.html | 2 +- 5 files changed, 106 insertions(+), 50 deletions(-) create mode 100644 app/templates/categories/fragments/table.html diff --git a/app/apps/transactions/urls.py b/app/apps/transactions/urls.py index f0402ea..09ec2a5 100644 --- a/app/apps/transactions/urls.py +++ b/app/apps/transactions/urls.py @@ -79,6 +79,16 @@ urlpatterns = [ ), path("categories/", views.categories_index, name="categories_index"), path("categories/list/", views.categories_list, name="categories_list"), + path( + "categories/table/active/", + views.categories_table_active, + name="categories_table_active", + ), + path( + "categories/table/archived/", + views.categories_table_archived, + name="categories_table_archived", + ), path("categories/add/", views.category_add, name="category_add"), path( "categories//edit/", diff --git a/app/apps/transactions/views/categories.py b/app/apps/transactions/views/categories.py index 4c6975a..1f6fea5 100644 --- a/app/apps/transactions/views/categories.py +++ b/app/apps/transactions/views/categories.py @@ -25,11 +25,33 @@ def categories_index(request): @login_required @require_http_methods(["GET"]) def categories_list(request): - categories = TransactionCategory.objects.all().order_by("id") return render( request, "categories/fragments/list.html", - {"categories": categories}, + ) + + +@only_htmx +@login_required +@require_http_methods(["GET"]) +def categories_table_active(request): + categories = TransactionCategory.objects.filter(active=True).order_by("id") + return render( + request, + "categories/fragments/table.html", + {"categories": categories, "active": True}, + ) + + +@only_htmx +@login_required +@require_http_methods(["GET"]) +def categories_table_archived(request): + categories = TransactionCategory.objects.filter(active=False).order_by("id") + return render( + request, + "categories/fragments/table.html", + {"categories": categories, "active": False}, ) diff --git a/app/templates/categories/fragments/list.html b/app/templates/categories/fragments/list.html index f14ba09..fe950d3 100644 --- a/app/templates/categories/fragments/list.html +++ b/app/templates/categories/fragments/list.html @@ -15,53 +15,18 @@
-
- {% if categories %} - - - - - - - - - - - {% for category in categories %} - - - - - - {% endfor %} - -
{% translate 'Name' %}{% translate 'Muted' %}
-
- - - -
-
{{ category.name }} - {% if category.mute %}{% endif %} -
- {% else %} - - {% endif %} +
+ +
+
+
diff --git a/app/templates/categories/fragments/table.html b/app/templates/categories/fragments/table.html new file mode 100644 index 0000000..b1bdcc4 --- /dev/null +++ b/app/templates/categories/fragments/table.html @@ -0,0 +1,59 @@ +{% load i18n %} +{% if active %} +
+{% else %} +
+{% endif %} +
+ {% if categories %} + + + + + + + + + + + {% for category in categories %} + + + + + + {% endfor %} + +
{% translate 'Name' %}{% translate 'Muted' %}
+
+ + + +
+
{{ category.name }} + {% if category.mute %}{% endif %} +
+ {% else %} + + {% endif %} +
+
diff --git a/app/templates/categories/pages/index.html b/app/templates/categories/pages/index.html index 4714017..218b7bc 100644 --- a/app/templates/categories/pages/index.html +++ b/app/templates/categories/pages/index.html @@ -4,5 +4,5 @@ {% block title %}{% translate 'Categories' %}{% endblock %} {% block content %} -
+
{% endblock %} From 0fc8b0ee4977ef00f004e3990ce8621ac63dec1d Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Sun, 5 Jan 2025 01:35:25 -0300 Subject: [PATCH 2/6] feat(tags): add tab to show archived tags --- app/apps/transactions/urls.py | 2 + app/apps/transactions/views/tags.py | 24 +++++++++++ app/templates/tags/fragments/list.html | 55 ++++++------------------- app/templates/tags/fragments/table.html | 55 +++++++++++++++++++++++++ app/templates/tags/pages/index.html | 2 +- 5 files changed, 94 insertions(+), 44 deletions(-) create mode 100644 app/templates/tags/fragments/table.html diff --git a/app/apps/transactions/urls.py b/app/apps/transactions/urls.py index 09ec2a5..6c1c4b8 100644 --- a/app/apps/transactions/urls.py +++ b/app/apps/transactions/urls.py @@ -53,6 +53,8 @@ urlpatterns = [ ), path("tags/", views.tags_index, name="tags_index"), path("tags/list/", views.tags_list, name="tags_list"), + path("tags/table/active/", views.tags_table_active, name="tags_table_active"), + path("tags/table/archived/", views.tags_table_archived, name="tags_table_archived"), path("tags/add/", views.tag_add, name="tag_add"), path( "tags//edit/", diff --git a/app/apps/transactions/views/tags.py b/app/apps/transactions/views/tags.py index 9ba06ba..354208b 100644 --- a/app/apps/transactions/views/tags.py +++ b/app/apps/transactions/views/tags.py @@ -32,6 +32,30 @@ def tags_list(request): ) +@only_htmx +@login_required +@require_http_methods(["GET"]) +def tags_table_active(request): + tags = TransactionTag.objects.filter(active=True).order_by("id") + return render( + request, + "tags/fragments/table.html", + {"tags": tags, "active": True}, + ) + + +@only_htmx +@login_required +@require_http_methods(["GET"]) +def tags_table_archived(request): + tags = TransactionTag.objects.filter(active=False).order_by("id") + return render( + request, + "tags/fragments/table.html", + {"tags": tags, "active": False}, + ) + + @only_htmx @login_required @require_http_methods(["GET", "POST"]) diff --git a/app/templates/tags/fragments/list.html b/app/templates/tags/fragments/list.html index 61355e9..82850ed 100644 --- a/app/templates/tags/fragments/list.html +++ b/app/templates/tags/fragments/list.html @@ -15,49 +15,18 @@
-
- {% if tags %} - - - - - - - - - - {% for tag in tags %} - - - - - {% endfor %} - -
{% translate 'Name' %}
-
- - - -
-
{{ tag.name }}
- {% else %} - - {% endif %} +
+ +
+
+
diff --git a/app/templates/tags/fragments/table.html b/app/templates/tags/fragments/table.html new file mode 100644 index 0000000..cc874ee --- /dev/null +++ b/app/templates/tags/fragments/table.html @@ -0,0 +1,55 @@ +{% load i18n %} +{% if active %} +
+{% else %} +
+{% endif %} +
+ {% if tags %} + + + + + + + + + + {% for tag in tags %} + + + + + {% endfor %} + +
{% translate 'Name' %}
+
+ + + +
+
{{ tag.name }}
+ {% else %} + + {% endif %} +
+
diff --git a/app/templates/tags/pages/index.html b/app/templates/tags/pages/index.html index a8fce6b..1729636 100644 --- a/app/templates/tags/pages/index.html +++ b/app/templates/tags/pages/index.html @@ -4,5 +4,5 @@ {% block title %}{% translate 'Tags' %}{% endblock %} {% block content %} -
+
{% endblock %} From 41303f39a03ff08ee075262bc4c01f4469e7c040 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Sun, 5 Jan 2025 01:35:34 -0300 Subject: [PATCH 3/6] fix: typo --- app/templates/categories/fragments/list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/categories/fragments/list.html b/app/templates/categories/fragments/list.html index fe950d3..0318259 100644 --- a/app/templates/categories/fragments/list.html +++ b/app/templates/categories/fragments/list.html @@ -21,7 +21,7 @@
From f5132e24bd110fedd6072f514dc04f70268baeb0 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Sun, 5 Jan 2025 01:36:30 -0300 Subject: [PATCH 4/6] feat(tags): add tab to show archived tags --- app/apps/transactions/views/tags.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/apps/transactions/views/tags.py b/app/apps/transactions/views/tags.py index 354208b..fdc66da 100644 --- a/app/apps/transactions/views/tags.py +++ b/app/apps/transactions/views/tags.py @@ -24,11 +24,9 @@ def tags_index(request): @login_required @require_http_methods(["GET"]) def tags_list(request): - tags = TransactionTag.objects.all().order_by("id") return render( request, "tags/fragments/list.html", - {"tags": tags}, ) From baae6bb96a32d2d39360d2043864767e4acfa2fa Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Sun, 5 Jan 2025 01:43:24 -0300 Subject: [PATCH 5/6] feat(entities): add tab to show archived entities --- app/apps/transactions/urls.py | 10 ++++ app/apps/transactions/views/entities.py | 26 +++++++++- app/templates/entities/fragments/list.html | 55 +++++---------------- app/templates/entities/fragments/table.html | 55 +++++++++++++++++++++ app/templates/entities/pages/index.html | 2 +- 5 files changed, 102 insertions(+), 46 deletions(-) create mode 100644 app/templates/entities/fragments/table.html diff --git a/app/apps/transactions/urls.py b/app/apps/transactions/urls.py index 6c1c4b8..844adad 100644 --- a/app/apps/transactions/urls.py +++ b/app/apps/transactions/urls.py @@ -68,6 +68,16 @@ urlpatterns = [ ), path("entities/", views.entities_index, name="entities_index"), path("entities/list/", views.entities_list, name="entities_list"), + path( + "entities/table/active/", + views.entities_table_active, + name="entities_table_active", + ), + path( + "entities/table/archived/", + views.entities_table_archived, + name="entities_table_archived", + ), path("entities/add/", views.entity_add, name="entity_add"), path( "entities//edit/", diff --git a/app/apps/transactions/views/entities.py b/app/apps/transactions/views/entities.py index 2faed7a..8252642 100644 --- a/app/apps/transactions/views/entities.py +++ b/app/apps/transactions/views/entities.py @@ -24,11 +24,33 @@ def entities_index(request): @login_required @require_http_methods(["GET"]) def entities_list(request): - entities = TransactionEntity.objects.all().order_by("id") return render( request, "entities/fragments/list.html", - {"entities": entities}, + ) + + +@only_htmx +@login_required +@require_http_methods(["GET"]) +def entities_table_active(request): + entities = TransactionEntity.objects.filter(active=True).order_by("id") + return render( + request, + "entities/fragments/table.html", + {"entities": entities, "active": True}, + ) + + +@only_htmx +@login_required +@require_http_methods(["GET"]) +def entities_table_archived(request): + entities = TransactionEntity.objects.filter(active=False).order_by("id") + return render( + request, + "entities/fragments/table.html", + {"entities": entities, "active": False}, ) diff --git a/app/templates/entities/fragments/list.html b/app/templates/entities/fragments/list.html index 0c0c5ca..6ad2c76 100644 --- a/app/templates/entities/fragments/list.html +++ b/app/templates/entities/fragments/list.html @@ -15,49 +15,18 @@
-
- {% if entities %} - - - - - - - - - - {% for entity in entities %} - - - - - {% endfor %} - -
{% translate 'Name' %}
-
- - - -
-
{{ entity.name }}
- {% else %} - - {% endif %} +
+ +
+
+
diff --git a/app/templates/entities/fragments/table.html b/app/templates/entities/fragments/table.html new file mode 100644 index 0000000..ea43d30 --- /dev/null +++ b/app/templates/entities/fragments/table.html @@ -0,0 +1,55 @@ +{% load i18n %} +{% if active %} +
+{% else %} +
+{% endif %} + {% if entities %} +
+ + + + + + + + + + {% for entity in entities %} + + + + + {% endfor %} + +
{% translate 'Name' %}
+
+ + + +
+
{{ entity.name }}
+
+ {% else %} + + {% endif %} +
diff --git a/app/templates/entities/pages/index.html b/app/templates/entities/pages/index.html index cff23d2..9db5088 100644 --- a/app/templates/entities/pages/index.html +++ b/app/templates/entities/pages/index.html @@ -4,5 +4,5 @@ {% block title %}{% translate 'Entities' %}{% endblock %} {% block content %} -
+
{% endblock %} From 905e80cffe8853bd12a13c969d79276b0f23420b Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Sun, 5 Jan 2025 01:45:11 -0300 Subject: [PATCH 6/6] fix: overflowing empty message --- app/templates/categories/fragments/table.html | 4 ++-- app/templates/tags/fragments/table.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/templates/categories/fragments/table.html b/app/templates/categories/fragments/table.html index b1bdcc4..675fabd 100644 --- a/app/templates/categories/fragments/table.html +++ b/app/templates/categories/fragments/table.html @@ -6,8 +6,8 @@
{% endif %} -
{% if categories %} +
@@ -52,8 +52,8 @@ {% endfor %}
+
{% else %} {% endif %}
-
diff --git a/app/templates/tags/fragments/table.html b/app/templates/tags/fragments/table.html index cc874ee..9a104c1 100644 --- a/app/templates/tags/fragments/table.html +++ b/app/templates/tags/fragments/table.html @@ -6,8 +6,8 @@
{% endif %} -
{% if tags %} +
@@ -48,8 +48,8 @@ {% endfor %}
+
{% else %} {% endif %} -