Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53c08a2

Browse files
authored
Merge pull request #2 from 278kunal/feature/language-filter
Feature/language filter
2 parents ba99b46 + 146bf26 commit 53c08a2

File tree

21 files changed

+119
-63
lines changed

21 files changed

+119
-63
lines changed

config/auth.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// expose our config directly to our application using module.exports
2+
module.exports = {
3+
4+
'githubAuth' : {
5+
'clientID' : '4994f0952758aad90ac6', // your App ID
6+
'clientSecret' : '5de49321d3e266f65a41a693261aa91bde40f2d3', // your App Secret
7+
'callbackURL' : 'http://localhost:9999/auth/github/callback'
8+
}
9+
10+
};

config/passport.js

Whitespace-only changes.

controllers/forksController.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
var forksController = function (githubService) {
22
var getData = function (req, res) {
3-
githubService.getForks(function (err, results) {
3+
githubService.getForks(req.params.lang,function (err, results) {
44
res.render('forks', {
55
title: ' | Forks',
6+
lang : req.params.lang.toUpperCase(),
67
item: results.items
78
})
89
})
910
}
1011

1112
var getJSON = function (req, res) {
12-
githubService.getForks(function (err, results) {
13+
githubService.getForks(req.params.lang,function (err, results) {
1314
res.json({
1415
data: results.items
1516
});

controllers/starsController.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
var starsController = function (githubService) {
22
var getData = function (req, res) {
3-
githubService.getStars(function (err, results) {
3+
githubService.getStars(req.params.lang,function (err, results) {
44
res.render('stars', {
55
title: ' | Stars',
6+
lang : req.params.lang.toUpperCase(),
67
item: results.items
78
});
89
})
910
}
1011

1112
var getJSON = function (req, res) {
12-
githubService.getStars(function (err, results) {
13+
githubService.getStars(req.params.lang,function (err, results) {
1314
res.json({
1415
data: results.items
1516
});

controllers/trendingController.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
var trendingController = function (githubService) {
22
var getData = function (req, res) {
3-
var year = req.params.year;
4-
githubService.getTrending(year, function (err, results) {
3+
var year = req.params.year,
4+
lang = req.params.lang;
5+
githubService.getTrending(year, lang, function (err, results) {
56
res.render('trending', {
67
title: ' | Trending',
8+
lang : req.params.lang.toUpperCase(),
79
year: year,
810
item: results.items
911
});
1012
});
1113
}
1214

1315
var getJSON = function (req, res) {
14-
githubService.getStars(function (err, results) {
16+
var year = req.params.year,
17+
lang = req.params.lang;
18+
githubService.getTrending(year, lang, function (err, results) {
1519
res.json({
1620
data: results.items
1721
});

public/javascripts/forks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Get data to be populated into the charts
2-
var getChartData = function(cb) {
3-
$.getJSON("forks/data.json", function (result) {
2+
var getChartData = function(title,cb) {
3+
$.getJSON(title+"/data.json", function (result) {
44
// Do whatever what you want with this data
55
var i;
66
var chartData = [];
@@ -48,4 +48,4 @@ var drawChart = function (chartData) {
4848
chart.draw(data, options);
4949
}
5050

51-
getChartData(drawChart);
51+
getChartData(window.location.pathname,drawChart);

public/javascripts/stars.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Get data to be populated into the charts
2-
var getChartData = function(cb) {
3-
$.getJSON("stars/data.json", function (result) {
2+
var getChartData = function(title,cb) {
3+
$.getJSON(title+"/data.json", function (result) {
44
// Do whatever what you want with this data
55
var i;
66
var chartData = [];
@@ -48,4 +48,4 @@ var drawChart = function (chartData) {
4848
chart.draw(data, options);
4949
}
5050

51-
getChartData(drawChart);
51+
getChartData(window.location.pathname,drawChart);

public/javascripts/trending.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Get data to be populated into the charts
2-
var getChartData = function(year,cb) {
3-
console.log("I am in getchartData");
4-
$.getJSON(year+"/data.json", function (result) {
2+
var getChartData = function(location,cb) {
3+
$.getJSON(location+"/data.json", function (result) {
54
// Do whatever what you want with this data
65
var i;
76
var chartData = [];
@@ -48,8 +47,4 @@ var drawChart = function (chartData) {
4847
var chart = new google.visualization.ColumnChart(document.getElementById('plot'));
4948
chart.draw(data, options);
5049
}
51-
var yearBtn = document.getElementsByClassName('btn-year');
52-
var _self = this;
53-
for(var i=0; i<yearBtn.length;i++){
54-
yearBtn[i].addEventListener('click',_self.getChartData(yearBtn[i].innerText,drawChart))
55-
}
50+
getChartData(window.location.pathname,drawChart);

public/stylesheets/simplex.min.css

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/stylesheets/style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ body {
66
a {
77
color: #00B7FF;
88
}
9+
10+
.main{
11+
padding-top:90px;
12+
}
13+
14+
.offset-1{
15+
margin-left: 1%;
16+
}

0 commit comments

Comments
 (0)