Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/FatalBadgers/tikr into searc…
Browse files Browse the repository at this point in the history
…h-users
  • Loading branch information
scottrice10 committed Feb 7, 2015
2 parents b68ab2e + fa815d9 commit 71ed501
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 76 deletions.
12 changes: 6 additions & 6 deletions client/app/main/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

<header class="hero-unit" id="banner">
<div class="container">
<h1>Welcome to tikr!</h1>
<p class="lead">A social network by developers, for developers.</p>
<h1>GitLinked</h1>
<p class="lead">A social network by Developers, for Developers.</p>
<div>
<div>
<a ng-hide="isLoggedIn()" class="btn btn-github" style='background-color:black;'href="" ng-click="loginOauth('github')">
<i class="fa fa-5x fa-github"></i> Connect with Github
</a>
<a ng-hide="isLoggedIn()" class="btn btn-linkedin" style='background-color:black;'href="" ng-click="loginOauth('linkedin')">
<i class="fa fa-5x fa-linkedin"></i> Connect with LinkedIn
</a>
<i class="fa fa-5x fa-linkedin"></i> Connect with LinkedIn
</a>
</div>
</div>

</div>
</div>
</header>
50 changes: 43 additions & 7 deletions client/app/profile-page/profile.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ angular.module('tikrApp')
});

$scope.setupChart();
$scope.reposChart();

return;
}).
Expand Down Expand Up @@ -95,28 +96,63 @@ angular.module('tikrApp')
});
};

$scope.reposChart = function(){
var data = [];
// Assign each repo and its stargazer value to an array
// _.each($scope.repositories, function(val, key){
// // Need to associate a repo name to an integer
// data.push([key, val[1], 'test']);
// });

// Generate graph
var chart = c3.generate({
bindto: "#reposChart",
data: {
// Dummy data
// TODO: Get stargazers from GitHub API
columns: [
['FatalBadgers', 2],
['soundTab', 1],
['HexGL', 6],
['tikr', 3],
['web-api-auth-examples', 1],
['Blog', 1],
['GhostAzureSetup', 2],
['javascript_koans', 3],
],
type: 'bar'
},
bar: {
width: {
ratio: 0.95
}
}
});
};

$scope.setupChart = function() {
var data = [];
_.each($scope.languages, function(val, key) {
data.push([key, val[1], 'test']);
data.push([key, val[1]]);
});

var chart = c3.generate({
bindto: "#chart",
data: {
// Example:
// columns: [
// ['data1',40, 30, 200, 100, 400, 150, 250, 50, 100, 250,67,190,48,123,76,54,254],
// ['x','Travel and Hospitality','Life Science and Pharma', 'Saas and Cloud', 'Hi-tech Manufacturing', 'Software', 'Business Services', 'Govt/Public Sector', 'Energy', 'Manufacturing', 'Healthcare','Media','Internet','Retail','Biotech','Automobile','Consumer Goods','Financial Services']
// ],

columns: data,
type: 'donut',
type: 'pie',
},
legend: {
position: 'right'
},
pie: {
width: 20,
zerobased: true,
title: "Languages"
}
});

};

$scope.getUserProfile();
Expand Down
8 changes: 3 additions & 5 deletions client/app/profile-page/profile.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.row{
display: block;
}

#profilePic {
display: block;
max-width: 200px;
Expand All @@ -16,8 +12,10 @@
padding: 30px 0;
margin-top: 70px;
border-top: 1px solid #E5E5E5;
background-color: #000;
}

h1, h3, h4 {
text-align: center
}
}

111 changes: 56 additions & 55 deletions client/app/profile-page/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ <h1>{{'@'+userProfile.github.login}}</h1>
</div>
</header> -->

<div class="container">
<div class="container-fluid">

<div class="row">

<!-- General starts -->
<div class="border col-xs-3" id="general">
<div class="row-fluid">
<!-- Left starts -->
<div class="col-md-3" id="left">
<ul class="list-group">
<li class="list-group-item">
<img id="profilePic" ng-src="{{userProfile.github.avatar_url}}">
Expand All @@ -32,57 +32,16 @@ <h4>{{'@'+userProfile.github.login}}</h4>
</li>

<li class="list-group-item">Followers: {{userProfile.github.followers}}</li>

<li class="list-group-item">Following: {{userProfile.github.following}}</li>
</ul>
</div>
<!-- General ends -->

<!-- Languages start -->
<div class="col-xs-6" id="languages">
<!-- start panel -->
<div class="panel panel-default">
<div class="panel">
<h4>Languages</h4>
</div>
<div class="panel-body">
<div id='chart'></div>
</div>
</div>
<!-- end panel -->
</div>
<!-- Languages end -->

