Skip to content

Commit

Permalink
*New* Added Taggable Friends Feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
anuragjajoo committed Dec 19, 2015
1 parent 7dc021d commit c31148d
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 16 deletions.
12 changes: 11 additions & 1 deletion www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ angular.module('sociogram', ['ionic', 'openfb', 'sociogram.controllers'])
}
}
})

.state('app.allfriends', {
url: "/person/:personId/allfriends",
views: {
'menuContent': {
templateUrl: "templates/all-friend-list.html",
controller: "AllFriendsCtrl"
}
}
})

.state('app.mutualfriends', {
url: "/person/:personId/mutualfriends",
views: {
Expand Down Expand Up @@ -114,4 +125,3 @@ angular.module('sociogram', ['ionic', 'openfb', 'sociogram.controllers'])
$urlRouterProvider.otherwise('/app/person/me/feed');

});

25 changes: 16 additions & 9 deletions www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ angular.module('sociogram.controllers', [])
$state.go('app.login');
},
function () {
alert('Revoke Permissions Failed!');
alert('OpenFB : Revoke Permissions Failed!');
});
};

})

.controller('LoginCtrl', function ($scope, $location, OpenFB) {
Expand All @@ -28,10 +27,9 @@ angular.module('sociogram.controllers', [])
$location.path('/app/person/me/feed');
},
function () {
alert('OpenFB Login Failed! Please Try Again...');
alert('OpenFB : Login Failed! Please Try Again...');
});
};

})

.controller('ShareCtrl', function ($scope, OpenFB) {
Expand All @@ -41,23 +39,22 @@ angular.module('sociogram.controllers', [])
$scope.share = function () {
OpenFB.post('/me/feed', $scope.item)
.success(function () {
$scope.status = "Item Shared Successfully on OpenFB.";
$scope.status = "OpenFB : Item Shared Successfully!";
})
.error(function(data) {
alert(data.error.message);
});
};

})

.controller('ProfileCtrl', function ($scope, OpenFB) {
OpenFB.get('/me?fields=id,name,email,birthday,gender').success(function (user) {
OpenFB.get('/me?fields=id,name,email,birthday').success(function (user) {
$scope.user = user;
});
})

.controller('PersonCtrl', function ($scope, $stateParams, OpenFB) {
OpenFB.get('/' + $stateParams.personId + '?fields=id,name,email,birthday,gender').success(function (user) {
OpenFB.get('/' + $stateParams.personId + '?fields=id,name,email,birthday').success(function (user) {
$scope.user = user;
});
})
Expand All @@ -72,6 +69,16 @@ angular.module('sociogram.controllers', [])
});
})

.controller('AllFriendsCtrl', function ($scope, $stateParams, OpenFB) {
OpenFB.get('/' + $stateParams.personId + '/taggable_friends', {limit: 50})
.success(function (result) {
$scope.friends = result.data;
})
.error(function(data) {
alert(data.error.message);
});
})

.controller('MutualFriendsCtrl', function ($scope, $stateParams, OpenFB) {
OpenFB.get('/' + $stateParams.personId + '?fields=context.fields%28mutual_friends%29', {limit: 50})
.success(function (result) {
Expand Down Expand Up @@ -117,5 +124,5 @@ angular.module('sociogram.controllers', [])
$scope.doRefresh = loadFeed;

loadFeed();

});
17 changes: 17 additions & 0 deletions www/templates/all-friend-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ion-view title="All Friends">

<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>

<ion-content has-header="true">

<ion-list>
<ion-item ng-repeat="friend in friends">
{{friend.name}}
</ion-item>
</ion-list>

</ion-content>

</ion-view>
4 changes: 4 additions & 0 deletions www/templates/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ <h1 class="title">Sociogram</h1>
<i class="icon ion-ios7-people"></i>
Friends
</ion-item>
<ion-item item-type="item-icon-left" nav-clear menu-close href="#/app/person/me/allfriends">
<i class="icon ion-ios7-people"></i>
Taggable Friends
</ion-item>
<ion-item item-type="item-icon-left" nav-clear menu-close href="#/app/profile">
<i class="icon ion-person"></i>
Profile
Expand Down
4 changes: 1 addition & 3 deletions www/templates/person.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

<div class="list card">
<div class="item">
<h2>{{user.name}}</h2>
<p>{{user.birthday}}</p>
<p>{{user.email}}</p>
<h2>{{user.name}} {{user.birthday}} {{user.gender}}</h2>
</div>
<div class="item item-image">
<img src="https://graph.facebook.com/{{ user.id }}/picture?width=400&height=400" />
Expand Down
5 changes: 2 additions & 3 deletions www/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

<div class="list card">
<div class="item">
<h2>{{user.name}}</h2>
<p>{{user.birthday}}</p>
<h2>{{user.name}} {{user.birthday}} {{user.gender}}</h2>
<p>{{user.email}}</p>
</div>
<div class="item item-image">
<img ng-src="https://graph.facebook.com/{{user.id}}/picture?width=400&height=400" />
<img ng-src="https://graph.facebook.com/{{ user.id }}/picture?width=400&height=400" />
</div>
</div>

Expand Down

0 comments on commit c31148d

Please sign in to comment.