Fix duplicate date range dropdowns in Admin
This commit is contained in:
parent
f32a54acdf
commit
e5357909b3
Binary file not shown.
@ -293,7 +293,6 @@ JAZZMIN_SETTINGS = {
|
||||
"default_icon_children": "fas fa-circle",
|
||||
"related_modal_active": False,
|
||||
"custom_css": "css/custom_v2.css",
|
||||
"custom_js": "js/admin_date_range_dropdown.js",
|
||||
"use_google_fonts_cdn": True,
|
||||
"show_ui_builder": False,
|
||||
"language_chooser": True,
|
||||
@ -331,4 +330,4 @@ REST_FRAMEWORK = {
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -18,9 +18,6 @@ from django.template.loader import render_to_string
|
||||
import weasyprint
|
||||
from django.db.models import Sum
|
||||
|
||||
class DropdownDateRangeFilter(DateRangeFilter):
|
||||
pass
|
||||
|
||||
class ProfileInline(admin.StackedInline):
|
||||
model = Profile
|
||||
can_delete = False
|
||||
@ -104,7 +101,7 @@ class ParcelAdmin(admin.ModelAdmin):
|
||||
list_filter = (
|
||||
'status',
|
||||
'payment_status',
|
||||
('created_at', DropdownDateRangeFilter),
|
||||
('created_at', DateRangeFilter),
|
||||
)
|
||||
search_fields = ('tracking_number', 'shipper__username', 'receiver_name', 'carrier__username')
|
||||
actions = ['export_as_csv', 'print_parcels', 'export_pdf']
|
||||
|
||||
359
staticfiles/css/custom_v2.css
Normal file
359
staticfiles/css/custom_v2.css
Normal file
@ -0,0 +1,359 @@
|
||||
/* masarX Custom Styles */
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@600;700&display=swap');
|
||||
|
||||
:root {
|
||||
--primary-dark: #1A1A1D;
|
||||
--accent-orange: #FF922B;
|
||||
--soft-cloud: #F8F9FA;
|
||||
--slate-blue: #4D96FF;
|
||||
--glass-bg: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--soft-cloud);
|
||||
color: var(--primary-dark);
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-family: 'Outfit', sans-serif;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.hero-section {
|
||||
background: linear-gradient(135deg, var(--primary-dark) 0%, #2D2D30 100%);
|
||||
padding: 100px 0;
|
||||
color: white;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hero-section::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -50px;
|
||||
right: -50px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: var(--accent-orange);
|
||||
filter: blur(80px);
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
backdrop-filter: blur(15px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 20px;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.btn-masarx-primary {
|
||||
background-color: var(--accent-orange);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 30px;
|
||||
border-radius: 12px;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-masarx-primary:hover {
|
||||
background-color: #E87E1B;
|
||||
transform: translateY(-2px);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.tracking-input {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
border-radius: 12px 0 0 12px;
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.tracking-input:focus {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-color: var(--accent-orange);
|
||||
box-shadow: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: var(--accent-orange);
|
||||
border-radius: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20px;
|
||||
color: white;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.parcel-status-badge {
|
||||
padding: 8px 16px;
|
||||
border-radius: 50px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.status-pending { background: #FFE8CC; color: #D9480F; }
|
||||
.status-picked_up { background: #E3FAFC; color: #0B7285; }
|
||||
.status-in_transit { background: #E7F5FF; color: #1864AB; }
|
||||
.status-delivered { background: #EBFBEE; color: #2B8A3E; }
|
||||
|
||||
/* Chat Widget */
|
||||
#masar-chat-widget {
|
||||
position: fixed;
|
||||
bottom: 90px;
|
||||
right: 20px;
|
||||
width: 350px;
|
||||
height: 500px;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#masar-chat-toggle {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
background-color: var(--accent-orange);
|
||||
color: white;
|
||||
border: none;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
#masar-chat-toggle:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
/* RTL Support for Chat */
|
||||
[dir="rtl"] #masar-chat-widget {
|
||||
right: auto;
|
||||
left: 20px;
|
||||
}
|
||||
[dir="rtl"] #masar-chat-toggle {
|
||||
right: auto;
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
.typing-dots span {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #adb5bd;
|
||||
border-radius: 50%;
|
||||
margin: 0 2px;
|
||||
animation: typing 1s infinite;
|
||||
}
|
||||
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
|
||||
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
|
||||
|
||||
@keyframes typing {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-5px); }
|
||||
}
|
||||
|
||||
/* --- Admin Panel Customizations --- */
|
||||
|
||||
/* Fix: Prevent accidental file dialog open when clicking labels for logos/favicons */
|
||||
body.model-platformprofile label[for="id_logo"],
|
||||
body.model-platformprofile label[for="id_favicon"],
|
||||
body.model-platformprofile label[for="id_admin_panel_logo"] {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* Improve Admin Form Spacing */
|
||||
.form-row {
|
||||
padding: 15px 10px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
/* --- Fix Admin Search Box & Filter Layout --- */
|
||||
|
||||
/* Target the search form container in Jazzmin/AdminLTE */
|
||||
#changelist-search .input-group {
|
||||
display: flex !important;
|
||||
flex-wrap: nowrap !important;
|
||||
max-width: 300px !important;
|
||||
}
|
||||
|
||||
/* Make the input field take available space */
|
||||
#changelist-search input[type="text"] {
|
||||
flex-grow: 1 !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
/* Ensure the button stays inline */
|
||||
#changelist-search button[type="submit"],
|
||||
#changelist-search .btn {
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
/* Force filters to sit nicely in a row */
|
||||
.filter-wrapper .form-group,
|
||||
.filter-wrapper select,
|
||||
.filter-wrapper .select2-container {
|
||||
margin-bottom: 0 !important;
|
||||
display: inline-block !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
/* Fix for Date Range Inputs if they appear */
|
||||
.admindatefilter .controls {
|
||||
display: inline-flex !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
/* --- Search Box RTL/LTR Border Radius Handling --- */
|
||||
|
||||
/* LTR (Default) */
|
||||
.masar-search-input {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
.masar-search-btn {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
/* RTL Override for Search Box */
|
||||
[dir="rtl"] .masar-search-input {
|
||||
border-top-right-radius: 0.25rem !important;
|
||||
border-bottom-right-radius: 0.25rem !important;
|
||||
border-top-left-radius: 0 !important;
|
||||
border-bottom-left-radius: 0 !important;
|
||||
}
|
||||
[dir="rtl"] .masar-search-btn {
|
||||
border-top-left-radius: 0.25rem !important;
|
||||
border-bottom-left-radius: 0.25rem !important;
|
||||
border-top-right-radius: 0 !important;
|
||||
border-bottom-right-radius: 0 !important;
|
||||
}
|
||||
|
||||
/* --- Admin Panel RTL Sidebar Override (Agresive) --- */
|
||||
|
||||
/* We use [dir="rtl"] selector which should be on html tag */
|
||||
|
||||
@media (min-width: 992px) {
|
||||
/* Main Sidebar */
|
||||
[dir="rtl"] .main-sidebar {
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
border-right: none !important;
|
||||
border-left: 1px solid rgba(0,0,0,0.1) !important;
|
||||
}
|
||||
|
||||
/* Content Wrapper & Headers */
|
||||
[dir="rtl"] .content-wrapper,
|
||||
[dir="rtl"] .main-header,
|
||||
[dir="rtl"] .main-footer {
|
||||
margin-left: 0 !important;
|
||||
margin-right: 250px !important;
|
||||
transition: margin-right .3s ease-in-out !important;
|
||||
}
|
||||
|
||||
/* Collapsed Sidebar State */
|
||||
[dir="rtl"].sidebar-collapse .main-sidebar {
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important; /* AdminLTE collapses by width, not margin usually, but ensure position matches */
|
||||
width: 4.6rem !important;
|
||||
}
|
||||
|
||||
[dir="rtl"].sidebar-collapse .content-wrapper,
|
||||
[dir="rtl"].sidebar-collapse .main-header,
|
||||
[dir="rtl"].sidebar-collapse .main-footer {
|
||||
margin-left: 0 !important;
|
||||
margin-right: 4.6rem !important;
|
||||
}
|
||||
|
||||
/* Fix Brand Logo Area */
|
||||
[dir="rtl"] .brand-link {
|
||||
float: right !important;
|
||||
width: 100% !important;
|
||||
text-align: right !important;
|
||||
}
|
||||
[dir="rtl"] .brand-image {
|
||||
float: right !important;
|
||||
margin-right: 0.8rem !important;
|
||||
margin-left: 0.5rem !important;
|
||||
}
|
||||
|
||||
/* Navbar alignment */
|
||||
[dir="rtl"] .navbar-nav {
|
||||
flex-direction: row; /* bootstrap default, but ensure items flow right to left visually */
|
||||
}
|
||||
[dir="rtl"] .navbar-nav .nav-item {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Right side navbar items (user menu etc) should be on left now?
|
||||
In RTL, "ml-auto" (margin-left: auto) pushes items to the LEFT.
|
||||
Jazzmin uses ml-auto for the user menu.
|
||||
In RTL, we want them on the LEFT.
|
||||
Bootstrap 4 RTL support usually flips ml-auto to mr-auto,
|
||||
but if we are running LTR bootstrap in RTL mode, ml-auto pushes to Right.
|
||||
Wait, ml-auto = margin-left: auto. In LTR, this pushes to Right.
|
||||
In RTL, we want these items on the LEFT. So we need margin-right: auto.
|
||||
*/
|
||||
|
||||
[dir="rtl"] .ml-auto {
|
||||
margin-left: 0 !important;
|
||||
margin-right: auto !important;
|
||||
}
|
||||
|
||||
[dir="rtl"] .mr-auto {
|
||||
margin-right: 0 !important;
|
||||
margin-left: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar Navigation Items RTL */
|
||||
[dir="rtl"] .nav-sidebar .nav-item > .nav-link {
|
||||
display: flex !important;
|
||||
flex-direction: row !important; /* Standard flow: RTL = Start(Right) to End(Left) */
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
[dir="rtl"] .nav-sidebar .nav-icon {
|
||||
margin-left: 0.5rem !important;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
[dir="rtl"] .nav-sidebar .nav-link p {
|
||||
display: inline-block !important;
|
||||
margin-right: 0 !important;
|
||||
text-align: right !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
/* Fix sidebar angle icon (arrow) */
|
||||
[dir="rtl"] .nav-sidebar .nav-icon.fa-angle-left {
|
||||
transform: rotate(180deg);
|
||||
margin-left: 0 !important;
|
||||
margin-right: auto !important; /* Push to the far left */
|
||||
}
|
||||
|
||||
/* General Utils */
|
||||
[dir="rtl"] .float-right {
|
||||
float: left !important;
|
||||
}
|
||||
[dir="rtl"] .float-left {
|
||||
float: right !important;
|
||||
}
|
||||
[dir="rtl"] .text-right {
|
||||
text-align: left !important;
|
||||
}
|
||||
[dir="rtl"] .text-left {
|
||||
text-align: right !important;
|
||||
}
|
||||
386
temp_jazzmin_base.html
Normal file
386
temp_jazzmin_base.html
Normal file
@ -0,0 +1,386 @@
|
||||
{% load i18n static jazzmin admin_urls %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
{% get_current_language_bidi as LANGUAGE_BIDI %}
|
||||
{% get_jazzmin_settings request as jazzmin_settings %}
|
||||
{% get_jazzmin_ui_tweaks as jazzmin_ui %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<!-- Prevent admin panel being crawled by search engines -->
|
||||
<meta name="robots" content="none, noarchive">
|
||||
|
||||
<title>{% block title %}{{ title }} | {{ jazzmin_settings.site_title }}{% endblock %}</title>
|
||||
|
||||
<!-- Font Awesome Icons -->
|
||||
<link rel="stylesheet" href="{% static "vendor/fontawesome-free/css/all.min.css" %}">
|
||||
|
||||
<!-- Bootstrap and adminLTE -->
|
||||
<link rel="stylesheet" href="{% static "vendor/adminlte/css/adminlte.min.css" %}" id="adminlte-css">
|
||||
|
||||
<!-- Bootswatch theme -->
|
||||
{% if jazzmin_ui.theme.name != 'default' %}
|
||||
<link rel="stylesheet" href="{{ jazzmin_ui.theme.src }}" id="jazzmin-theme" />
|
||||
{% endif %}
|
||||
|
||||
{% if jazzmin_ui.dark_mode_theme %}
|
||||
<link rel="stylesheet" href="{{ jazzmin_ui.dark_mode_theme.src }}" id="jazzmin-dark-mode-theme" media="(prefers-color-scheme: dark)"/>
|
||||
{% endif %}
|
||||
|
||||
<!-- Custom fixes for django -->
|
||||
<link rel="stylesheet" href="{% static "jazzmin/css/main.css" %}">
|
||||
|
||||
{% if jazzmin_settings.custom_css %}
|
||||
<!-- Custom CSS -->
|
||||
<link rel="stylesheet" href="{% static jazzmin_settings.custom_css %}">
|
||||
{% endif %}
|
||||
|
||||
<!-- favicons -->
|
||||
<link rel="shortcut icon" href="{% static jazzmin_settings.site_icon %}" type="image/png">
|
||||
<link rel="icon" href="{% static jazzmin_settings.site_icon %}" sizes="32x32" type="image/png">
|
||||
|
||||
{% if jazzmin_settings.use_google_fonts_cdn %}
|
||||
<!-- Google Font: Source Sans Pro -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
|
||||
{% endif %}
|
||||
|
||||
{% block extrastyle %} {% endblock %}
|
||||
{% block extrahead %} {% endblock %}
|
||||
</head>
|
||||
<body class="hold-transition{% if not jazzmin_settings.show_sidebar %} no-sidebar{% else %} sidebar-mini{% endif %} {% sidebar_status request %} {% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %} {{ jazzmin_ui.body_classes }} {% if jazzmin_ui.dark_mode_theme %}theme-dark{% endif %}" data-admin-utc-offset="{% now "Z" %}">
|
||||
|
||||
<div class="wrapper">
|
||||
|
||||
{% if not is_popup %}
|
||||
<nav class="main-header navbar navbar-expand {{ jazzmin_ui.navbar_classes }}" id="jazzy-navbar">
|
||||
<ul class="navbar-nav">
|
||||
|
||||
{% if jazzmin_settings.show_sidebar %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a href="{% url 'admin:index' %}" class="brand-link">
|
||||
<img src="{% static jazzmin_settings.site_logo %}" alt="{{ jazzmin_settings.site_header }} Logo" class="{{ jazzmin_settings.site_logo_classes }} brand-image" style="opacity: .8; margin: 0 0 0 5px;">
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% get_top_menu user request.current_app|default:"admin" as top_menu %}
|
||||
{% for link in top_menu %}
|
||||
<li class="nav-item d-none d-sm-inline-block{% if link.children %} dropdown{% endif %}">
|
||||
{% if link.children %}
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ link.name }}
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
{% for child in link.children %}
|
||||
<a class="dropdown-item" href="{{ child.url }}" {% if link.new_window %}target="_blank"{% endif %}>{{ child.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="{{ link.url }}" class="nav-link" {% if link.new_window %}target="_blank"{% endif %}>{{ link.name }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% if jazzmin_settings.search_model %}
|
||||
{% for search_model in jazzmin_settings.search_models_parsed %}
|
||||
<form action="{{ search_model.search_url }}" method="GET" class="form-inline ml-3">
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control form-control-navbar" name="q" type="search" placeholder="{% trans 'Search' %} {{ search_model.search_name }}..." aria-label="{% trans 'Search' %} {{ search_model.search_name }}...">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-navbar" type="submit">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<ul class="navbar-nav ml-auto">
|
||||
|
||||
{% if jazzmin_settings.show_ui_builder %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
|
||||
<i class="fas fa-th-large"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if 'django.contrib.admindocs'|app_is_installed %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'django-admindocs-docroot' %}" role="button">
|
||||
<i class="fas fa-book"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if jazzmin_settings.language_chooser %}
|
||||
{% get_available_languages as LANGUAGES %}
|
||||
{% get_language_info_list for LANGUAGES as languages %}
|
||||
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link btn" data-toggle="dropdown" href="#" title="Choose language">
|
||||
<i class="fas fa-globe" aria-hidden="true"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-left" id="jazzy-languagemenu">
|
||||
<form action="{% url 'set_language' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input name="next" type="hidden" value="{{ request.get_full_path|remove_lang:LANGUAGE_CODE }}" />
|
||||
{% for language in languages %}
|
||||
<button
|
||||
type="submit"
|
||||
name="language"
|
||||
value="{{ language.code }}"
|
||||
class="dropdown-item {% if language.code == LANGUAGE_CODE %}active{% endif %}"
|
||||
lang="{{ language.code }}"
|
||||
>
|
||||
{{ language.name_local|title }}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link btn" data-toggle="dropdown" href="#" title="{{ request.user }}">
|
||||
<i class="far fa-user" aria-hidden="true"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-left" id="jazzy-usermenu">
|
||||
<span class="dropdown-header">{% trans 'Account' %}</span>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="{% url 'admin:password_change' %}" class="dropdown-item">
|
||||
<i class="fas fa-key mr-2"></i> {% trans 'Change password' %}
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<form id="logout-form" method="post" action="{% url 'admin:logout' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="dropdown-item"><i class="fas fa-users mr-2"></i> {% translate 'Log out' %}</button>
|
||||
</form>
|
||||
{% get_user_menu user request.current_app|default:"admin" as user_menu %}
|
||||
{% for link in user_menu %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="{{ link.url }}" class="dropdown-item" {% if link.new_window %}target="_blank"{% endif %}>
|
||||
<i class="{{ link.icon }} mr-2"></i> {% trans link.name %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
<div class="dropdown-divider"></div>
|
||||
{% if perms|can_view_self %}
|
||||
<a href="{% jazzy_admin_url request.user request.current_app|default:"admin" %}" class="dropdown-item dropdown-footer">{% trans 'See Profile' %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{% block sidebar %}
|
||||
{% if jazzmin_settings.show_sidebar %}
|
||||
{% get_side_menu as side_menu_list %}
|
||||
|
||||
<aside class="main-sidebar elevation-4 {{ jazzmin_ui.sidebar_classes }}" id="jazzy-sidebar">
|
||||
<a href="{% url 'admin:index' %}" class="brand-link {{ jazzmin_ui.brand_classes }}" id="jazzy-logo">
|
||||
<img src="{% static jazzmin_settings.site_logo %}" alt="{{ jazzmin_settings.site_header }} Logo" class="{{ jazzmin_settings.site_logo_classes }} brand-image elevation-3" style="opacity: .8">
|
||||
<span class="brand-text font-weight-light">{{ jazzmin_settings.site_brand }}</span>
|
||||
</a>
|
||||
|
||||
<div class="sidebar">
|
||||
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
|
||||
<div class="image">
|
||||
{% if jazzmin_settings|has_jazzmin_setting:"user_avatar" %}
|
||||
<img src="{% get_user_avatar request.user %}" width="160px" class="img-circle elevation-2" alt="User Image">
|
||||
{% else %}
|
||||
<i class="fas fa-inverse user-profile fa-user-circle"></i>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="info">
|
||||
{% if perms|can_view_self %}
|
||||
<a href="{% jazzy_admin_url request.user request.current_app|default:"admin" %}" class="d-block">{{ request.user }}</a>
|
||||
{% else %}
|
||||
<span class="d-block" style="color: white;">{{ request.user }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav class="mt-2">
|
||||
<ul class="nav nav-pills nav-sidebar flex-column {{ jazzmin_ui.sidebar_list_classes }}" data-widget="treeview" role="menu" data-collapsible="false">
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="{% url 'admin:index' %}" class="nav-link">
|
||||
<i class="nav-icon fas fa-th-large"></i>
|
||||
<p>{% trans 'Dashboard' %}</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if jazzmin_settings.navigation_expanded %}
|
||||
{% for app in side_menu_list %}
|
||||
<li class="nav-header">{{ app.name }}</li>
|
||||
{% for model in app.models %}
|
||||
<li class="nav-item">
|
||||
{% if model.url %}
|
||||
<a href="{{ model.url }}" class="nav-link">
|
||||
<i class="nav-icon {{ model.icon }}"></i> <p>{{ model.name }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="nav-link disabled">
|
||||
<i class="nav-icon {{ model.icon }}"></i> <p>{{ model.name }}</p>
|
||||
</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for app in side_menu_list %}
|
||||
<li class="nav-item has-treeview">
|
||||
<a href="#" class="nav-link">
|
||||
<i class="nav-icon {{ app.icon }}"></i>
|
||||
<p>{{ app.name|truncatechars:21 }} <i class="fas fa-angle-left right"></i></p>
|
||||
</a>
|
||||
<ul class="nav nav-treeview" style="display: none;">
|
||||
{% for model in app.models %}
|
||||
<li class="nav-item">
|
||||
<a href="{% if model.url %}{{ model.url }}{% else %}javascript:void(0){% endif %}" class="nav-link">
|
||||
<i class="nav-icon {{ model.icon }}"></i>
|
||||
<p>{{ model.name }}</p>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</aside>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
<div class="content-wrapper" {% if is_popup %}style="margin-left:0px; padding-top: 20px;"{% endif %}>
|
||||
{% block page_content %}
|
||||
{% if not is_popup %}
|
||||
<div class="content border-bottom mb-2">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-auto d-flex flex-grow-1 align-items-center">
|
||||
<h1 class="h4 m-0 pr-3 mr-3 border-right">{% block content_title %}{% endblock %}</h1>
|
||||
{% block breadcrumbs %}{% endblock %}
|
||||
</div>
|
||||
{% block page_actions %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="content">
|
||||
<div class="container-fluid">
|
||||
<section id="content" class="content">
|
||||
{% block messages %}
|
||||
{% for message in messages %}
|
||||
{% if message.tags == 'success' %}
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
|
||||
</button>
|
||||
<i class="icon fa fa-check"></i>{{ message|capfirst }}
|
||||
</div>
|
||||
{% elif message.tags == 'error' %}
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
|
||||
</button>
|
||||
<i class="icon fa fa-ban"></i>{{ message|capfirst }}
|
||||
</div>
|
||||
{% elif message.tags == 'warning' %}
|
||||
<div class="alert alert-warning alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
|
||||
</button>
|
||||
<i class="icon fa fa-exclamation-triangle"></i>{{ message|capfirst }}
|
||||
</div>
|
||||
{% elif message.tags == 'info' %}
|
||||
<div class="alert alert-info alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
|
||||
</button>
|
||||
<i class="icon fa fa-info"></i>{{ message|capfirst }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock messages %}
|
||||
<div class="row">
|
||||
{% block content %} {% endblock %}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% block footer %}
|
||||
{% if not is_popup %}
|
||||
<footer class="main-footer {{ jazzmin_ui.footer_classes }}">
|
||||
<div class="float-right d-none d-sm-inline">
|
||||
<b>{% trans 'Jazzmin version' %}</b> {% get_jazzmin_version %}
|
||||
</div>
|
||||
{% autoescape off %}
|
||||
<strong>{% trans 'Copyright' %} © {% now 'Y' %} {{ jazzmin_settings.copyright }}.</strong> {% trans 'All rights reserved.' %}
|
||||
{% endautoescape %}
|
||||
</footer>
|
||||
{% if jazzmin_settings.show_ui_builder %}
|
||||
{% include 'jazzmin/includes/ui_builder_panel.html' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
</div>
|
||||
|
||||
{% if jazzmin_settings.show_ui_builder %}
|
||||
<div id="codeBox" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">{% trans 'UI Configuration' %}</h4>
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>{% trans 'Copy this info your settings file to persist these UI changes' %}</p>
|
||||
<pre><code></code></pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn {{ jazzmin_ui.button_classes.danger }}" data-dismiss="modal">{% trans 'Close' %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="{% static "admin/js/vendor/jquery/jquery.js" %}"></script>
|
||||
<!-- Bootstrap 4 -->
|
||||
<script src="{% static "vendor/bootstrap/js/bootstrap.min.js" %}"></script>
|
||||
<!-- AdminLTE App -->
|
||||
<script src="{% static "vendor/adminlte/js/adminlte.min.js" %}"></script>
|
||||
<!-- Django customisations -->
|
||||
<script src="{% static "jazzmin/js/main.js" %}"></script>
|
||||
|
||||
{% if jazzmin_settings.custom_js %}
|
||||
<script src="{% static jazzmin_settings.custom_js %}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if jazzmin_settings.show_ui_builder %}
|
||||
<script>
|
||||
window.ui_changes = {{ jazzmin_ui.raw|as_json|safe }};
|
||||
</script>
|
||||
<script src="{% static "jazzmin/js/ui-builder.js" %}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% block extrajs %}{% endblock %}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user