Skip to content

Commit

Permalink
Fix: remove html i tag for taxon search input
Browse files Browse the repository at this point in the history
Fix #405.
  • Loading branch information
jpm-cbna committed Dec 7, 2023
1 parent 5a918b1 commit e66d39b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
7 changes: 7 additions & 0 deletions atlas/static/css/atlas.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ a {
padding-right: 20px;
}

#searchTaxons,
#searchCommunes {
min-width: 175px;
width: 20vw;
max-width: 400px;
}

@media (max-width: 760px) {
.navbar-collapse {
background-color: #333;
Expand Down
18 changes: 9 additions & 9 deletions atlas/static/custom/templates/navbar.html.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% block navbar %}
{% if configuration.MULTILINGUAL %}
<script type="text/javascript">
var language = '{{ '/' + g.lang_code }}';
<script type="text/javascript">
var language = '{{ '/' + g.lang_code }}';
</script>
{% else %}
<script type="text/javascript">
<script type="text/javascript">
var language = '' ;
</script>
{% endif %}
Expand All @@ -31,7 +31,7 @@
<form method="POST" action="" id='searchFormTaxons' role="search">
<div class="form-group has-feedback">
<input id="searchTaxons" type="text" class="form-control mr-sm-2 ajax-search small-placeholder"
placeholder="{{ _('search.species') }}&nbsp;&nbsp;&nbsp;" loading="false" style="width: 175px;" />
placeholder="{{ _('search.species') }}&nbsp;&nbsp;&nbsp;" loading="false" />

</div>
<input id="hiddenInputTaxons" type="hidden"name="cd_ref"/>
Expand All @@ -42,7 +42,7 @@
action=""
role="search">
<div class="form-group has-feedback">
<input id="searchCommunes" type="text" style="width: 175px;"
<input id="searchCommunes" type="text"
class="form-control mr-sm-2 ajax-search small-placeholder"
placeholder="{{ _('search.city') }}&nbsp;&nbsp;&nbsp;">
</div>
Expand All @@ -54,23 +54,23 @@
<a class="nav-link dropdown-toggle" id="dropdown09" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<!-- Display languages flags and name, en flag is flag-icon flag-icon-gb-->
<container style="display: inline-flex;">
<span class="{{ 'flag-icon ' + configuration.AVAILABLE_LANGUAGES[g.lang_code]['flag_icon']}}" class="align-middle"></span>
<span class="{{ 'flag-icon ' + configuration.AVAILABLE_LANGUAGES[g.lang_code]['flag_icon']}}" class="align-middle"></span>
<div class="d-lg-block d-sm-none">&nbsp;&nbsp;{{ configuration.AVAILABLE_LANGUAGES[g.lang_code]['name'] }}</div>
</container>
</a>
<div class="dropdown-menu" aria-labelledby="dropdown09">
{% for language in configuration.AVAILABLE_LANGUAGES %}
<a class="dropdown-item" href="{{url_for(request.endpoint, lang_code=language, **request.view_args)}}">
<container style="display: inline-flex;">
<span class="{{ 'flag-icon ' + configuration.AVAILABLE_LANGUAGES[language]['flag_icon']}}"> </span>
<span class="{{ 'flag-icon ' + configuration.AVAILABLE_LANGUAGES[language]['flag_icon']}}"> </span>
<div class="d-lg-block d-sm-none">&nbsp;&nbsp;{{ configuration.AVAILABLE_LANGUAGES[language]['name'] }}</div>
</container>
</a>
{% endfor %}
</div>
</div>
{% endif %}

{% if configuration.EXTENDED_AREAS %}
{% include 'templates/core/extended_areas_search.html' %}
{% endif %}
Expand All @@ -79,4 +79,4 @@

</nav>

{% endblock %}
{% endblock %}
7 changes: 5 additions & 2 deletions atlas/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ autocompleteSearch = function(inputID, urlDestination, nbProposal) {
focus: function(event, ui) {
return false;
},
select: function(event, ui) {
$(inputID).val(ui.item.label);
select: function (event, ui) {
let splited_label = ui.item.label.split(' = ');
let label_for_input = splited_label[0] != '' ? splited_label[0] : splited_label[1];
$(inputID).val(label_for_input.replace(/<[^>]*>?/gm, ''));

var url = ui.item.value;
if (urlDestination == "espece") {
location.href = configuration.URL_APPLICATION + language + "/espece/" + url;
Expand Down

0 comments on commit e66d39b

Please sign in to comment.