This is an automated email from the git hooks/post-receive script. New change to branch feature/6010-search-document in repository coselmar. See http://git.codelutin.com/coselmar.git from 25d72d3 add remove function for document new 12bbb7c enable document search on ui new 4e6da96 prepare service for search in documents The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 4e6da969af4dfaba7655e2467bfa0d0679c351bc Author: Yannick Martel <martel@©odelutin.com> Date: Sat Nov 8 12:47:43 2014 +0100 prepare service for search in documents commit 12bbb7c070d268d6fd35e00fa6104802f1855bc3 Author: Yannick Martel <martel@©odelutin.com> Date: Sat Nov 8 12:12:44 2014 +0100 enable document search on ui Summary of changes: .../coselmar/services/v1/DocumentsWebService.java | 9 +++++++-- .../src/main/webapp/js/coselmar-controllers.js | 19 ++++++++++++++++--- coselmar-ui/src/main/webapp/js/coselmar-services.js | 6 ++---- coselmar-ui/src/main/webapp/views/documents.html | 12 +++++++++++- 4 files changed, 36 insertions(+), 10 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6010-search-document in repository coselmar. See http://git.codelutin.com/coselmar.git commit 12bbb7c070d268d6fd35e00fa6104802f1855bc3 Author: Yannick Martel <martel@©odelutin.com> Date: Sat Nov 8 12:12:44 2014 +0100 enable document search on ui --- .../src/main/webapp/js/coselmar-controllers.js | 19 ++++++++++++++++--- coselmar-ui/src/main/webapp/js/coselmar-services.js | 6 ++---- coselmar-ui/src/main/webapp/views/documents.html | 12 +++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 0fe4ced..d3a85d2 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -4,7 +4,17 @@ var coselmarControllers = angular.module('coselmarControllers', []); coselmarControllers.controller("HomeCtrl", ['$scope', function($scope){ }]); // Controller for All Documents View -coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', 'documentService', function($scope, $route, documentService){ +coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', '$routeParams', '$location', 'documentService', function($scope, $route, $routeParams, $location, documentService){ + + //manage keywords if given + $scope.searchKeywords = []; + var keywords = $routeParams.keywords; + if (Array.isArray(keywords)) { + $scope.searchKeywords = keywords; + } else if (keywords) { + $scope.searchKeywords.push(keywords); + } + documentService.getDocuments($scope); $scope.deleteDocument = function(documentId){ @@ -14,10 +24,13 @@ coselmarControllers.controller("DocumentsCtrl", ['$scope', '$route', 'documentSe // Go back to documents list $route.reload(); }); + }; - // Reload the page + $scope.searchDocuments = function(){ +// $route.current.params.keywords = $scope.searchKeywords; // $route.reload(); - }; + $location.search('keywords', $scope.searchKeywords); + } }]); diff --git a/coselmar-ui/src/main/webapp/js/coselmar-services.js b/coselmar-ui/src/main/webapp/js/coselmar-services.js index 3ff7fca..fec056c 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-services.js @@ -44,9 +44,6 @@ function Document(resource){ // Load the document var docResource = resource('http://localhost:8081/services/v1/documents/:documentId', {documentId:'@id'}); // var docResource = resource('v1/documents/:documentId', {documentId:'@documentId'}); -// docResource.delete({documentId:id}, function(){ -// route.reload(); -// }); docResource.delete({documentId:id}, successFunction); } @@ -62,7 +59,8 @@ function Document(resource){ this.getDocuments = function(scope){ // Load all documents console.log("loading all documents"); - var docResource = resource('http://localhost:8081/services/v1/documents'); + + var docResource = resource('http://localhost:8081/services/v1/documents', {searchKeywords : scope.searchKeywords}); // var docResource = resource('v1/documents'); docResource.query(function(documents){ scope.documents = documents; diff --git a/coselmar-ui/src/main/webapp/views/documents.html b/coselmar-ui/src/main/webapp/views/documents.html index 0c1426f..7403ae7 100644 --- a/coselmar-ui/src/main/webapp/views/documents.html +++ b/coselmar-ui/src/main/webapp/views/documents.html @@ -8,7 +8,17 @@ <div> <div> - <a href="#/documents/new" class="btn btn-primary">Add a document</a> + <div class="form-group"> + <a href="#/documents/new" class="form-inline navbar-left btn btn-primary">Add a document</a> + </div> + <form class="form-inline pull-right" role="documentOptions" ng-submit="searchDocuments()"> + <div class="form-group"> + <input type="search" class="form-control" placeholder="Search a document" ng-model="searchKeywords" ng-list /> + </div> + <div class="form-group"> + <button type="submit" class="btn btn-default glyphicon glyphicon-search"></button> + </div> + </form> </div> <table class="table"> <tr> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6010-search-document in repository coselmar. See http://git.codelutin.com/coselmar.git commit 4e6da969af4dfaba7655e2467bfa0d0679c351bc Author: Yannick Martel <martel@©odelutin.com> Date: Sat Nov 8 12:47:43 2014 +0100 prepare service for search in documents --- .../fr/ifremer/coselmar/services/v1/DocumentsWebService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java index 4489174..f3cf869 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java @@ -42,9 +42,14 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { return documentBean; } - public List<DocumentBean> getDocuments() { + public List<DocumentBean> getDocuments(List<String> searchKeywords) { - List<Document> documentList = getDocumentDao().findAll(); + List<Document> documentList; + if (searchKeywords != null && !searchKeywords.isEmpty()) { + documentList = getDocumentDao().forContains(Document.PROPERTY_KEYWORDS, searchKeywords).findAll(); + } else { + documentList = getDocumentDao().findAll(); + } List<DocumentBean> result = new ArrayList<>(documentList.size()); for (Document document : documentList) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm