Enhance moderation dashboard UI and UX:

- Add HTMX-powered filtering with instant updates
- Add smooth transitions and loading states
- Improve visual hierarchy and styling
- Add review notes functionality
- Add confirmation dialogs for actions
- Make navigation sticky
- Add hover effects and visual feedback
- Improve dark mode support
This commit is contained in:
pacnpal
2024-11-13 14:38:38 +00:00
parent d2c9d02523
commit 9ee380c3ea
98 changed files with 5073 additions and 3040 deletions

View File

@@ -1,5 +1,6 @@
# Generated by Django 5.1.2 on 2024-11-02 23:28
# Generated by Django 5.1.3 on 2024-11-12 18:07
import django.contrib.gis.db.models.fields
import django.core.validators
import django.db.models.deletion
import simple_history.models
@@ -44,9 +45,11 @@ class Migration(migrations.Migration):
(
"latitude",
models.DecimalField(
blank=True,
decimal_places=6,
help_text="Latitude coordinate",
help_text="Latitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-90),
django.core.validators.MaxValueValidator(90),
@@ -56,25 +59,42 @@ class Migration(migrations.Migration):
(
"longitude",
models.DecimalField(
blank=True,
decimal_places=6,
help_text="Longitude coordinate",
help_text="Longitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-180),
django.core.validators.MaxValueValidator(180),
],
),
),
("street_address", models.CharField(blank=True, max_length=255)),
("city", models.CharField(max_length=100)),
(
"point",
django.contrib.gis.db.models.fields.PointField(
blank=True,
help_text="Geographic coordinates as a Point",
null=True,
srid=4326,
),
),
(
"street_address",
models.CharField(blank=True, max_length=255, null=True),
),
("city", models.CharField(blank=True, max_length=100, null=True)),
(
"state",
models.CharField(
blank=True, help_text="State/Region/Province", max_length=100
blank=True,
help_text="State/Region/Province",
max_length=100,
null=True,
),
),
("country", models.CharField(max_length=100)),
("postal_code", models.CharField(blank=True, max_length=20)),
("country", models.CharField(blank=True, max_length=100, null=True)),
("postal_code", models.CharField(blank=True, max_length=20, null=True)),
("created_at", models.DateTimeField(blank=True, editable=False)),
("updated_at", models.DateTimeField(blank=True, editable=False)),
("history_id", models.AutoField(primary_key=True, serialize=False)),
@@ -146,9 +166,11 @@ class Migration(migrations.Migration):
(
"latitude",
models.DecimalField(
blank=True,
decimal_places=6,
help_text="Latitude coordinate",
help_text="Latitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-90),
django.core.validators.MaxValueValidator(90),
@@ -158,25 +180,42 @@ class Migration(migrations.Migration):
(
"longitude",
models.DecimalField(
blank=True,
decimal_places=6,
help_text="Longitude coordinate",
help_text="Longitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-180),
django.core.validators.MaxValueValidator(180),
],
),
),
("street_address", models.CharField(blank=True, max_length=255)),
("city", models.CharField(max_length=100)),
(
"point",
django.contrib.gis.db.models.fields.PointField(
blank=True,
help_text="Geographic coordinates as a Point",
null=True,
srid=4326,
),
),
(
"street_address",
models.CharField(blank=True, max_length=255, null=True),
),
("city", models.CharField(blank=True, max_length=100, null=True)),
(
"state",
models.CharField(
blank=True, help_text="State/Region/Province", max_length=100
blank=True,
help_text="State/Region/Province",
max_length=100,
null=True,
),
),
("country", models.CharField(max_length=100)),
("postal_code", models.CharField(blank=True, max_length=20)),
("country", models.CharField(blank=True, max_length=100, null=True)),
("postal_code", models.CharField(blank=True, max_length=20, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
@@ -194,10 +233,6 @@ class Migration(migrations.Migration):
fields=["content_type", "object_id"],
name="location_lo_content_9ee1bd_idx",
),
models.Index(
fields=["latitude", "longitude"],
name="location_lo_latitud_7045c4_idx",
),
models.Index(fields=["city"], name="location_lo_city_99f908_idx"),
models.Index(
fields=["country"], name="location_lo_country_b75eba_idx"

View File

@@ -1,84 +0,0 @@
# Generated by Django 5.1.2 on 2024-11-02 23:34
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("location", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="historicallocation",
name="city",
field=models.CharField(blank=True, max_length=100),
),
migrations.AlterField(
model_name="historicallocation",
name="latitude",
field=models.DecimalField(
blank=True,
decimal_places=6,
help_text="Latitude coordinate",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-90),
django.core.validators.MaxValueValidator(90),
],
),
),
migrations.AlterField(
model_name="historicallocation",
name="longitude",
field=models.DecimalField(
blank=True,
decimal_places=6,
help_text="Longitude coordinate",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-180),
django.core.validators.MaxValueValidator(180),
],
),
),
migrations.AlterField(
model_name="location",
name="city",
field=models.CharField(blank=True, max_length=100),
),
migrations.AlterField(
model_name="location",
name="latitude",
field=models.DecimalField(
blank=True,
decimal_places=6,
help_text="Latitude coordinate",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-90),
django.core.validators.MaxValueValidator(90),
],
),
),
migrations.AlterField(
model_name="location",
name="longitude",
field=models.DecimalField(
blank=True,
decimal_places=6,
help_text="Longitude coordinate",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-180),
django.core.validators.MaxValueValidator(180),
],
),
),
]

View File

@@ -1,67 +0,0 @@
# Generated by Django 5.1.2 on 2024-11-02 23:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("location", "0002_alter_historicallocation_city_and_more"),
]
operations = [
migrations.AlterField(
model_name="historicallocation",
name="city",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="historicallocation",
name="country",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="historicallocation",
name="postal_code",
field=models.CharField(blank=True, max_length=20, null=True),
),
migrations.AlterField(
model_name="historicallocation",
name="state",
field=models.CharField(
blank=True, help_text="State/Region/Province", max_length=100, null=True
),
),
migrations.AlterField(
model_name="historicallocation",
name="street_address",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name="location",
name="city",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="location",
name="country",
field=models.CharField(blank=True, max_length=100, null=True),
),
migrations.AlterField(
model_name="location",
name="postal_code",
field=models.CharField(blank=True, max_length=20, null=True),
),
migrations.AlterField(
model_name="location",
name="state",
field=models.CharField(
blank=True, help_text="State/Region/Province", max_length=100, null=True
),
),
migrations.AlterField(
model_name="location",
name="street_address",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

View File

@@ -1,27 +0,0 @@
# Generated by Django 5.1.2 on 2024-11-04 22:30
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("location", "0003_alter_historicallocation_city_and_more"),
]
operations = [
migrations.AddField(
model_name="location",
name="point",
field=django.contrib.gis.db.models.fields.PointField(
blank=True,
help_text="Geographic coordinates as a Point",
null=True,
srid=4326,
),
),
migrations.DeleteModel(
name="HistoricalLocation",
),
]

View File

@@ -1,52 +0,0 @@
# Generated by Django 5.1.2 on 2024-11-04 22:21
from django.db import migrations, transaction
from django.contrib.gis.geos import Point
def forwards_func(apps, schema_editor):
"""Convert existing lat/lon coordinates to points"""
Location = apps.get_model("location", "Location")
db_alias = schema_editor.connection.alias
# Update all locations with points based on existing lat/lon
with transaction.atomic():
for location in Location.objects.using(db_alias).all():
if location.latitude is not None and location.longitude is not None:
try:
location.point = Point(
float(location.longitude), # x coordinate (longitude)
float(location.latitude), # y coordinate (latitude)
srid=4326 # WGS84 coordinate system
)
location.save(update_fields=['point'])
except (ValueError, TypeError):
print(f"Warning: Could not convert coordinates for location {location.id}")
continue
def reverse_func(apps, schema_editor):
"""Convert points back to lat/lon coordinates"""
Location = apps.get_model("location", "Location")
db_alias = schema_editor.connection.alias
# Update all locations with lat/lon based on points
with transaction.atomic():
for location in Location.objects.using(db_alias).all():
if location.point:
try:
location.latitude = location.point.y
location.longitude = location.point.x
location.point = None
location.save(update_fields=['latitude', 'longitude', 'point'])
except (ValueError, TypeError, AttributeError):
print(f"Warning: Could not convert point back to coordinates for location {location.id}")
continue
class Migration(migrations.Migration):
dependencies = [
('location', '0004_add_point_field'),
]
operations = [
migrations.RunPython(forwards_func, reverse_func, atomic=True),
]

View File

@@ -1,174 +0,0 @@
# Generated by Django 5.1.2 on 2024-11-04 22:32
import django.contrib.gis.db.models.fields
import django.core.validators
import django.db.models.deletion
import simple_history.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("location", "0005_convert_coordinates_to_points"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="HistoricalLocation",
fields=[
(
"id",
models.BigIntegerField(
auto_created=True, blank=True, db_index=True, verbose_name="ID"
),
),
("object_id", models.PositiveIntegerField()),
(
"name",
models.CharField(
help_text="Name of the location (e.g. business name, landmark)",
max_length=255,
),
),
(
"location_type",
models.CharField(
help_text="Type of location (e.g. business, landmark, address)",
max_length=50,
),
),
(
"latitude",
models.DecimalField(
blank=True,
decimal_places=6,
help_text="Latitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-90),
django.core.validators.MaxValueValidator(90),
],
),
),
(
"longitude",
models.DecimalField(
blank=True,
decimal_places=6,
help_text="Longitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-180),
django.core.validators.MaxValueValidator(180),
],
),
),
(
"point",
django.contrib.gis.db.models.fields.PointField(
blank=True,
help_text="Geographic coordinates as a Point",
null=True,
srid=4326,
),
),
(
"street_address",
models.CharField(blank=True, max_length=255, null=True),
),
("city", models.CharField(blank=True, max_length=100, null=True)),
(
"state",
models.CharField(
blank=True,
help_text="State/Region/Province",
max_length=100,
null=True,
),
),
("country", models.CharField(blank=True, max_length=100, null=True)),
("postal_code", models.CharField(blank=True, max_length=20, null=True)),
("created_at", models.DateTimeField(blank=True, editable=False)),
("updated_at", models.DateTimeField(blank=True, editable=False)),
("history_id", models.AutoField(primary_key=True, serialize=False)),
("history_date", models.DateTimeField(db_index=True)),
("history_change_reason", models.CharField(max_length=100, null=True)),
(
"history_type",
models.CharField(
choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
max_length=1,
),
),
],
options={
"verbose_name": "historical location",
"verbose_name_plural": "historical locations",
"ordering": ("-history_date", "-history_id"),
"get_latest_by": ("history_date", "history_id"),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.RemoveIndex(
model_name="location",
name="location_lo_latitud_7045c4_idx",
),
migrations.AlterField(
model_name="location",
name="latitude",
field=models.DecimalField(
blank=True,
decimal_places=6,
help_text="Latitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-90),
django.core.validators.MaxValueValidator(90),
],
),
),
migrations.AlterField(
model_name="location",
name="longitude",
field=models.DecimalField(
blank=True,
decimal_places=6,
help_text="Longitude coordinate (legacy field)",
max_digits=9,
null=True,
validators=[
django.core.validators.MinValueValidator(-180),
django.core.validators.MaxValueValidator(180),
],
),
),
migrations.AddField(
model_name="historicallocation",
name="content_type",
field=models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="+",
to="contenttypes.contenttype",
),
),
migrations.AddField(
model_name="historicallocation",
name="history_user",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
]