mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
theme: Move icons to app folders
- This improves modularity. Each app brings its own icons in its directory instead of a centralized directory. Tests: - Install an app and notice that the installation notification has the icon. - Visit an app's page in Apps and System (cockpit) section and ensure that the app's icon is being shown. - Visit the Apps and System section and notice that apps' icons are being shown. - Visit the home page and notice that shortcuts' icons are being shown. - Visit the URL /plinth/api/0/shortcuts and notice that the URLs for icons are accessible and lead to proper icon files. - Build developer documentation and notice that Tutorial -> View and Reference > Menu pages show the expected updates. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
f30c028289
commit
ac3754fa2f
79 files changed
+103
-81
No files matched your search
@@ -50,7 +50,7 @@ def _get_shortcut_data(shortcut):
|
||||
'name': shortcut.name,
|
||||
'short_description': shortcut.short_description,
|
||||
'description': shortcut.description,
|
||||
'icon_url': _get_icon_url(shortcut.icon),
|
||||
'icon_url': _get_icon_url(shortcut.app_id, shortcut.icon),
|
||||
'clients': copy.deepcopy(shortcut.clients),
|
||||
}
|
||||
# XXX: Fix the hardcoding
|
||||
@@ -60,9 +60,12 @@ def _get_shortcut_data(shortcut):
|
||||
return shortcut_data
|
||||
|
||||
|
||||
def _get_icon_url(icon_name):
|
||||
"""Return icon path given icon name."""
|
||||
def _get_icon_url(app_id, icon_name):
|
||||
"""Return icon path given app's ID and icon name."""
|
||||
if not icon_name:
|
||||
return None
|
||||
|
||||
return static('theme/icons/{}.png'.format(icon_name))
|
||||
if app_id:
|
||||
return static(f'{app_id}') + f'/icons/{icon_name}.png'
|
||||
|
||||
return static(f'theme/icons/{icon_name}.png')
|
||||
Reference in new issue
Block a user