From 0b9e09b600268b9bb762e78589d0f8a0e628cdcf Mon Sep 17 00:00:00 2001 From: Meutel Date: Sat, 14 Jan 2017 18:48:08 +0100 Subject: [PATCH] Search form --- search.html | 41 +++++++++++++++++++++++++++++++++++++---- search.js | 15 +++++++++++++-- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/search.html b/search.html index 0e0d6d8..17d26a1 100644 --- a/search.html +++ b/search.html @@ -26,17 +26,50 @@
-
-

Recherche

+
+
+

Recherche

+
+
+
+
+ +
+
+
+ + + + +
+
+
+ +

Cocher pour rechercher les élements contenant tous les mots saisis

+
+
+ +
+

{{ booksCount }}

diff --git a/search.js b/search.js index 2547ebb..7fac97a 100644 --- a/search.js +++ b/search.js @@ -69,17 +69,28 @@ var app = new Vue({ this.sendQuery(this.searchParams('cgi-bin/bouquins/books'), this.stdError, this.searchBooksSuccess); }, searchAll: function() { + this.clear(); + this.searchBooks(); + }, + clear: function() { this.authors = []; this.books = []; this.series = []; this.booksCount = 0; - this.searchBooks(); + }, + searchFull: function() { + if (document.getElementById("q").value) { + this.clear(); + this.terms = document.getElementById("q").value.split(' '); + // TODO criteria + this.searchBooks(); + } }, searchUrl: function() { if (this.urlParams.q) { this.terms = this.urlParams.q.split(' '); this.searchAll(); - // TODO copy in form + document.getElementById("q").value = this.urlParams.q; } } },