Skip to content

Commit 4b5152a

Browse files
fix invalid modal ID (indices list)
1 parent 4dacb81 commit 4b5152a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

templates/Modules/index/index_read_search_list.html.twig

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
{% set sortUrl = path('indices_read_search', {'index': index.name}|merge(app.request.query.all|filter((v, k) => k != 'sort'))) %}
55

6+
{% set modalReference = 0 %}
7+
68
{% block thead %}
79
<tr>
810
<th>&nbsp;</th>
@@ -29,15 +31,15 @@
2931
{% for row in documents.rows %}
3032
<tr>
3133
<td>
32-
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal{{ row['_id'] }}">
34+
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal{{ modalReference }}">
3335
{{ 'source'|trans }}
3436
</button>
3537

36-
<div class="modal fade" id="modal{{ row['_id'] }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ row['_id'] }}" aria-hidden="true">
38+
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
3739
<div class="modal-dialog modal-xl">
3840
<div class="modal-content bg-dark">
3941
<div class="modal-header">
40-
<h5 class="modal-title" id="modalLabel{{ row['_id'] }}">#{{ row['_id'] }} ({{ 'source'|trans }})</h5>
42+
<h5 class="modal-title" id="modalLabel{{ modalReference }}">#{{ row['_id'] }} ({{ 'source'|trans }})</h5>
4143
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="{{ 'close'|trans }}"></button>
4244
</div>
4345
<div class="modal-body">
@@ -49,6 +51,7 @@
4951
</div>
5052
</div>
5153
</div>
54+
{% set modalReference = modalReference + 1 %}
5255
</td>
5356
<td>
5457
{{ row['_id'] }}
@@ -75,15 +78,15 @@
7578
{% endfor %}
7679
</ul>
7780
{% else %}
78-
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal{{ row['_id'] }}{{ field }}">
81+
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal{{ modalReference }}">
7982
{{ 'array'|trans }}
8083
</button>
8184

82-
<div class="modal fade" id="modal{{ row['_id'] }}{{ field }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ row['_id'] }}{{ field }}" aria-hidden="true">
85+
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
8386
<div class="modal-dialog modal-xl">
8487
<div class="modal-content bg-dark">
8588
<div class="modal-header">
86-
<h5 class="modal-title" id="modalLabel{{ row['_id'] }}{{ field }}">#{{ row['_id'] }} ({{ field }})</h5>
89+
<h5 class="modal-title" id="modalLabel{{ modalReference }}">#{{ row['_id'] }} ({{ field }})</h5>
8790
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="{{ 'close'|trans }}"></button>
8891
</div>
8992
<div class="modal-body">
@@ -95,19 +98,20 @@
9598
</div>
9699
</div>
97100
</div>
101+
{% set modalReference = modalReference + 1 %}
98102
{% endif %}
99103
{% endif %}
100104
{% else %}
101105
{% if 500 < value|length %}
102-
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal{{ row['_id'] }}{{ field }}">
106+
<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal{{ modalReference }}">
103107
{{ 'long_text'|trans }}
104108
</button>
105109

106-
<div class="modal fade" id="modal{{ row['_id'] }}{{ field }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ row['_id'] }}{{ field }}" aria-hidden="true">
110+
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
107111
<div class="modal-dialog modal-xl">
108112
<div class="modal-content bg-dark">
109113
<div class="modal-header">
110-
<h5 class="modal-title" id="modalLabel{{ row['_id'] }}{{ field }}">#{{ row['_id'] }} ({{ field }})</h5>
114+
<h5 class="modal-title" id="modalLabel{{ modalReference }}">#{{ row['_id'] }} ({{ field }})</h5>
111115
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="{{ 'close'|trans }}"></button>
112116
</div>
113117
<div class="modal-body">
@@ -119,6 +123,7 @@
119123
</div>
120124
</div>
121125
</div>
126+
{% set modalReference = modalReference + 1 %}
122127
{% else %}
123128
{{ value }}
124129
{% endif %}

0 commit comments

Comments
 (0)