<!-- Repos start -->
<div class="col-xs-3" id="languages">
<!-- start panel -->
<div class="panel panel-default">

<div><h4>Public Repositories</h4></div>
<ul class="list-group">
<li class="list-group-item" ng-repeat="repo in userProfile.github.repos">
<a href="{{repo.git_url}}">{{repo.name}}</a>
</li>
</ul>
</div>
<!-- end panel -->
</div>
<!-- Repos ends -->
<li class="list-group-item">Hireable:
<span>
{{userProfile.github.hireable ? 'Yes' : 'No'}}
</span>
</li>

<!-- Repos start -->
<div class="col-xs-3" id="languages">
<!-- start panel -->
<div class="panel panel-default">

<div class="panel"><h4>More graph</h4></div>
<div class="panel-body">Stuff</div>
</div>
<!-- end panel -->
</div>
<!-- Repos ends -->
</ul>

<!-- Skills start -->
<div class="col-xs-3" id="skills">
<!-- Skills start -->
<div class="panel panel-default">

<div class="panel"><h4>Skills</h4></div>
Expand All @@ -93,7 +52,7 @@ <h4>Languages</h4>
<button ng-show="isLoggedInAsCurrentUser()" class="btn btn-default" ng-click="showAddSkillsForm()">Add a Skill</button>
<!--TODO: fix this behavior when user is not logged in -->
<h1 ng-show="!hasSkills() && isLoggedInAsCurrentUser" class="page-header">You haven't added any skills yet</h1>
<h1 ng-show="!hasSkills() && !isLoggedInAsCurrentUser" class="page-header">{{currentUsername}} hasn't added any skills yet :-(</h1>
<h1 ng-show="!hasSkills() && !isLoggedInAsCurrentUser" class="page-header">{{currentUsername}} hasn't added any skills yet</h1>

<form ng-show="showFormToAddSkills" class="form" name="form" ng-submit="addASkill(form)" novalidate>
<div class="form-group">
Expand Down Expand Up @@ -123,8 +82,50 @@ <h1 ng-show="!hasSkills() && !isLoggedInAsCurrentUser" class="page-header">{{cur

</div>
</div>
<!-- Skills end -->

</div>
<!-- Left ends -->

<!-- Middle starts -->
<div class="col-md-6" id="middle">
<!-- start panel -->
<div class="panel panel-default">
<div class="panel"><h4>Languages</h4></div>
<div class="panel-body">
<div id='chart'></div>
</div>
</div>
<!-- end panel -->

<!-- start panel -->
<div class="panel panel-default">
<div class="panel"><h4>Top 10 Most Starred Repositories</h4></div>
<div class="panel-body">
<div id='reposChart'></div>
</div>
</div>
<!-- end panel -->

</div>
<!-- Middle ends -->

<!-- Right starts -->
<div class="col-md-3" id="right">
<!-- Repos start -->
<div class="panel panel-default">

<div><h4>Public Repositories</h4></div>
<ul class="list-group">
<!-- Organise repo list by size -->
<li class="list-group-item" ng-repeat="repo in userProfile.github.repos | orderBy:repos">
<a href="{{repo.git_url}}">{{repo.name}}</a>
</li>
</ul>
</div>
<!-- Repos ends -->
</div>
<!-- Skills end -->
<!-- Right ends -->

</div>
<!-- End of row -->
Expand Down
2 changes: 1 addition & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@
<script src="components/navbar/navbar.controller.js"></script>
<!-- endinjector -->
<!-- endbuild -->
</body>
</body>
</html>
6 changes: 4 additions & 2 deletions server/api/user/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ exports.changePassword = function(req, res, next) {
});
};

exports.getReposPromise = function(user, username) {
// numRepos gives the number of repos showed about a user
exports.getReposPromise = function(user, username, numRepos) {
numRepos = numRepos || "12";
return new Promise(function(resolve, reject) {
var repoOptions = {
url: user.repos_url + "?client_id=" + (process.env.GITHUB_ID || githubKeys.GITHUB_ID)
+ "&client_secret=" + (process.env.GITHUB_SECRET || githubKeys.GITHUB_SECRET) + "&page=1&per_page=3",
+ "&client_secret=" + (process.env.GITHUB_SECRET || githubKeys.GITHUB_SECRET) + "&page=1&per_page=" + numRepos,
headers: {
'User-Agent': username
}
Expand Down

0 comments on commit 71ed501

Please sign in to comment.