Skip to content

Commit a6ed21f

Browse files
flodoloTheoChevalier
authored andcommitted
(fixes #855) Display warning when search has trailing or leadingwhitespaces (#887)
1 parent 3779b04 commit a6ed21f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

app/views/results_strings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
<?php
1010
endif;
1111

12+
if ($search->getSearchTerms() != trim($search->getSearchTerms())) {
13+
parse_str($_SERVER['QUERY_STRING'], $args);
14+
$args['recherche'] = trim($search->getSearchTerms());
15+
$query = urldecode(http_build_query($args));
16+
echo '<p id="search_warning"><strong>Warning:</strong> the current search includes leading or trailing whitespaces.<br/> <a href="/?'
17+
. $query . '">Click here</a> to perform the same search without whitespaces.</p>';
18+
}
19+
1220
foreach ($output as $results_table) {
1321
print $results_table;
1422
}

web/style/transvision.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,17 @@ h3 {
327327
display: block;
328328
}
329329

330+
#search_warning {
331+
margin: 0 auto;
332+
text-align: center;
333+
width: 75%;
334+
margin-top: 15px;
335+
}
336+
337+
#search_warning strong {
338+
color: #ed3860;
339+
}
340+
330341
/* Tables */
331342

332343
table {

0 commit comments

Comments
 (0)