mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
apps: Only show app tags all the tags in apps page search box
- Earlier tags of all the apps from help, system, and apps pages were shown. Now, only show tags from apps in the apps page. - There is no need to override language since menu.tags which is sames as info.tags is already a list of untranslated strings. Tests: - List of tags is shown in the dropdown when tag search bar is clicked. This list contains translated tags when language is set to Spanish. The sort order is per the translated locale. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
parent
7cad8e47be
commit
ffc95019f0
@ -543,17 +543,6 @@ class Info(FollowerComponent):
|
||||
for tag in self._tags
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def list_tags(self) -> list[str]:
|
||||
"""Return a list of untranslated tags."""
|
||||
tags: set[str] = set()
|
||||
from django.utils.translation import override
|
||||
with override(language=None):
|
||||
for app in App.list():
|
||||
tags.update((str(tag) for tag in app.info.tags))
|
||||
|
||||
return list(tags)
|
||||
|
||||
|
||||
class EnableState(LeaderComponent):
|
||||
"""A component to hold the enable state of an app using a simple flag.
|
||||
|
||||
@ -226,8 +226,11 @@ class AppsIndexView(TemplateView):
|
||||
|
||||
context['tags'] = tags
|
||||
# Sorted tags by localized string
|
||||
context['all_tags'] = sorted(app_module.Info.list_tags(),
|
||||
key=lambda tag: _(tag))
|
||||
all_tags = set()
|
||||
for menu_item in menu_items:
|
||||
all_tags.update(menu_item.tags or [])
|
||||
|
||||
context['all_tags'] = sorted(all_tags, key=lambda tag: _(tag))
|
||||
context['menu_items'] = self._pick_menu_items(menu_items, tags)
|
||||
|
||||
return context
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user