diff --git a/src/assets/scripts/ads-details/ads-details.controller.js b/src/assets/scripts/ads-details/ads-details.controller.js index 258da11..2dff337 100644 --- a/src/assets/scripts/ads-details/ads-details.controller.js +++ b/src/assets/scripts/ads-details/ads-details.controller.js @@ -1,7 +1,7 @@ import moment from 'moment'; import Avatar from 'avatar-initials'; -const AdsDetailsController = ($scope, AdsDetailsService, $routeParams, UserService) => { +const AdsDetailsController = ($scope, AdsDetailsService, $routeParams, UserService, UsersService) => { $scope.$on('loadUserSuccess', function (event, user) { $scope.user = user; @@ -18,7 +18,26 @@ const AdsDetailsController = ($scope, AdsDetailsService, $routeParams, UserServi .catch((error) => { console.log(error); }); $scope.daysAgo = (timestamp) => { return moment(timestamp).fromNow(); } }); - UserService.loadUser(); + UserService.loadUser(); + + $(document).ready( async() =>{ + await UsersService.fetchUsersService() + .then( (result) => { + $scope.users = result; + + $scope.avatar_user = function(index) { + const first_name = result[index].personal.first_name[0]; + const last_name = result[index].personal.last_name[0]; + new Avatar(document.getElementById('user'+index), { + 'useGravatar': false, + 'initials': first_name + last_name, + 'initial_weight': 300, + }); + } + masonry(); + }) + .catch( (error) => { console.log(error); }) + }); } export default AdsDetailsController; \ No newline at end of file diff --git a/src/assets/scripts/ads-details/ads-details.html b/src/assets/scripts/ads-details/ads-details.html index 0d20b8e..9df065f 100644 --- a/src/assets/scripts/ads-details/ads-details.html +++ b/src/assets/scripts/ads-details/ads-details.html @@ -11,54 +11,90 @@ -
{{ad.location}}
-{{ad.expiration-date}}
+ +{{ad.location}}
+{{ad.expiration-date}}
-