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:
62
run.py
62
run.py
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
from app import create_app, db
|
||||
from app.models import User, Post, PostImage, GPXFile, Comment, Like
|
||||
from app.models import User, Post, PostImage, GPXFile, Comment, Like, PageView
|
||||
|
||||
app = create_app()
|
||||
|
||||
@@ -13,7 +13,8 @@ def make_shell_context():
|
||||
'PostImage': PostImage,
|
||||
'GPXFile': GPXFile,
|
||||
'Comment': Comment,
|
||||
'Like': Like
|
||||
'Like': Like,
|
||||
'PageView': PageView
|
||||
}
|
||||
|
||||
@app.cli.command()
|
||||
@@ -22,6 +23,63 @@ def init_db():
|
||||
db.create_all()
|
||||
print('Database initialized.')
|
||||
|
||||
@app.cli.command()
|
||||
def migrate_db():
|
||||
"""Apply database migrations."""
|
||||
from sqlalchemy import text
|
||||
try:
|
||||
# Check if the media_folder column exists
|
||||
result = db.session.execute(text('PRAGMA table_info(posts)'))
|
||||
columns = [row[1] for row in result.fetchall()]
|
||||
|
||||
if 'media_folder' not in columns:
|
||||
# Add the media_folder column
|
||||
db.session.execute(text('ALTER TABLE posts ADD COLUMN media_folder VARCHAR(100)'))
|
||||
db.session.commit()
|
||||
print('Successfully added media_folder column to posts table')
|
||||
else:
|
||||
print('media_folder column already exists')
|
||||
|
||||
# Check if is_cover column exists in post_images table
|
||||
result = db.session.execute(text('PRAGMA table_info(post_images)'))
|
||||
columns = [row[1] for row in result.fetchall()]
|
||||
|
||||
if 'is_cover' not in columns:
|
||||
# Add the is_cover column
|
||||
db.session.execute(text('ALTER TABLE post_images ADD COLUMN is_cover BOOLEAN DEFAULT 0'))
|
||||
db.session.commit()
|
||||
print('Successfully added is_cover column to post_images table')
|
||||
else:
|
||||
print('is_cover column already exists')
|
||||
|
||||
# Check if page_views table exists
|
||||
result = db.session.execute(text("SELECT name FROM sqlite_master WHERE type='table' AND name='page_views'"))
|
||||
if not result.fetchone():
|
||||
# Create page_views table
|
||||
db.session.execute(text('''
|
||||
CREATE TABLE page_views (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
path VARCHAR(255) NOT NULL,
|
||||
user_agent VARCHAR(500),
|
||||
ip_address VARCHAR(45),
|
||||
referer VARCHAR(500),
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
user_id INTEGER,
|
||||
post_id INTEGER,
|
||||
FOREIGN KEY (user_id) REFERENCES users(id),
|
||||
FOREIGN KEY (post_id) REFERENCES posts(id)
|
||||
)
|
||||
'''))
|
||||
db.session.commit()
|
||||
print('Successfully created page_views table')
|
||||
else:
|
||||
print('page_views table already exists')
|
||||
|
||||
print('Database schema is up to date')
|
||||
except Exception as e:
|
||||
print(f'Migration error: {e}')
|
||||
db.session.rollback()
|
||||
|
||||
@app.cli.command()
|
||||
def create_admin():
|
||||
"""Create an admin user."""
|
||||
|
||||
Reference in New Issue
Block a user