mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
get latest twitter by twitter search without twitter api
This commit is contained in:
parent
133fe5c379
commit
900d84f3c6
@ -46,6 +46,7 @@
|
||||
//= require elasticsearch-browser/elasticsearch.angular
|
||||
//= require d3/d3
|
||||
//= require nvd3/build/nv.d3.js
|
||||
//= require twitter-fetcher
|
||||
//= require app
|
||||
//= require router
|
||||
//= require medium-editor/dist/js/medium-editor
|
||||
|
32
app/assets/javascripts/directives/twitter.js.erb
Normal file
32
app/assets/javascripts/directives/twitter.js.erb
Normal file
@ -0,0 +1,32 @@
|
||||
/* global twitterFetcher */
|
||||
|
||||
/**
|
||||
* This directive will allow show latest tweet.
|
||||
* Usage: <twitter profile="{{twitterName}}"/>
|
||||
*/
|
||||
Application.Directives.directive('twitter', [ function () {
|
||||
return ({
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
profile: '@'
|
||||
},
|
||||
templateUrl: '<%= asset_path "shared/_twitter.html" %>',
|
||||
link ($scope, element, attributes) {
|
||||
var configProfile = {
|
||||
'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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}]);
|
@ -419,3 +419,19 @@
|
||||
.slider-nav__item--current {
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
|
||||
// Twitter
|
||||
#twitter {
|
||||
ul {
|
||||
margin: 0px 15px;
|
||||
padding-left: 0;
|
||||
li {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.timePosted {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
@ -20,26 +20,7 @@
|
||||
|
||||
|
||||
<div class="col-lg-4 m-t-lg">
|
||||
|
||||
<section class="widget panel b-a m-t-sm" ng-if="lastTweets.length > 0">
|
||||
<div class="panel-heading b-b small">
|
||||
<div class="pull-right text-xs align">
|
||||
<a href="https://twitter.com/{{ twitterName }}" ng-show="twitterName" target="_blank">{{ 'app.public.home.follow_us' | translate }}
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x text-yellow"></i>
|
||||
<i class="fa fa-twitter fa-stack-1x fa-inverse text-white"></i>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<h2 translate>{{ 'app.public.home.latest_tweets' }}</h2>
|
||||
</div>
|
||||
|
||||
<ul class="widget-content list-group list-group-lg no-bg auto">
|
||||
<li ng-repeat="tweet in lastTweets" class="text-sm list-group-item no-b clearfix" ng-bind-html="tweet.text">
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
<twitter profile="{{twitterName}}" ng-show="twitterName"/>
|
||||
|
||||
<section class="widget panel b-a" >
|
||||
<div class="panel-heading small b-b">
|
||||
|
14
app/assets/templates/shared/_twitter.html.erb
Normal file
14
app/assets/templates/shared/_twitter.html.erb
Normal file
@ -0,0 +1,14 @@
|
||||
<section class="widget panel b-a m-t-sm">
|
||||
<div class="panel-heading b-b small">
|
||||
<div class="pull-right text-xs align">
|
||||
<a href="https://twitter.com/{{ profile }}" target="_blank">{{ 'app.public.home.follow_us' | translate }}
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x text-yellow"></i>
|
||||
<i class="fa fa-twitter fa-stack-1x fa-inverse text-white"></i>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<h2 translate>{{ 'app.public.home.latest_tweets' }}</h2>
|
||||
</div>
|
||||
<div id="twitter" class="widget-content no-bg auto"></div>
|
||||
</section>
|
@ -72,6 +72,7 @@
|
||||
"ngUpload": "0.5",
|
||||
"nvd3": "1.8",
|
||||
"summernote": "0.7.3",
|
||||
"twitter-fetcher": "^18.0.2",
|
||||
"ui-select": "0.19",
|
||||
"underscore": "1.7"
|
||||
}
|
||||
|
@ -1498,6 +1498,11 @@ tslib@^1.9.0:
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
|
||||
|
||||
twitter-fetcher@^18.0.2:
|
||||
version "18.0.2"
|
||||
resolved "https://registry.yarnpkg.com/twitter-fetcher/-/twitter-fetcher-18.0.2.tgz#47aeff8f3ccbec54443d7f5a5e845ed5279c0b5f"
|
||||
integrity sha1-R67/jzzL7FREPX9aXoRe1SecC18=
|
||||
|
||||
type-check@~0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
|
||||
|
Loading…
x
Reference in New Issue
Block a user