Aug 7 - Update new design as default
This commit is contained in:
+11
-5
@@ -167,22 +167,28 @@ def create_app(config_name='default'):
|
||||
# The mobile API renders no templates and authenticates by JWT — skip it
|
||||
# so this never touches the Flask-Login session loader on API traffic.
|
||||
if request.path.startswith('/api/'):
|
||||
# The API renders no templates; 'classic' here only means "never
|
||||
# rewrite a template name" (see ThemedEnvironment.get_template).
|
||||
g.jqc_theme = 'classic'
|
||||
return
|
||||
from flask_login import current_user as _cu
|
||||
theme = 'classic'
|
||||
# phase50 — the fallback is configurable and now defaults to 'modern'.
|
||||
# A stored users.ui_theme still wins, so an explicit choice is kept.
|
||||
default = app.config.get('DEFAULT_UI_THEME', 'modern')
|
||||
theme = default
|
||||
try:
|
||||
if _cu.is_authenticated:
|
||||
theme = _cu.ui_theme or 'classic'
|
||||
theme = _cu.ui_theme or default
|
||||
except Exception: # DB column missing (migration not yet run)
|
||||
theme = 'classic'
|
||||
g.jqc_theme = theme if theme in ('classic', 'modern') else 'classic'
|
||||
theme = default
|
||||
g.jqc_theme = theme if theme in ('classic', 'modern') else default
|
||||
|
||||
@app.context_processor
|
||||
def inject_ui_theme():
|
||||
"""Give base.html the shell to extend."""
|
||||
from app.utils.time_utils import now_eastern
|
||||
theme = getattr(g, 'jqc_theme', 'classic')
|
||||
theme = getattr(g, 'jqc_theme',
|
||||
app.config.get('DEFAULT_UI_THEME', 'modern'))
|
||||
_now = now_eastern()
|
||||
return {
|
||||
'jqc_theme': theme,
|
||||
|
||||
Reference in New Issue
Block a user