Major UI/UX redesign and feature enhancements
🎨 Complete Tailwind CSS conversion - Redesigned post detail page with modern gradient backgrounds - Updated profile page with consistent design language - Converted from Bootstrap to Tailwind CSS throughout ✨ New Features & Improvements - Enhanced community post management system - Added admin panel with analytics dashboard - Improved post creation and editing workflows - Interactive GPS map integration with Leaflet.js - Photo gallery with modal view and hover effects - Adventure statistics and metadata display - Like system and community engagement features 🔧 Technical Improvements - Fixed template syntax errors and CSRF token issues - Updated database models and relationships - Enhanced media file management - Improved responsive design patterns - Added proper error handling and validation 📱 Mobile-First Design - Responsive grid layouts - Touch-friendly interactions - Optimized for all screen sizes - Modern card-based UI components 🏍️ Adventure Platform Features - GPS track visualization and statistics - Photo uploads with thumbnail generation - GPX file downloads for registered users - Community comments and discussions - Post approval workflow for admins - Difficulty rating system with star indicators
This commit is contained in:
@@ -25,8 +25,54 @@ def create_app(config_name=None):
|
||||
from app.models import User
|
||||
return User.query.get(int(user_id))
|
||||
|
||||
# Page view tracking
|
||||
@app.before_request
|
||||
def track_page_views():
|
||||
from app.models import PageView
|
||||
from flask import request
|
||||
from flask_login import current_user
|
||||
import re
|
||||
|
||||
# Skip tracking for static files, admin API calls, and certain paths
|
||||
if (request.endpoint and
|
||||
(request.endpoint.startswith('static') or
|
||||
request.endpoint.startswith('admin.api') or
|
||||
request.path.startswith('/favicon') or
|
||||
request.path.startswith('/_'))) :
|
||||
return
|
||||
|
||||
# Extract post_id from community post URLs
|
||||
post_id = None
|
||||
if request.endpoint == 'community.post_detail':
|
||||
post_id = request.view_args.get('post_id')
|
||||
|
||||
# Create page view record
|
||||
page_view = PageView(
|
||||
path=request.path,
|
||||
user_agent=request.headers.get('User-Agent', ''),
|
||||
ip_address=request.remote_addr,
|
||||
referer=request.headers.get('Referer'),
|
||||
user_id=current_user.id if current_user.is_authenticated else None,
|
||||
post_id=post_id
|
||||
)
|
||||
|
||||
try:
|
||||
db.session.add(page_view)
|
||||
db.session.commit()
|
||||
except Exception:
|
||||
# Don't let page view tracking break the app
|
||||
db.session.rollback()
|
||||
|
||||
# Import models
|
||||
from app.models import User, Post, PostImage, GPXFile, Comment, Like
|
||||
from app.models import User, Post, PostImage, GPXFile, Comment, Like, PageView
|
||||
|
||||
# Add custom template filters
|
||||
@app.template_filter('nl2br')
|
||||
def nl2br_filter(text):
|
||||
"""Convert newlines to <br> tags"""
|
||||
if text is None:
|
||||
return ''
|
||||
return text.replace('\n', '<br>')
|
||||
|
||||
# Register blueprints
|
||||
from app.routes.main import main
|
||||
@@ -38,6 +84,9 @@ def create_app(config_name=None):
|
||||
from app.routes.community import community
|
||||
app.register_blueprint(community, url_prefix='/community')
|
||||
|
||||
from app.routes.admin import admin
|
||||
app.register_blueprint(admin, url_prefix='/admin')
|
||||
|
||||
# Create upload directories
|
||||
upload_dir = os.path.join(app.instance_path, 'uploads')
|
||||
os.makedirs(upload_dir, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user