Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
Remove hardcoded GOOGLE_API_KEY that was spread around in the code an…
Browse files Browse the repository at this point in the history
…d define it in hub.config.js.

Fix broken links in Organizer cards.
  • Loading branch information
Splaktar committed Aug 31, 2015
1 parent ec0c18f commit 36970f0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"quotmark": "single",
Expand Down
8 changes: 4 additions & 4 deletions app/scripts/controllers/chapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ angular.module('gdgxHubApp')
$scope.chapters = data;
});
})
.controller('ChapterMetricsCtrl', function ($scope, $http, $routeParams) {
.controller('ChapterMetricsCtrl', function ($scope, $http, $routeParams, config) {

$scope.month = (moment().months() + 1);
$scope.year = moment().year();
Expand All @@ -71,13 +71,13 @@ angular.module('gdgxHubApp')
});

$http.get('https://www.googleapis.com/plus/v1/people/' + $routeParams.chapterId +
'?fields=aboutMe,image&key=AIzaSyD7v04m_bTu-rcWtuaN3fTP9NBmjhB7lXg')
'?fields=aboutMe,image&key=' + config.GOOGLE_API_KEY)
.success(function (data) {
$scope.about = data.aboutMe;
$scope.image = data.image.url.replace('sz=50', 'sz=70');
});
})
.controller('ChapterDetailCtrl', function ($scope, $http, $routeParams, $location, uiCalendarConfig) {
.controller('ChapterDetailCtrl', function ($scope, $http, $routeParams, $location, uiCalendarConfig, config) {
$http.get('/api/v1/chapters/' + $routeParams.chapterId).success(function (data) {
if (data.geo) {
data.geo.latitude = data.geo.lat;
Expand All @@ -94,7 +94,7 @@ angular.module('gdgxHubApp')
});

$http.get('https://www.googleapis.com/plus/v1/people/' + $routeParams.chapterId +
'?fields=aboutMe,image&key=AIzaSyD7v04m_bTu-rcWtuaN3fTP9NBmjhB7lXg')
'?fields=aboutMe,image&key=' + config.GOOGLE_API_KEY)
.success(function (data) {
$scope.about = data.aboutMe;
$scope.image = data.image.url.replace('sz=50', 'sz=70');
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/controllers/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ angular.module('gdgxHubApp')

$scope.eventSource = [$scope.events];
})
.controller('EventDetailCtrl', function ($scope, $http, $routeParams) {
.controller('EventDetailCtrl', function ($scope, $http, $routeParams, config) {

$http.get('/api/v1/events/' + $routeParams.eventId).success(function (data) {
if (data.geo) {
Expand All @@ -62,7 +62,7 @@ angular.module('gdgxHubApp')
$scope.event = data;

$http.get('https://www.googleapis.com/plus/v1/people/' + $scope.event.chapter +
'?fields=image&key=AIzaSyD7v04m_bTu-rcWtuaN3fTP9NBmjhB7lXg')
'?fields=image&key=' + config.GOOGLE_API_KEY)
.success(function (data) {
$scope.image = data.image.url.replace('sz=50', 'sz=70');
});
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/gdg_stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ angular.module('gdgxHubApp')
data: {
'cols': [
{id: 't', label: 'Tags', type: 'string'},
{id: 's', label: 'Occurences', type: 'number'}
{id: 's', label: 'Occurrences', type: 'number'}
]
}
};
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/directives/gplus.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module('gdgxHubApp.directives.gplus', [])
.directive('gplusPerson', ['$http', function ($http) {
.directive('gplusPerson', function ($http, config) {
return {
restrict: 'EA',
templateUrl: 'directives/gplus_person',
Expand All @@ -12,7 +12,7 @@ angular.module('gdgxHubApp.directives.gplus', [])
scope.$watch('gplusId', function (oldVal, newVal) {
if (newVal) {
$http.get('https://www.googleapis.com/plus/v1/people/' + newVal +
'?fields=aboutMe%2CdisplayName%2Cimage&key=AIzaSyD7v04m_bTu-rcWtuaN3fTP9NBmjhB7lXg')
'?fields=aboutMe%2CdisplayName%2Cimage&key=' + config.GOOGLE_API_KEY)
.success(function (data) {
data.image.url = data.image.url.replace('sz=50', 'sz=170');
scope.person = data;
Expand All @@ -21,4 +21,4 @@ angular.module('gdgxHubApp.directives.gplus', [])
});
}
};
}]);
});
8 changes: 8 additions & 0 deletions app/scripts/hub.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

angular.module('gdgxHubApp')
.constant('GOOGLE_API_KEY', 'AIzaSyD7v04m_bTu-rcWtuaN3fTP9NBmjhB7lXg')
.service('config', config)
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
Expand Down Expand Up @@ -73,3 +75,9 @@ angular.module('gdgxHubApp')

$locationProvider.html5Mode(true);
});

function config(GOOGLE_API_KEY) {
return {
GOOGLE_API_KEY: GOOGLE_API_KEY
};
}
12 changes: 7 additions & 5 deletions app/views/directives/gplus_person.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<div class="card people">
<div class="card-top green">
<a href="#">
<img ng-src="{{person.image.url}}" alt=""/>
<a ng-href="https://plus.google.com/{{gplusId}}">
<img ng-src="{{person.image.url}}" alt="{{person.displayName}}"/>
</a>
</div>
<div class="card-info">
<a class="title" href="#">{{person.displayName}}</a>
<a class="title" ng-href="https://plus.google.com/{{gplusId}}">{{person.displayName}}</a>
<div class="desc" ng-bind-html="person.aboutMe"></div>
</div>
<div class="card-bottom">
<a ng-href="https://plus.google.com/{{gplusId}}"><button class="btn btn-block">Profile on G+</button></a>
<a ng-href="https://plus.google.com/{{gplusId}}">
<button class="btn btn-block">Profile on G+</button>
</a>
</div>
</div>
</div>

0 comments on commit 36970f0

Please sign in to comment.