fix: Make sure we do not have spaces in HTML ID

pull/771/head
Raphaël Vinot 2023-08-29 18:24:51 +02:00
parent 69b8d08d44
commit 6a6ac01f3f
3 changed files with 7 additions and 6 deletions

View File

@ -9,7 +9,7 @@
</br>
<div class="btn-group" role="group" aria-label="MISP Selector" id="mispSelector">
{%for name in misps_occurrences %}
<button type="button" value="{{name}}" class="btn btn-outline-primary {%if name == current_misp%}active{%endif%}" href="#">{{name}}</a></li>
<button type="button" value="{{name.replace(' ', '_')}}" class="btn btn-outline-primary {%if name == current_misp%}active{%endif%}" href="#">{{name}}</a></li>
{%endfor%}
</div>
{%endif%}
@ -17,7 +17,7 @@
<div id="allInstances">
{% for name, occurrences in misps_occurrences.items() %}
<div id="{{name}}" {%if name != current_misp%}style="display:none"{%endif%}>
<div id="{{name.replace(' ', '_')}}" {%if name != current_misp%}style="display:none"{%endif%}>
{% set hits, root_url = occurrences %}
{% if hits %}
<ul>

View File

@ -4,7 +4,8 @@
</br>
<div class="btn-group" role="group" aria-label="MISP Selector" id="mispSelector">
{%for name in misp_instances_settings %}
<button type="button" value="{{name}}" class="btn btn-outline-primary {%if name == current_misp%}active{%endif%}" href="#">{{name}}</a></li>
<button type="button" value="{{name.replace(' ', '_')}}"
class="btn btn-outline-primary {%if name == current_misp%}active{%endif%}" href="#">{{name}}</a></li>
{%endfor%}
</div>
</center>
@ -12,7 +13,7 @@
<div id="allInstances">
{%for name, misp_settings in misp_instances_settings.items() %}
<div id="{{name}}" {%if name != current_misp%}style="display:none"{%endif%}>
<div id="{{name.replace(' ', '_')}}" {%if name != current_misp%}style="display:none"{%endif%}>
<form role="form" action="{{ url_for('web_misp_push_view', tree_uuid=tree_uuid) }}"
method=post enctype=multipart/form-data>
<label for="misp_instance_name" class="col-sm-2 col-form-label">Submit event to:</label>

View File

@ -98,7 +98,7 @@
$('#mispSelector button').on('click', function(e){
var thisBtn = $(this);
thisBtn.addClass('active').siblings().removeClass('active');
$('#'+thisBtn.val()).show().siblings().hide()
$(`#${thisBtn.val()}`).show().siblings().hide()
});
});
});
@ -111,7 +111,7 @@
$('#mispSelector button').on('click', function(e){
var thisBtn = $(this);
thisBtn.addClass('active').siblings().removeClass('active');
$('#'+thisBtn.val()).show().siblings().hide()
$(`#${thisBtn.val()}`).show().siblings().hide()
});
});
});