|
66 | 66 | <div class="mt-4 mb-2 px-2 text-xs text-stone-400 uppercase tracking-wider">App</div>
|
67 | 67 |
|
68 | 68 | {% for section, views in app_sections.items() %}
|
69 |
| - {% if section %} |
| 69 | + {% if section.name %} |
70 | 70 | <button
|
71 | 71 | data-nav-toggle="app-section-{{ loop.index }}"
|
72 | 72 | class="flex items-center justify-between w-full px-2 py-1 mt-1 text-sm rounded hover:bg-white/5 cursor-pointer"
|
73 |
| - title="Toggle {{ section }}"> |
74 |
| - <span class="text-stone-300/90">{{ section }}</span> |
| 73 | + title="Toggle {{ section.name }}"> |
| 74 | + <div class="flex items-center"> |
| 75 | + <admin.Icon name={section.icon} class="w-3.5 h-3.5 mr-2 flex-shrink-0 text-stone-400" /> |
| 76 | + <span class="text-stone-300/90">{{ section.name }}</span> |
| 77 | + </div> |
75 | 78 | <admin.Icon name="chevron-down" class="w-3.5 h-3.5 transition-transform text-stone-500" data-nav-toggle-icon />
|
76 | 79 | </button>
|
77 | 80 | <div id="app-section-{{ loop.index }}" style="display: none;">
|
| 81 | + {% for view in views %} |
| 82 | + {% set url = view.get_view_url() %} |
| 83 | + <a |
| 84 | + {% if url == request.path or view in parent_view_classes %}data-active{% endif %} |
| 85 | + class="data-[active]:text-blue-400 flex items-center px-2 py-0.5 mt-px text-sm rounded hover:text-stone-300 text-stone-300/90 hover:bg-white/5 pl-8" |
| 86 | + href="{{ url }}" |
| 87 | + hx-boost="true"> |
| 88 | + <span class="truncate">{{ view.get_nav_title() }}</span> |
| 89 | + </a> |
| 90 | + {% endfor %} |
| 91 | + </div> |
78 | 92 | {% else %}
|
79 | 93 | <div class="mb-4">
|
80 |
| - {% endif %} |
81 | 94 | {% for view in views %}
|
82 | 95 | {% set url = view.get_view_url() %}
|
83 | 96 | <a
|
84 | 97 | {% if url == request.path or view in parent_view_classes %}data-active{% endif %}
|
85 |
| - class="data-[active]:bg-white/20 data-[active]:text-white flex items-center px-2 py-0.5 mt-px text-sm rounded hover:text-stone-300 text-stone-300/90 hover:bg-white/5" |
| 98 | + class="data-[active]:text-blue-400 flex items-center px-2 py-0.5 mt-px text-sm rounded hover:text-stone-300 text-stone-300/90 hover:bg-white/5" |
86 | 99 | href="{{ url }}"
|
87 | 100 | hx-boost="true">
|
88 |
| - <admin.Icon name={view.get_nav_icon()} class="w-3.5 h-3.5 mr-3 flex-shrink-0" /> |
| 101 | + <admin.Icon name={view.nav_icon} class="w-3.5 h-3.5 mr-3 flex-shrink-0 text-stone-400" /> |
89 | 102 | <span class="truncate">{{ view.get_nav_title() }}</span>
|
90 | 103 | </a>
|
91 | 104 | {% endfor %}
|
92 | 105 | </div>
|
| 106 | + {% endif %} |
93 | 107 | {% endfor %}
|
94 | 108 | </div>
|
95 | 109 | {% endif %}
|
|
100 | 114 | <div class="mb-2 px-2 text-xs text-stone-400 uppercase tracking-wider">Plain</div>
|
101 | 115 |
|
102 | 116 | {% for section, views in plain_sections.items() %}
|
103 |
| - {% if section %} |
| 117 | + {% if section.name %} |
104 | 118 | <button
|
105 | 119 | data-nav-toggle="plain-section-{{ loop.index }}"
|
106 | 120 | class="flex items-center justify-between w-full px-2 py-1 mt-1 text-sm rounded hover:bg-white/5 cursor-pointer"
|
107 |
| - title="Toggle {{ section }}"> |
108 |
| - <span class="text-stone-300/90">{{ section }}</span> |
| 121 | + title="Toggle {{ section.name }}"> |
| 122 | + <div class="flex items-center"> |
| 123 | + <admin.Icon name={section.icon} class="w-3.5 h-3.5 mr-2 flex-shrink-0 text-stone-400" /> |
| 124 | + <span class="text-stone-300/90">{{ section.name }}</span> |
| 125 | + </div> |
109 | 126 | <admin.Icon name="chevron-down" class="w-3.5 h-3.5 transition-transform text-stone-500" data-nav-toggle-icon />
|
110 | 127 | </button>
|
111 | 128 | <div id="plain-section-{{ loop.index }}" style="display: none;">
|
| 129 | + {% for view in views %} |
| 130 | + {% set url = view.get_view_url() %} |
| 131 | + <a |
| 132 | + {% if url == request.path or view in parent_view_classes %}data-active{% endif %} |
| 133 | + class="data-[active]:text-blue-400 flex items-center px-2 py-0.5 mt-px text-sm rounded hover:text-stone-300 text-stone-300/90 hover:bg-white/5 pl-8" |
| 134 | + href="{{ url }}" |
| 135 | + hx-boost="true"> |
| 136 | + <span class="truncate">{{ view.get_nav_title() }}</span> |
| 137 | + </a> |
| 138 | + {% endfor %} |
| 139 | + </div> |
112 | 140 | {% else %}
|
113 | 141 | <div>
|
114 |
| - {% endif %} |
115 | 142 | {% for view in views %}
|
116 | 143 | {% set url = view.get_view_url() %}
|
117 | 144 | <a
|
118 | 145 | {% if url == request.path or view in parent_view_classes %}data-active{% endif %}
|
119 |
| - class="data-[active]:bg-white/20 data-[active]:text-white flex items-center px-2 py-0.5 mt-px text-sm rounded hover:text-stone-300 text-stone-300/90 hover:bg-white/5" |
| 146 | + class="data-[active]:text-blue-400 flex items-center px-2 py-0.5 mt-px text-sm rounded hover:text-stone-300 text-stone-300/90 hover:bg-white/5" |
120 | 147 | href="{{ url }}"
|
121 | 148 | hx-boost="true">
|
122 |
| - <admin.Icon name={view.get_nav_icon()} class="w-3.5 h-3.5 mr-3 flex-shrink-0" /> |
| 149 | + <admin.Icon name={view.nav_icon} class="w-3.5 h-3.5 mr-3 flex-shrink-0 text-stone-400" /> |
123 | 150 | <span class="truncate">{{ view.get_nav_title() }}</span>
|
124 | 151 | </a>
|
125 | 152 | {% endfor %}
|
126 | 153 | </div>
|
| 154 | + {% endif %} |
127 | 155 | {% endfor %}
|
128 | 156 | </div>
|
129 | 157 | {% endif %}
|
|
160 | 188 | <div class="flex-shrink-0 overflow-hidden">
|
161 | 189 | {% block header %}
|
162 | 190 | <div class="flex items-center">
|
163 |
| - {% block image %} |
164 |
| - {% if image %} |
165 |
| - <img src="{{ image.src }}" alt="{{ image.alt }}" class="h-20 rounded mr-3 flex-shrink-0"> |
166 |
| - {% endif %} |
167 |
| - {% endblock %} |
168 | 191 | <div class="truncate">
|
169 | 192 | <nav class="flex items-center text-sm sm:text-base lg:text-xl text-white/90 space-x-1" aria-label="Breadcrumb">
|
170 |
| - {% set current_nav_section = view_class.get_nav_section() %} |
171 |
| - {% if parent_view_classes or current_nav_section %} |
172 |
| - {% set ns = namespace(last_section='') %} |
173 |
| - {% for parent_view in parent_view_classes|reverse %} |
174 |
| - {% if parent_view.get_nav_section() and parent_view.get_nav_section() != ns.last_section %} |
175 |
| - {% if ns.last_section %} |
176 |
| - <admin.Icon name="chevron-right" class="w-3 h-3 text-white/50" /> |
177 |
| - {% endif %} |
178 |
| - <span class="text-white/40 text-sm">{{ parent_view.get_nav_section() }}</span> |
179 |
| - <admin.Icon name="chevron-right" class="w-3 h-3 text-white/50" /> |
180 |
| - {% set ns.last_section = parent_view.get_nav_section() %} |
181 |
| - {% elif loop.index > 1 %} |
182 |
| - <admin.Icon name="chevron-right" class="w-3 h-3 text-white/50" /> |
183 |
| - {% endif %} |
184 |
| - <a href="{{ parent_view.get_view_url(object if object is defined else None) }}" class="inline-flex items-center hover:text-white/70 text-white/50 text-sm"> |
185 |
| - {{ parent_view.get_nav_title() }} |
186 |
| - </a> |
187 |
| - {% endfor %} |
188 |
| - {% if current_nav_section and current_nav_section != ns.last_section %} |
189 |
| - {% if parent_view_classes %} |
| 193 | + {% for parent_view in parent_view_classes|reverse %} |
| 194 | + {% if parent_view.nav_section %} |
| 195 | + <span class="text-white/40 text-sm">{{ parent_view.nav_section }}</span> |
190 | 196 | <admin.Icon name="chevron-right" class="w-3 h-3 text-white/50" />
|
191 |
| - {% endif %} |
192 |
| - <span class="text-white/40 text-sm">{{ current_nav_section }}</span> |
193 | 197 | {% endif %}
|
194 |
| - {% if parent_view_classes or current_nav_section %} |
| 198 | + <a href="{{ parent_view.get_view_url(object if object is defined else None) }}" class="inline-flex items-center hover:text-white/70 text-white/50 text-sm"> |
| 199 | + {{ parent_view.get_nav_title() }} |
| 200 | + </a> |
| 201 | + <admin.Icon name="chevron-right" class="w-3 h-3 text-white/50" /> |
| 202 | + {% endfor %} |
| 203 | + {% if view_class.nav_section and not parent_view_classes %} |
| 204 | + <span class="text-white/40 text-sm">{{ view_class.nav_section }}</span> |
195 | 205 | <admin.Icon name="chevron-right" class="w-3 h-3 text-white/50" />
|
196 |
| - {% endif %} |
197 | 206 | {% endif %}
|
| 207 | + {% block image %} |
| 208 | + {% if image %} |
| 209 | + <img src="{{ image.src }}" alt="{{ image.alt }}" class="h-5 rounded mr-2 flex-shrink-0"> |
| 210 | + {% endif %} |
| 211 | + {% endblock %} |
198 | 212 | <h1 class="font-semibold text-sm">{% block title %}{{ title }}{% endblock %}</h1>
|
199 | 213 | </nav>
|
200 | 214 | </div>
|
|
0 commit comments