Skip to content

Commit

Permalink
Amélioration de la recherche par texte sur le tableau de suivi (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ynote authored Nov 5, 2024
1 parent e6c3b8f commit 5fd8507
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 186 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@types/d3-fetch": "^3.0.7",
"@types/lunr": "^2.3.7",
"@types/minimist": "^1.2.5",
"@types/node": "^22.3.0",
"@types/page": "^1.11.9",
Expand Down Expand Up @@ -54,6 +55,8 @@
"fastify": "^4.26.2",
"knex": "^3.1.0",
"ky": "^1.7.2",
"lunr": "^2.3.9",
"lunr-languages": "^1.14.0",
"minimist": "^1.2.8",
"ods-xlsx": "github:DavidBruant/ods-xlsx#v0.8.0",
"page": "^1.11.6",
Expand Down
12 changes: 11 additions & 1 deletion scripts/commun/manipulationStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ export function normalizeTexteEspèce(texte){
.replace(/[\u0300-\u036f]/g, '') // remove accents
.replaceAll("’", "'")
.toLowerCase()
}
}

/**
*
* @param {string} texte
* @returns {string}
*/
export function retirerAccents(texte) {
return texte.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
}

51 changes: 51 additions & 0 deletions scripts/front-end/components/BarreRecherche.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script>
//@ts-check
import { createEventDispatcher } from "svelte";
/** @type {string} */
export let titre
let valeur = ""
const dispatch = createEventDispatcher()
/**
*
* @param {SubmitEvent} e
*/
function onMettreÀJourValeurSélectionnée(e) {
e.preventDefault()
dispatch("selected-changed", valeur)
valeur = ""
}
</script>

<form on:submit={onMettreÀJourValeurSélectionnée} role="search">
<div class="form-recherche">
<label class="sr-only" for="recherche-texte">{titre}</label>
<input type="text" name="recherche-texte" id="recherche-texte" placeholder="{titre}" class="fr-input" bind:value={valeur} />
<button class="fr-btn" type="submit">Chercher</button>
</div>

<p class="fr-hint-text">Vous pouvez rechercher par départements, communes, nom de projet, porteur de projet, activité principale, numéro de dossier, numéro Onagre.</p>
</form>

<style lang="scss">
.form-recherche {
display: flex;
width: 70%;
}
.sr-only {
border: none;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(50%);
height: 1px;
margin: -1px;
width: 1px;
overflow: hidden;
position: absolute !important;
word-wrap: normal !important;
}
</style>
1 change: 1 addition & 0 deletions scripts/front-end/components/FiltreParmiOptions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<style lang="scss">
details {
display: inline;
margin-right: 0.5rem;
}
.filtre-options {
Expand Down
62 changes: 0 additions & 62 deletions scripts/front-end/components/FiltreTexte.svelte

This file was deleted.

Loading

0 comments on commit 5fd8507

Please sign in to comment.