mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-02 13:24:20 +01:00
89e146d419
- twitter - members
44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
/* global twitterFetcher */
|
|
|
|
/**
|
|
* This directive will show the last tweet.
|
|
* Usage: <twitter />
|
|
*/
|
|
Application.Directives.directive('twitter', ['Setting',
|
|
function (Setting) {
|
|
return ({
|
|
restrict: 'E',
|
|
templateUrl: '<%= asset_path "home/twitter.html" %>',
|
|
link ($scope, element, attributes) {
|
|
// Twitter username
|
|
$scope.twitterName = null;
|
|
|
|
// constructor
|
|
const initialize = function () {
|
|
Setting.get({ name: 'twitter_name' }, function (data) {
|
|
$scope.twitterName = data.setting.value;
|
|
if ($scope.twitterName) {
|
|
const configProfile = {
|
|
'profile': { 'screenName': $scope.twitterName },
|
|
'domId': 'twitter',
|
|
'maxTweets': 1,
|
|
'enableLinks': true,
|
|
'showUser': false,
|
|
'showTime': true,
|
|
'showImages': false,
|
|
'showRetweet': true,
|
|
'showInteraction': false,
|
|
'lang': Fablab.locale
|
|
};
|
|
twitterFetcher.fetch(configProfile);
|
|
}
|
|
})
|
|
};
|
|
|
|
// !!! MUST BE CALLED AT THE END of the directive
|
|
return initialize();
|
|
}
|
|
});
|
|
}
|
|
]);
|