From 00452cc50523ff2e0b92eb99a7d13cd85bea764f Mon Sep 17 00:00:00 2001 From: Benjamin Gamard Date: Mon, 13 Nov 2017 22:37:03 +0100 Subject: [PATCH] Closes #158: advanced search form --- .../src/app/docs/controller/document/Document.js | 12 ++++++++---- docs-web/src/main/webapp/src/locale/fr.json | 9 +++++++++ .../src/main/webapp/src/partial/docs/document.html | 6 +++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js b/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js index d75f084f..e0798cef 100644 --- a/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js +++ b/docs-web/src/main/webapp/src/app/docs/controller/document/Document.js @@ -3,7 +3,7 @@ /** * Document controller. */ -angular.module('docs').controller('Document', function ($scope, $rootScope, $timeout, $state, Restangular, $q) { +angular.module('docs').controller('Document', function ($scope, $rootScope, $timeout, $state, Restangular, $q, $filter) { /** * Scope variables. */ @@ -189,11 +189,15 @@ angular.module('docs').controller('Document', function ($scope, $rootScope, $tim if (!_.isEmpty($scope.advsearch.language)) { search += 'lang:' + $scope.advsearch.language + ' '; } - $scope.advsearch.after_date; - $scope.advsearch.before_date; + if (!_.isUndefined($scope.advsearch.after_date)) { + search += 'after:' + $filter('date')($scope.advsearch.after_date, 'yyyy-MM-dd') + ' '; + } + if (!_.isUndefined($scope.advsearch.before_date)) { + search += 'before:' + $filter('date')($scope.advsearch.before_date, 'yyyy-MM-dd') + ' '; + } if (!_.isEmpty($scope.advsearch.tags)) { search += _.reduce($scope.advsearch.tags, function(s, t) { - return s + 'tag:' + t + ' '; + return s + 'tag:' + t.name + ' '; }, ''); } $scope.search = search; diff --git a/docs-web/src/main/webapp/src/locale/fr.json b/docs-web/src/main/webapp/src/locale/fr.json index 25c4eb10..b9fdbdb0 100644 --- a/docs-web/src/main/webapp/src/locale/fr.json +++ b/docs-web/src/main/webapp/src/locale/fr.json @@ -22,6 +22,15 @@ "logout": "Déconnexion" }, "document": { + "search_simple": "Recherche simple", + "search_fulltext": "Recherche texte intégral", + "search_creator": "Créateur", + "search_language": "Langue", + "search_before_date": "Avant cette date", + "search_after_date": "Après cette date", + "search_tags": "Tags", + "search_clear": "Réinitialiser", + "any_language": "Toutes les langues", "add_document": "Ajouter un document", "tags": "Tags", "no_tags": "Aucun tag", diff --git a/docs-web/src/main/webapp/src/partial/docs/document.html b/docs-web/src/main/webapp/src/partial/docs/document.html index 86bd4f4a..694a3564 100644 --- a/docs-web/src/main/webapp/src/partial/docs/document.html +++ b/docs-web/src/main/webapp/src/partial/docs/document.html @@ -72,7 +72,7 @@ datepicker-append-to-body="true" ng-readonly="true" uib-datepicker-popup="{{ dateFormat }}" class="form-control" ng-model="advsearch.after_date" datepicker-options="{ startingDay:1, showWeeks: false }" - ng-click="datepickerAfterOpened = true" is-open="datepickerAfterOpened" /> + ng-click="datepickerAfterOpened = !datepickerAfterOpened" is-open="datepickerAfterOpened" /> @@ -87,7 +87,7 @@ datepicker-append-to-body="true" ng-readonly="true" uib-datepicker-popup="{{ dateFormat }}" class="form-control" ng-model="advsearch.before_date" datepicker-options="{ startingDay:1, showWeeks: false }" - ng-click="datepickerBeforeOpened = true" is-open="datepickerBeforeOpened" /> + ng-click="datepickerBeforeOpened = !datepickerBeforeOpened" is-open="datepickerBeforeOpened" /> @@ -113,7 +113,7 @@ - {{advsearch}} + {{advsearch.before_date | date: 'yyyy-MM-dd'}}