Development
This commit is contained in:
parent
c561f2f548
commit
1beb660be1
8 changed files with 280 additions and 48 deletions
|
|
@ -2,12 +2,25 @@ import json
|
|||
from flask import session
|
||||
import sanitize
|
||||
import config_utils
|
||||
import factory
|
||||
|
||||
|
||||
def collect_tokens(cfg):
|
||||
tokens = config_utils.collect_layout_tokens(cfg)
|
||||
blank = [{'value': '', 'label': '-- Select Timezone --'}]
|
||||
tokens['PREF_EMAIL'] = session.get('email_address', '')
|
||||
tokens['PREF_TIMEZONE'] = session.get('timezone', '')
|
||||
tokens['TIMEZONE_OPTIONS'] = json.dumps(blank + [{'value': tz, 'label': tz} for tz in sanitize.VALID_TIMEZONES])
|
||||
tokens['PREF_EMAIL'] = session.get('email_address', '')
|
||||
tokens['PREF_TIMEZONE'] = session.get('timezone', '')
|
||||
tokens['TIMEZONE_OPTIONS'] = json.dumps(blank + [{'value': tz, 'label': tz} for tz in sanitize.VALID_TIMEZONES])
|
||||
|
||||
account = config_utils.get_account_by_id(session.get('account_id', ''))
|
||||
requested = (account or {}).get('requested_email', '')
|
||||
if requested:
|
||||
tokens['PENDING_EMAIL_BAR'] = (
|
||||
f'<div class="info-bar info-bar-inline info-bar-warning">'
|
||||
f'A request to change email to {factory.e(requested)} is pending approval.'
|
||||
f'</div>'
|
||||
)
|
||||
else:
|
||||
tokens['PENDING_EMAIL_BAR'] = ''
|
||||
|
||||
return tokens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue