editing navigation

This commit is contained in:
Flatlogic Bot 2026-01-25 15:26:43 +00:00
parent 4c9baf95e0
commit 9868906b5e
5 changed files with 76 additions and 39 deletions

View File

@ -180,7 +180,7 @@ EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER", "aalabry@gmail.com")
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD", "accd uacy kzdq aejp")
EMAIL_USE_TLS = os.getenv("EMAIL_USE_TLS", "true").lower() == "true"
EMAIL_USE_SSL = os.getenv("EMAIL_USE_SSL", "false").lower() == "true"
DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", "no-reply@example.com")
DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL", EMAIL_HOST_USER)
CONTACT_EMAIL_TO = [
item.strip()
for item in os.getenv("CONTACT_EMAIL_TO", DEFAULT_FROM_EMAIL).split(",")

View File

@ -52,10 +52,11 @@
text-align: right;
width: 100%;
}
/* Float helpers if needed (though flex is preferred) */
.float-end { float: left !important; }
.float-start { float: right !important; }
.dropdown-menu-end {
right: auto;
left: 0;
}
</style>
{% endif %}
@ -63,12 +64,20 @@
</head>
<body class="d-flex flex-column min-vh-100">
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark w-100" style="z-index: 1000;">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark w-100 py-3" style="z-index: 1000;">
<div class="container">
<a class="navbar-brand fw-bold fs-3" href="{% url 'index' %}" style="font-family: 'Outfit', sans-serif;">masar<span style="color: var(--accent-orange)">X</span></a>
<a class="navbar-brand d-flex align-items-center" href="{% url 'index' %}">
{% if platform_profile and platform_profile.logo %}
<img src="{{ platform_profile.logo.url }}" alt="{{ platform_profile.name }}" height="40" class="me-2">
{% else %}
<span class="fw-bold fs-3" style="font-family: 'Outfit', sans-serif;">masar<span style="color: var(--accent-orange)">X</span></span>
{% endif %}
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto align-items-center">
<li class="nav-item">
@ -77,38 +86,62 @@
<li class="nav-item">
<a class="nav-link px-3" href="{% url 'contact' %}">{% trans "Contact" %}</a>
</li>
{% if user.is_authenticated %}
<li class="nav-item">
<a class="nav-link px-3" href="{% url 'dashboard' %}">{% trans "Dashboard" %}</a>
</li>
{% if user.is_staff %}
<li class="nav-item">
<a class="nav-link px-3 text-warning" href="/admin/">{% trans "Admin" %}</a>
</li>
{% endif %}
<li class="nav-item">
<a href="{% url 'profile' %}" class="nav-link text-white-50">{% trans "Hello" %}, {{ user.username }}</a>
</li>
<li class="nav-item">
<form action="{% url 'logout' %}" method="post" class="d-inline">
{% csrf_token %}
<button type="submit" class="btn btn-link nav-link">{% trans "Logout" %}</button>
</form>
<!-- User Profile Dropdown -->
<li class="nav-item dropdown ms-lg-3">
<a class="nav-link dropdown-toggle d-flex align-items-center" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{% if user_profile.profile_picture %}
<img src="{{ user_profile.profile_picture.url }}" alt="Profile" class="rounded-circle" width="32" height="32" style="object-fit: cover;">
{% else %}
<div class="rounded-circle bg-secondary d-flex justify-content-center align-items-center text-white" style="width: 32px; height: 32px;">
<i class="bi bi-person-fill"></i>
</div>
{% endif %}
<span class="ms-2 d-none d-lg-inline">{{ user.first_name|default:user.username }}</span>
</a>
<ul class="dropdown-menu dropdown-menu-end shadow-sm border-0" aria-labelledby="userDropdown">
<li>
<div class="px-3 py-2 border-bottom">
<div class="fw-bold text-dark">{{ user.first_name|default:user.username }}</div>
<div class="small text-muted text-truncate" style="max-width: 150px;">{{ user.email }}</div>
</div>
</li>
{% if user.is_staff %}
<li><a class="dropdown-item text-warning" href="/admin/"><i class="bi bi-shield-lock me-2"></i>{% trans "Admin Panel" %}</a></li>
<li><hr class="dropdown-divider"></li>
{% endif %}
<li><a class="dropdown-item" href="{% url 'profile' %}"><i class="bi bi-person me-2"></i>{% trans "My Profile" %}</a></li>
<li><a class="dropdown-item" href="{% url 'edit_profile' %}"><i class="bi bi-gear me-2"></i>{% trans "Edit Profile" %}</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form action="{% url 'logout' %}" method="post" class="d-inline w-100">
{% csrf_token %}
<button type="submit" class="dropdown-item text-danger"><i class="bi bi-box-arrow-right me-2"></i>{% trans "Logout" %}</button>
</form>
</li>
</ul>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link px-3" href="{% url 'login' %}">{% trans "Login" %}</a>
<li class="nav-item ms-lg-2">
<a class="nav-link" href="{% url 'login' %}">{% trans "Login" %}</a>
</li>
<li class="nav-item">
<a class="nav-link px-3" href="{% url 'register' %}">{% trans "Register" %}</a>
<li class="nav-item ms-lg-2">
<a class="btn btn-outline-light btn-sm px-4 rounded-pill" href="{% url 'register' %}">{% trans "Register" %}</a>
</li>
{% endif %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="langDropdown" role="button" data-bs-toggle="dropdown">
<i class="bi bi-globe"></i> {{ lang.name_local }}
<!-- Language Switcher -->
<li class="nav-item dropdown ms-lg-3">
<a class="nav-link dropdown-toggle text-white-50" href="#" id="langDropdown" role="button" data-bs-toggle="dropdown">
<i class="bi bi-globe"></i> <span class="d-lg-none ms-2">{{ lang.name_local }}</span>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<ul class="dropdown-menu dropdown-menu-end shadow-sm border-0">
{% get_available_languages as LANGUAGES %}
{% for lang_code, lang_name in LANGUAGES %}
<li>
@ -126,13 +159,11 @@
</ul>
</li>
<li class="nav-item ms-lg-3">
{% if user.is_authenticated and user_profile.role == 'car_owner' %}
<a href="{% url 'dashboard' %}" class="btn btn-masarx-primary btn-sm">{% trans "Find Loads" %}</a>
{% else %}
<a href="{% url 'shipment_request' %}" class="btn btn-masarx-primary btn-sm">{% trans "Start Shipping" %}</a>
{% endif %}
</li>
{% if not user.is_authenticated %}
<li class="nav-item ms-lg-3 d-none d-lg-block">
<a href="{% url 'shipment_request' %}" class="btn btn-masarx-primary btn-sm rounded-pill px-4">{% trans "Start Shipping" %}</a>
</li>
{% endif %}
</ul>
</div>
</div>
@ -141,7 +172,11 @@
<div class="container mt-3">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
<div class="alert alert-{{ message.tags }} alert-dismissible fade show shadow-sm border-0" role="alert">
{% if message.tags == 'success' %}<i class="bi bi-check-circle-fill me-2"></i>{% endif %}
{% if message.tags == 'error' %}<i class="bi bi-exclamation-triangle-fill me-2"></i>{% endif %}
{% if message.tags == 'warning' %}<i class="bi bi-exclamation-circle-fill me-2"></i>{% endif %}
{% if message.tags == 'info' %}<i class="bi bi-info-circle-fill me-2"></i>{% endif %}
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
@ -153,7 +188,7 @@
{% block content %}{% endblock %}
</main>
<footer class="bg-dark text-white pt-5 pb-3 mt-5">
<footer class="bg-dark text-white pt-5 pb-3 mt-5 border-top border-secondary">
<div class="container">
<div class="row">
<div class="col-md-4 mb-4">

View File

@ -261,11 +261,13 @@ def edit_profile_view(request):
messages.info(request, _("Verification code sent to WhatsApp."))
else:
# Default to email
# Send to the NEW email address (from the form), not the old one
target_email = data['email']
send_mail(
_('Verification Code'),
f'Your verification code is: {code}',
settings.DEFAULT_FROM_EMAIL,
[request.user.email],
[target_email],
fail_silently=False,
)
messages.info(request, _("Verification code sent to email."))
@ -325,4 +327,4 @@ def verify_otp_view(request):
except OTPVerification.DoesNotExist:
messages.error(request, _("Invalid code."))
return render(request, 'core/verify_otp.html', {'form': form})
return render(request, 'core/verify_otp.html')