2020-01-15 12:04:07 +01:00
|
|
|
/* global twitterFetcher */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This directive will allow show latest tweet.
|
|
|
|
* Usage: <twitter profile="{{twitterName}}"/>
|
|
|
|
*/
|
|
|
|
Application.Directives.directive('twitter', [ function () {
|
|
|
|
return ({
|
|
|
|
restrict: 'E',
|
|
|
|
scope: {
|
|
|
|
profile: '@'
|
|
|
|
},
|
2020-01-22 12:23:51 +01:00
|
|
|
templateUrl: '<%= asset_path "home/_twitter.html" %>',
|
2020-01-15 12:04:07 +01:00
|
|
|
link ($scope, element, attributes) {
|
2020-01-22 12:23:51 +01:00
|
|
|
const configProfile = {
|
2020-01-15 12:04:07 +01:00
|
|
|
'profile': { 'screenName': $scope.profile },
|
|
|
|
'domId': 'twitter',
|
|
|
|
'maxTweets': 1,
|
|
|
|
'enableLinks': true,
|
|
|
|
'showUser': false,
|
|
|
|
'showTime': true,
|
|
|
|
'showImages': false,
|
|
|
|
'showRetweet': true,
|
|
|
|
'showInteraction': false,
|
|
|
|
'lang': Fablab.locale
|
|
|
|
};
|
|
|
|
if ($scope.profile) {
|
|
|
|
twitterFetcher.fetch(configProfile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}]);
|