You've already forked hotpocket
BTHLABS-60: Appearance settings
Co-authored-by: Tomek Wójcik <labs@tomekwojcik.pl> Co-committed-by: Tomek Wójcik <labs@tomekwojcik.pl>
This commit is contained in:
@@ -46,3 +46,33 @@ def version(request: HttpRequest) -> dict:
|
||||
return {
|
||||
'VERSION': backend_version,
|
||||
}
|
||||
|
||||
|
||||
def appearance_settings(request: HttpRequest) -> dict:
|
||||
theme = 'hotpocket'
|
||||
result = {
|
||||
'theme': theme,
|
||||
'light_mode': False,
|
||||
'theme_css': 'ui/css/bootstrap-hotpocket.min.css',
|
||||
}
|
||||
|
||||
if request.user.is_anonymous is False:
|
||||
theme = request.user.settings.get('theme', 'hotpocket')
|
||||
result.update({
|
||||
'theme': theme,
|
||||
'light_mode': request.user.settings['light_mode'],
|
||||
})
|
||||
|
||||
match theme:
|
||||
case 'bootstrap':
|
||||
result['theme_css'] = 'ui/css/bootstrap.min.css'
|
||||
|
||||
case 'cosmo':
|
||||
result['theme_css'] = 'ui/css/cosmo.min.css'
|
||||
|
||||
case 'solar':
|
||||
result['theme_css'] = 'ui/css/solar.min.css'
|
||||
|
||||
return {
|
||||
'APPEARANCE_SETTINGS': result,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user