|
|
@ -9,19 +9,27 @@ from webargs.pyramidparser import use_kwargs |
|
|
from tildes.schemas.user import EMAIL_ADDRESS_NOTE_MAX_LENGTH, UserSchema |
|
|
from tildes.schemas.user import EMAIL_ADDRESS_NOTE_MAX_LENGTH, UserSchema |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEFAULT_THEME_NAME = 'white' |
|
|
PASSWORD_FIELD = UserSchema(only=('password',)).fields['password'] |
|
|
PASSWORD_FIELD = UserSchema(only=('password',)).fields['password'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@view_config(route_name='settings', renderer='settings.jinja2') |
|
|
@view_config(route_name='settings', renderer='settings.jinja2') |
|
|
def get_settings(request: Request) -> dict: |
|
|
def get_settings(request: Request) -> dict: |
|
|
"""Generate the user settings page.""" |
|
|
"""Generate the user settings page.""" |
|
|
current_theme = request.cookies.get('theme', '') |
|
|
|
|
|
|
|
|
current_theme = (request.cookies.get('theme', '') |
|
|
|
|
|
or request.user.theme_account_default) |
|
|
theme_options = { |
|
|
theme_options = { |
|
|
'': 'White (default)', |
|
|
|
|
|
|
|
|
'white': 'White', |
|
|
'light': 'Solarized Light', |
|
|
'light': 'Solarized Light', |
|
|
'dark': 'Solarized Dark', |
|
|
'dark': 'Solarized Dark', |
|
|
'black': 'Black', |
|
|
'black': 'Black', |
|
|
} |
|
|
} |
|
|
|
|
|
if DEFAULT_THEME_NAME == request.user.theme_account_default: |
|
|
|
|
|
theme_options[DEFAULT_THEME_NAME] += ' (site and account default)' |
|
|
|
|
|
else: |
|
|
|
|
|
theme_options[request.user.theme_account_default] += ( |
|
|
|
|
|
' (account default)') |
|
|
|
|
|
theme_options[DEFAULT_THEME_NAME] += ' (site default)' |
|
|
|
|
|
|
|
|
return {'current_theme': current_theme, 'theme_options': theme_options} |
|
|
return {'current_theme': current_theme, 'theme_options': theme_options} |
|
|
|
|
|
|
|
|
|