Branding customization
This commit is contained in:
+17
-2
@@ -121,13 +121,22 @@ def create_app(config_name=None):
|
||||
@app.context_processor
|
||||
def inject_globals():
|
||||
from flask_login import current_user
|
||||
from app.models import SystemSetting
|
||||
unread = 0
|
||||
if current_user.is_authenticated:
|
||||
from app.models import Notification
|
||||
unread = Notification.query.filter_by(
|
||||
user_id=current_user.id, is_read=False
|
||||
).count()
|
||||
return dict(unread_notifications=unread)
|
||||
branding = {
|
||||
'app_name' : SystemSetting.get('app_name', 'TechDesk'),
|
||||
'app_subtitle' : SystemSetting.get('app_subtitle', 'IT Helpdesk System'),
|
||||
'company_name' : SystemSetting.get('company_name', ''),
|
||||
'logo_stored_name' : SystemSetting.get('logo_stored_name', ''),
|
||||
'logo_initials' : SystemSetting.get('logo_initials', 'TD'),
|
||||
'primary_color' : SystemSetting.get('primary_color', '#2563eb'),
|
||||
}
|
||||
return dict(unread_notifications=unread, branding=branding)
|
||||
|
||||
# ── DB initialisation (first run) ─────────────────────────────────────────
|
||||
with app.app_context():
|
||||
@@ -142,7 +151,13 @@ def _seed_settings():
|
||||
"""Ensure all required system settings exist with safe defaults."""
|
||||
from app.models import SystemSetting
|
||||
defaults = [
|
||||
('registration_enabled', 'true', 'Allow new users to self-register via /auth/register'),
|
||||
('registration_enabled', 'true', 'Allow new users to self-register via /auth/register'),
|
||||
('app_name', 'TechDesk', 'Application name shown in the sidebar and page titles'),
|
||||
('app_subtitle', 'IT Helpdesk System', 'Subtitle shown below the app name in the sidebar'),
|
||||
('company_name', '', 'Company name shown on the login and register pages'),
|
||||
('logo_stored_name', '', 'Stored filename of the uploaded company logo image'),
|
||||
('logo_initials', 'TD', 'Two-letter initials shown when no logo is uploaded'),
|
||||
('primary_color', '#2563eb', 'Primary accent colour (hex) used across the interface'),
|
||||
]
|
||||
for key, value, description in defaults:
|
||||
if SystemSetting.get(key) is None:
|
||||
|
||||
Reference in New Issue
Block a user