diff --git a/bower.json b/bower.json
index 63ce4b9..91886b7 100644
--- a/bower.json
+++ b/bower.json
@@ -15,7 +15,8 @@
"lodash": "~2.4.1",
"angular-ui-router": "~0.2.10",
"c3": "~0.4.9",
- "angular-ui-select": "*"
+ "angular-ui-select": "*",
+ "angular-utils-pagination": "*"
},
"devDependencies": {
"angular-mocks": ">=1.2.*",
diff --git a/client/app/app.js b/client/app/app.js
index 9dc56d1..9f881df 100644
--- a/client/app/app.js
+++ b/client/app/app.js
@@ -6,7 +6,8 @@ angular.module('tikrApp', [
'ngSanitize',
'ui.router',
'ui.bootstrap',
- 'ui.select'
+ 'ui.select',
+ 'angularUtils.directives.dirPagination'
])
.config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
$urlRouterProvider
diff --git a/client/app/search/search.controller.js b/client/app/search/search.controller.js
index 0ddf43e..8974dd2 100644
--- a/client/app/search/search.controller.js
+++ b/client/app/search/search.controller.js
@@ -4,12 +4,15 @@ angular.module('tikrApp')
.controller('SearchCtrl', function($scope, $http, $q, User, Auth) {
$scope.users = [];
$scope.searchStarted = false;
+ $scope.selected = 'javascript';
// returns a promise
- $scope.fetchUsers = function(language) {
+ $scope.fetchUsers = function(language, pageNumber) {
+ $scope.selected = language;
User.search({
skill: language,
- username: $scope.TEST_USER || Auth.getCurrentUser().github.login
+ username: $scope.TEST_USER || Auth.getCurrentUser().github.login,
+ pageNumber: pageNumber
}, function(data) {
$scope.searchStarted = true;
$scope.data = data[0];
@@ -48,5 +51,5 @@ angular.module('tikrApp')
};
//init
- $scope.fetchUsers('javascript');
+ $scope.fetchUsers($scope.selected);
});
diff --git a/client/app/search/search.html b/client/app/search/search.html
index b99ce87..42ebcdc 100644
--- a/client/app/search/search.html
+++ b/client/app/search/search.html
@@ -36,7 +36,8 @@
diff --git a/client/components/auth/user.service.js b/client/components/auth/user.service.js
index 33a450b..921e3cc 100644
--- a/client/components/auth/user.service.js
+++ b/client/components/auth/user.service.js
@@ -25,7 +25,8 @@ angular.module('tikrApp')
id: 'me',
controller: 'search',
skill: null,
- username: null
+ username: null,
+ pageNumber: 1
}
}
});
diff --git a/client/components/pagination/dirPagination.tpl.html b/client/components/pagination/dirPagination.tpl.html
new file mode 100644
index 0000000..238f26e
--- /dev/null
+++ b/client/components/pagination/dirPagination.tpl.html
@@ -0,0 +1,18 @@
+
diff --git a/client/index.html b/client/index.html
index 3ee368c..03185d4 100644
--- a/client/index.html
+++ b/client/index.html
@@ -71,6 +71,7 @@
+
diff --git a/karma.conf.js b/karma.conf.js
index 8931b1b..0e379cd 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -22,6 +22,8 @@ module.exports = function(config) {
'client/bower_components/angular-ui-router/release/angular-ui-router.js',
'client/bower_components/angular-ui-select/dist/select.js',
'client/bower_components/angular-ui-select/dist/select.css',
+ 'client/bower_components/angular-utils-pagination/dirPagination.js',
+ 'client/bower_components/angular-utils-pagination/dirPagination.tpl.html',
'client/app/app.js',
'client/app/**/*.js',
'client/app/**/*.coffee',
diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js
index 3f8523c..64e423f 100644
--- a/server/api/user/user.controller.js
+++ b/server/api/user/user.controller.js
@@ -138,7 +138,7 @@ var getUsersPromise = function(users, username) {
*/
exports.search = function(req, res, next) {
var options = {
- url: 'https://api.github.com/search/users?q=+language:' + encodeURIComponent(req.body.skill) + "&page=1&per_page=10",
+ url: 'https://api.github.com/search/users?q=+language:' + encodeURIComponent(req.body.skill) + "&page=" + req.body.pageNumber + "&per_page=10",
headers: {
'User-Agent': req.body.username
}