103 lines
3.4 KiB
Python
103 lines
3.4 KiB
Python
from flask import Blueprint, render_template, redirect, url_for, request
|
|
from models import SiteSettings, HelpArticle, PricingPlan
|
|
import os
|
|
|
|
def init_public_routes(public_bp):
|
|
@public_bp.context_processor
|
|
def inject_site_settings():
|
|
site_settings = SiteSettings.query.first()
|
|
return dict(site_settings=site_settings)
|
|
|
|
@public_bp.context_processor
|
|
def inject_pricing_plans():
|
|
"""Make PricingPlan model available in templates"""
|
|
return dict(PricingPlan=PricingPlan)
|
|
|
|
@public_bp.route('/features')
|
|
def features():
|
|
"""Features page"""
|
|
return render_template('public/features.html')
|
|
|
|
@public_bp.route('/pricing')
|
|
def pricing():
|
|
"""Pricing page"""
|
|
return render_template('public/pricing.html')
|
|
|
|
@public_bp.route('/about')
|
|
def about():
|
|
"""About page"""
|
|
return render_template('public/about.html')
|
|
|
|
@public_bp.route('/careers')
|
|
def careers():
|
|
"""Careers page"""
|
|
return render_template('public/careers.html')
|
|
|
|
@public_bp.route('/press')
|
|
def press():
|
|
"""Press page"""
|
|
return render_template('public/press.html')
|
|
|
|
@public_bp.route('/help')
|
|
def help_center():
|
|
"""Help Center page"""
|
|
return render_template('public/help.html')
|
|
|
|
@public_bp.route('/help/articles')
|
|
def help_articles():
|
|
"""Display help articles by category"""
|
|
category = request.args.get('category', '')
|
|
|
|
# Get all published articles grouped by category
|
|
all_articles = HelpArticle.get_all_published()
|
|
categories = HelpArticle.get_categories()
|
|
|
|
# If a specific category is requested, filter to that category
|
|
if category and category in categories:
|
|
articles = HelpArticle.get_articles_by_category(category)
|
|
category_name = categories[category]
|
|
else:
|
|
# Show all articles when no specific category is requested
|
|
articles = []
|
|
for category_articles in all_articles.values():
|
|
articles.extend(category_articles)
|
|
# Sort by order_index and then by created_at
|
|
articles.sort(key=lambda x: (x.order_index, x.created_at))
|
|
category_name = None
|
|
|
|
return render_template('public/help_articles.html',
|
|
articles=articles,
|
|
all_articles=all_articles,
|
|
categories=categories,
|
|
current_category=category,
|
|
category_name=category_name)
|
|
|
|
@public_bp.route('/contact')
|
|
def contact():
|
|
"""Contact page"""
|
|
return render_template('public/contact.html')
|
|
|
|
@public_bp.route('/status')
|
|
def status():
|
|
"""Status page"""
|
|
return render_template('public/status.html')
|
|
|
|
@public_bp.route('/security')
|
|
def security():
|
|
"""Security page"""
|
|
return render_template('public/security.html')
|
|
|
|
@public_bp.route('/privacy')
|
|
def privacy():
|
|
"""Privacy Policy page"""
|
|
return render_template('public/privacy.html')
|
|
|
|
@public_bp.route('/terms')
|
|
def terms():
|
|
"""Terms of Service page"""
|
|
return render_template('public/terms.html')
|
|
|
|
@public_bp.route('/cookies')
|
|
def cookies():
|
|
"""Cookie Policy page"""
|
|
return render_template('public/cookies.html') |