@@ -126,44 +126,53 @@ <h1 class="text-center my-4">{% block title %}Tables{% endblock %}</h1>
126
126
</ div >
127
127
</ div >
128
128
129
- < div class ="modal " id ="infoModal " style ="display:none; ">
130
- < div class ="modal-content ">
131
- < span class ="close " onclick ="closeModal() "> ×</ span >
132
- < div id ="modal-body "> </ div >
129
+ < div class ="modal fade " id ="infoModal " tabindex ="-1 " role ="dialog " aria-labelledby ="infoModalLabel " aria-hidden ="true ">
130
+ < div class ="modal-dialog " role ="document ">
131
+ < div class ="modal-content ">
132
+ < div class ="modal-header ">
133
+ < h5 class ="modal-title " id ="infoModalLabel "> Information</ h5 >
134
+ < button type ="button " class ="close " data-dismiss ="modal " aria-label ="Close ">
135
+ < span aria-hidden ="true "> ×</ span >
136
+ </ button >
133
137
</ div >
138
+ < div class ="modal-body " id ="modal-body ">
139
+
140
+ </ div >
141
+ </ div >
142
+ </ div >
134
143
</ div >
135
144
136
145
137
146
< script type ="text/javascript ">
138
147
139
148
$ ( document ) . on ( 'click' , '.btn-icon' , function ( ) {
140
- var button = $ ( this ) ;
141
- if ( button . closest ( 'li' ) . has ( 'a' ) . length > 0 ) {
142
- var tableId = button . closest ( 'li' ) . find ( 'a' ) . attr ( 'href' ) . split ( '/' ) [ 2 ] ; // Предположим, что URL структурирован таким образом
143
- showTableInfo ( tableId ) ;
144
- } else {
145
- var dirId = button . data ( 'dir-id' ) ;
146
- showDirInfo ( dirId ) ;
147
- }
148
- } ) ;
149
-
150
- function showDirInfo ( dirId ) {
151
- fetch ( `/get-dir-info/${ dirId } ` )
152
- . then ( response => response . text ( ) )
153
- . then ( html => {
154
- document . getElementById ( 'modal-body' ) . innerHTML = html ;
155
- document . getElementById ( 'infoModal' ) . style . display = 'block' ;
149
+ var button = $ ( this ) ;
150
+ if ( button . closest ( 'li' ) . has ( 'ul' ) . length > 0 ) {
151
+ var dirId = button . closest ( 'li' ) . data ( 'dir-id' ) ;
152
+ showDirInfo ( dirId ) ;
153
+ } else {
154
+ var tableId = button . closest ( 'li' ) . find ( 'a' ) . attr ( 'data-table-id' ) ;
155
+ showTableInfo ( tableId ) ;
156
+ }
156
157
} ) ;
157
- }
158
158
159
- function showTableInfo ( tableId ) {
160
- fetch ( `/get-table-info/${ tableId } ` )
161
- . then ( response => response . text ( ) )
162
- . then ( html => {
163
- document . getElementById ( 'modal-body' ) . innerHTML = html ;
164
- document . getElementById ( 'infoModal' ) . style . display = 'block' ;
165
- } ) ;
166
- }
159
+ function showDirInfo ( dirId ) {
160
+ fetch ( `/get-dir-info/${ dirId } ` )
161
+ . then ( response => response . text ( ) )
162
+ . then ( html => {
163
+ $ ( '#modal-body' ) . html ( html ) ;
164
+ $ ( '#infoModal' ) . modal ( 'show' ) ;
165
+ } ) ;
166
+ }
167
+
168
+ function showTableInfo ( tableId ) {
169
+ fetch ( `/get-table-info/${ tableId } ` )
170
+ . then ( response => response . text ( ) )
171
+ . then ( html => {
172
+ $ ( '#modal-body' ) . html ( html ) ;
173
+ $ ( '#infoModal' ) . modal ( 'show' ) ;
174
+ } ) ;
175
+ }
167
176
168
177
function closeModal ( ) {
169
178
document . getElementById ( 'infoModal' ) . style . display = 'none' ;
0 commit comments