33{% block body %}
44 < div class ="sidebar " style ="width: 270px; ">
55 < h3 class ="brand "> < a href ="# "> Models documentation</ a > </ h3 >
6- < span data-bs-toggle ="collapse " data-bs-target ="#menu-content ">
7- < i class ="fa fa-bars fa-2x toggle-btn "> </ i >
8- </ span >
96 < div class ="menu-list ">
107 < ul id ="menu-content " class ="menu-content collapse out ">
118 {% for app_verbose_name, models in help_data.items %}
12- < li data-bs-toggle ="collapse " data-bs-target ="#{{ app_verbose_name|slugify }}-dropdown " class ="collapsed " aria-expanded ="false ">
13- < a > < i class ="fa fa-dot-circle-o fa-lg "> </ i > {{ app_verbose_name }} < span class ="arrow "> </ span > </ a >
9+ < li data-toggle ="collapse " data-target ="#{{ app_verbose_name|slugify }}-dropdown " class ="collapsed " aria-expanded ="false ">
10+ < a >
11+ < i class ="fa fa-dot-circle-o fa-lg "> </ i >
12+ {{ app_verbose_name }}
13+ < span class ="arrow "> </ span >
14+ </ a >
15+ < ul class ="sub-menu collapse " id ="{{ app_verbose_name|slugify }}-dropdown " aria-expanded ="false " style ="height: 0; ">
16+ {% for model in models %}
17+ < li > < a href ="#{{ model.verbose_name }}-list "> {{ model.verbose_name|title }}</ a > </ li >
18+ {% endfor %}
19+ </ ul >
1420 </ li >
15- < ul class ="sub-menu collapse " id ="{{ app_verbose_name|slugify }}-dropdown " aria-expanded ="false " style ="height: 0; ">
16- {% for model in models %}
17- < li > < a href ="#{{ model.verbose_name }}-list "> {{ model.verbose_name|title }}</ a > </ li >
18- {% endfor %}
19- </ ul >
2021 {% endfor %}
2122 </ ul >
2223 </ div >
@@ -67,15 +68,18 @@ <h4>Long description:</h4>
6768 </ div >
6869
6970 < script >
70- // Turns the menu into an accordion-like menu to avoid overflow issues
71- $ ( '#menu-content' ) . on ( 'show.bs.collapse' , function ( ) {
72- $ ( '.sub-menu' ) . collapse ( 'hide' ) ;
73- } ) ;
71+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
72+ // Turns the menu into an accordion-like menu to avoid overflow issues
73+ $ ( '#menu-content' ) . on ( 'show.bs.collapse' , function ( ) {
74+ $ ( '.sub-menu' ) . collapse ( 'hide' ) ;
75+ } ) ;
7476
75- // Change the page location on left menu main section click
76- $ ( 'ul#menu-content li[data-bs-toggle="collapse"]' ) . on ( 'click' , function ( ) {
77- let target = $ ( this ) . data ( 'target' ) . replace ( '-dropdown' , '' ) ;
78- window . location . replace ( target ) ;
77+ document . querySelectorAll ( 'ul#menu-content li[data-toggle="collapse"]' ) . forEach ( item => {
78+ item . addEventListener ( 'click' , function ( ) {
79+ const target = this . getAttribute ( 'data-target' ) . replace ( '-dropdown' , '' ) ;
80+ window . location . replace ( target ) ;
81+ } ) ;
82+ } ) ;
7983 } ) ;
8084 </ script >
8185{% endblock %}
0 commit comments