From dfb72423ed82a293eec85b1b36d9e4c895d7b49c Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 12 Jan 2013 18:05:04 +0100 Subject: o Implementing search on people page. --- src/main/resources/webapp/apps/app.js | 4 ++- .../webapp/apps/core/PagingTableService.js | 18 ++++++++++-- .../webapp/apps/frontPageApp/buildList.html | 34 ++++++++++------------ .../webapp/apps/frontPageApp/frontPageApp.js | 4 +++ .../webapp/apps/frontPageApp/personList.html | 11 +++++++ 5 files changed, 49 insertions(+), 22 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/webapp/apps/app.js b/src/main/resources/webapp/apps/app.js index 068f454..960f704 100755 --- a/src/main/resources/webapp/apps/app.js +++ b/src/main/resources/webapp/apps/app.js @@ -92,6 +92,8 @@ directives.directive('personAvatar', function () { scope: { person: '=person' }, - template: '' + template: '' + + '' + + '' } }); diff --git a/src/main/resources/webapp/apps/core/PagingTableService.js b/src/main/resources/webapp/apps/core/PagingTableService.js index af593df..f550a39 100755 --- a/src/main/resources/webapp/apps/core/PagingTableService.js +++ b/src/main/resources/webapp/apps/core/PagingTableService.js @@ -4,12 +4,13 @@ function PagingTableService() { var watcher = options.watcher || function(){}; var self = { rows: [], + query: "", startIndex: options.startIndex || 0, count: options.count || 10 }; var update = function(){ - fetchCallback(self.startIndex, self.count, function(data) { + fetchCallback(self.startIndex, self.count, self.query, function(data) { self.rows = data.rows; watcher(); }); @@ -33,6 +34,16 @@ function PagingTableService() { update(); }; + self.onSearch = function () { + console.log("search: " + self.query); + update(); + }; + + self.onSearchChange = function () { + console.log("search: " + self.query); + update(); + }; + // Do an initial fetch update(); @@ -41,13 +52,16 @@ function PagingTableService() { var defaultCallback = function(Resource, args) { args = args || {}; - return function(startIndex, count, cb) { + return function(startIndex, count, query, cb) { if(startIndex) { args.startIndex = startIndex; } if(count) { args.count = count; } + if(query) { + args.query = query; + } console.log("fetching", args); Resource.query(args, function(data, headers) { var totalResults = headers("total-results"); diff --git a/src/main/resources/webapp/apps/frontPageApp/buildList.html b/src/main/resources/webapp/apps/frontPageApp/buildList.html index 13a1dc3..c6196d4 100755 --- a/src/main/resources/webapp/apps/frontPageApp/buildList.html +++ b/src/main/resources/webapp/apps/frontPageApp/buildList.html @@ -16,27 +16,23 @@ } +
+
+

+ {{build.build.timestamp | date:'medium'}}: + SUCCESS + FAILURE +

+ +

Participants

+ + + +
+
+
- - - - - - - - - - - -
{{build.build.timestamp | date:'medium'}} - SUCCESS - FAILURE -
- - - -