mirror of
				https://github.com/kevinveenbirkenbach/homepage.veen.world.git
				synced 2025-11-04 01:18:09 +00:00 
			
		
		
		
	Added dynamic submenus
This commit is contained in:
		@@ -106,3 +106,11 @@ h3.footer-title{
 | 
				
			|||||||
  left: 100%; /* Positioniert das Submenü rechts vom Hauptmenü */
 | 
					  left: 100%; /* Positioniert das Submenü rechts vom Hauptmenü */
 | 
				
			||||||
  margin-top: -1px;
 | 
					  margin-top: -1px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.dropdown-menu.collapse {
 | 
				
			||||||
 | 
					  display: none;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.dropdown-menu.collapse.show {
 | 
				
			||||||
 | 
					  display: block;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										21
									
								
								app/static/js/close-submenus.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								app/static/js/close-submenus.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					document.addEventListener('DOMContentLoaded', () => {
 | 
				
			||||||
 | 
					    const dropdownSubmenus = document.querySelectorAll('.dropdown-submenu > .dropdown-item');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dropdownSubmenus.forEach((submenu) => {
 | 
				
			||||||
 | 
					        submenu.addEventListener('click', (event) => {
 | 
				
			||||||
 | 
					            event.preventDefault();
 | 
				
			||||||
 | 
					            const targetMenu = document.querySelector(submenu.getAttribute('data-bs-target'));
 | 
				
			||||||
 | 
					            const allSubmenus = document.querySelectorAll('.dropdown-menu.collapse');
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            // Schließe alle anderen Submenüs
 | 
				
			||||||
 | 
					            allSubmenus.forEach((menu) => {
 | 
				
			||||||
 | 
					                if (menu !== targetMenu) {
 | 
				
			||||||
 | 
					                    menu.classList.remove('show');
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // Toggle des aktuellen Submenüs
 | 
				
			||||||
 | 
					            targetMenu.classList.toggle('show');
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@@ -39,6 +39,7 @@
 | 
				
			|||||||
        <!-- Include modal -->
 | 
					        <!-- Include modal -->
 | 
				
			||||||
        {% include "moduls/modal.html.j2" %}
 | 
					        {% include "moduls/modal.html.j2" %}
 | 
				
			||||||
        <script src="{{ url_for('static', filename='js/dynamic-modal.js') }}"></script>
 | 
					        <script src="{{ url_for('static', filename='js/dynamic-modal.js') }}"></script>
 | 
				
			||||||
 | 
					        <script src="{{ url_for('static', filename='js/close-submenus.js') }}"></script>
 | 
				
			||||||
        <script src="{{ url_for('static', filename='js/tooltip.js') }}"></script>
 | 
					        <script src="{{ url_for('static', filename='js/tooltip.js') }}"></script>
 | 
				
			||||||
    </body>
 | 
					    </body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
@@ -3,10 +3,10 @@
 | 
				
			|||||||
    {% for subitem in subitems %}
 | 
					    {% for subitem in subitems %}
 | 
				
			||||||
        {% if subitem.subitems %}
 | 
					        {% if subitem.subitems %}
 | 
				
			||||||
            <li class="dropdown-submenu">
 | 
					            <li class="dropdown-submenu">
 | 
				
			||||||
                <a class="dropdown-item" title="{{ subitem.description }}">
 | 
					                <a class="dropdown-item dropdown-toggle" href="#" id="submenu-{{ loop.index }}" data-bs-toggle="collapse" data-bs-target="#submenu-content-{{menu_type}}-{{ loop.index }}" aria-expanded="false" title="{{ subitem.description }}">
 | 
				
			||||||
                    <i class="{{ subitem.icon.class }}"></i> {{ subitem.name }}
 | 
					                    <i class="{{ subitem.icon.class }}"></i> {{ subitem.name }}
 | 
				
			||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
                <ul class="dropdown-submenu">
 | 
					                <ul class="dropdown-menu collapse" id="submenu-content-{{menu_type}}-{{ loop.index }}">
 | 
				
			||||||
                    {{ render_subitems(subitem.subitems) }}
 | 
					                    {{ render_subitems(subitem.subitems) }}
 | 
				
			||||||
                </ul>
 | 
					                </ul>
 | 
				
			||||||
            </li>
 | 
					            </li>
 | 
				
			||||||
@@ -30,6 +30,7 @@
 | 
				
			|||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
{% endmacro %}
 | 
					{% endmacro %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 <!-- Navigation Bar -->
 | 
					 <!-- Navigation Bar -->
 | 
				
			||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
 | 
					<nav class="navbar navbar-expand-lg navbar-light bg-light">
 | 
				
			||||||
    <div class="container-fluid">
 | 
					    <div class="container-fluid">
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user