forked from FatalBadgers/tikr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(FatalBadgers#1) Search by language. Show username and profile pic.
- Loading branch information
1 parent
805249a
commit 19701f7
Showing
8 changed files
with
110 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
'use strict'; | ||
|
||
angular.module('tikrApp') | ||
.controller('SearchCtrl', function ($scope, $http, $q, User) { | ||
$scope.users = []; | ||
$scope.skills = []; | ||
$scope.hasAllSkills = false; | ||
.controller('SearchCtrl', function($scope, $http, $q, User) { | ||
$scope.users = []; | ||
$scope.skill = 'javascript'; | ||
$scope.searchStarted = false; | ||
|
||
// returns a promise | ||
$scope.fetchUsers = function(){ | ||
return $q(function(resolve, reject){ | ||
$scope.users = User.search({'skills': $scope.skills, | ||
'hasAllSkills': $scope.hasAllSkills}); | ||
if(!$scope.users){ | ||
reject('failed'); | ||
} else{ | ||
resolve($scope.users); | ||
} | ||
}); | ||
}; | ||
// returns a promise | ||
$scope.fetchUsers = function() { | ||
|
||
$scope.fetchUsers() | ||
.then(function(users){ | ||
$scope.users = users; | ||
}); | ||
User.search({ | ||
skill: $scope.skill | ||
}, function(data) { | ||
$scope.searchStarted = true; | ||
$scope.data = data[0]; | ||
$scope.users = $scope.data.items; | ||
}); | ||
}; | ||
|
||
//init | ||
$scope.fetchUsers(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.odd { | ||
background-color: transparent; | ||
margin-bottom: 12px; | ||
margin-top: 12px; | ||
} | ||
|
||
.even { | ||
background-color: #f2f2f2; | ||
border-bottom: 1px solid #dddddd; | ||
border-top: 1px solid #dddddd; | ||
margin-bottom: 12px; | ||
margin-top: 12px; | ||
} | ||
|
||
.profile-img { | ||
height: 100px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,55 @@ | ||
<div ng-include="'components/navbar/navbar.html'"></div> | ||
|
||
<div style='text-align: center;'> | ||
<input type='radio' ng-model='hasAllSkills' ng-value='true'>has all skills</input> | ||
<input type='radio' ng-model='hasAllSkills' ng-value='false'>has at least one of the following skills</input> | ||
<br> | ||
search by skills (comma seperated list) | ||
<input type='text' ng-model='skills' ng-list></input> | ||
Search by language: | ||
<input type='text' ng-model='skill'> | ||
<button ng-click='fetchUsers()'>search</button> | ||
<div> | ||
<div ng-repeat='user in users'> | ||
{{ user.name }} | ||
</div> | ||
|
||
<div class="container-fluid app-font"> | ||
<div class="row"></div> | ||
|
||
<div class="row" style="margin-top:20px;"> | ||
<div class="col-sm-2 col-md-2 sidebar left-nav colorBg" style="padding-top: 20px;"></div> | ||
|
||
<div class="col-sm-8 col-md-8 col-md-offset-0 main"> | ||
|
||
<div class="row-fluid" ng-if="(users.length <= 0 || data.errors.length > 0) && searchStarted"> | ||
<span> | ||
Your search for<b> {{skill}} </b>did not match any documents... | ||
<br/><br/> | ||
* Suggestions: Make sure all words are spelled correctly.</br> | ||
* Use similar words or synonyms.</br> | ||
* Try more general keywords. | ||
</span> | ||
</div> | ||
|
||
<div class="row-fluid main-section" style="min-height:500px" ng-if="users.length > 0 && searchStarted"> | ||
<div ng-bind="(data.total_count ? (data.total_count | number) : 0) + ' results found'"></div> | ||
|
||
<div class="col-fluid" ng-repeat="user in users track by $index" ng-class-odd="'odd'" ng-class-even="'even'"> | ||
|
||
<div class="container"> | ||
<a href="{{user.html_url}}" target="_blank"> | ||
<img class="img-rounded profile-img pull-left" src="{{user.avatar_url}}"> | ||
</a> | ||
<div class="text-left"> | ||
<label> | ||
<dl class="lead dl-horizontal"> | ||
|
||
<dt>Username</dt> | ||
<dd><a href="{{user.html_url}}" target="_blank"><b>{{user.login}}</b></a></dd> | ||
</dl> | ||
</label> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "application-name", | ||
"version": "0.0.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters