From 42d1225f5b7a9f4b3bdd1d85e3b8d51fbc9f6230 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 30 Dec 2024 22:12:37 -0800 Subject: [PATCH] views: Use tags from menu or shortcut instead of the app - Also remove the extra unwanted space between the tags. - This allows different shortcuts of the same app to have different tags on the home page. Example: email shortcuts on the home page. - This also allows custom shortcuts to have their own tags without being attached to any app provided by FreedomBox. - Filter shown menu items by tags on the menu item rather than tags on the app. They could be different. Tests: - Home page shows shortcuts with tags. - Apps and system pages show shortcuts with apps. - Apps are properly filtered when tags are clicked on in the app page. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- plinth/templates/card.html | 2 +- plinth/templates/index.html | 4 +--- plinth/views.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plinth/templates/card.html b/plinth/templates/card.html index 6c810cd69..cbc30c8cb 100644 --- a/plinth/templates/card.html +++ b/plinth/templates/card.html @@ -20,7 +20,7 @@
{{ item.name }}
- {% for tag in item.app.info.tags|slice:":3" %}{% trans tag %}{% if not forloop.last %}・{% endif %}{% endfor %} + {% for tag in item.tags|slice:":3" %}{% trans tag %}{% if not forloop.last %}・{% endif %}{% endfor %}
diff --git a/plinth/templates/index.html b/plinth/templates/index.html index 7e79bd47c..67b0c76aa 100644 --- a/plinth/templates/index.html +++ b/plinth/templates/index.html @@ -76,9 +76,7 @@ {{ shortcut.name }}
- {% for tag in shortcut.app.info.tags|slice:":3" %} - {% trans tag %}{% if not forloop.last %}・{% endif %} - {% endfor %} + {% for tag in shortcut.tags|slice:":3" %}{% trans tag %}{% if not forloop.last %}・{% endif %}{% endfor %}
diff --git a/plinth/views.py b/plinth/views.py index 803262126..46abdefca 100644 --- a/plinth/views.py +++ b/plinth/views.py @@ -191,7 +191,7 @@ class AppsIndexView(TemplateView): A mismatch is when a selected tag is *not* present in the list of tags for menu item. """ - menu_tags = set(menu_item.app.info.tags) + menu_tags = set(menu_item.tags) return [tag not in menu_tags for tag in selected_tags] def _sort_key(menu_item):