aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/general/blog.rhtml35
-rw-r--r--config/general.yml-example3
-rw-r--r--lib/configuration.rb1
3 files changed, 8 insertions, 31 deletions
diff --git a/app/views/general/blog.rhtml b/app/views/general/blog.rhtml
index 5f859fef8..a5319da9d 100644
--- a/app/views/general/blog.rhtml
+++ b/app/views/general/blog.rhtml
@@ -7,39 +7,12 @@
<img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= @twitter_user %>"><%= _("Follow us on twitter") %></a><br/><br/>
<img src="/images/feed-16.png" alt="RSS icon" valign="middle"> <a href="<%= @feed_url %>"><%= _("Subscribe to blog") %></a>
</div>
+ <% if Configuration::twitter_widget_id %>
<div id="twitter">
- <script src="http://widgets.twimg.com/j/2/widget.js"></script>
- <script type="text/javascript">
- new TWTR.Widget({
- version: 2,
- type: 'profile',
- rpp: 15,
- interval: 6000,
- width: 'auto',
- height: 500,
- theme: {
- shell: {
- background: '#eaeaea',
- color: '#000000'
- },
- tweets: {
- background: '#ffffff',
- color: '#000000',
- links: '#0b004a'
- }
- },
- features: {
- scrollbar: false,
- loop: false,
- live: false,
- hashtags: true,
- timestamp: true,
- avatars: true,
- behavior: 'all'
- }
- }).render().setUser('<%=@twitter_user %>').start();
- </script>
+ <a class="twitter-timeline" data-dnt=true href="https://twitter.com/<%= Configuration::twitter_username %>" data-widget-id="<%= Configuration::twitter_widget_id %>">Tweets by @<%= Configuration::twitter_username %></a>
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
+ <% end %>
</div>
<% end %>
diff --git a/config/general.yml-example b/config/general.yml-example
index 0d6ecfc11..ecd420e9c 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -23,6 +23,9 @@ ISO_COUNTRY_CODE: GB
# These feeds are displayed accordingly on the Alaveteli "blog" page:
BLOG_FEED: 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/'
TWITTER_USERNAME: 'whatdotheyknow'
+# Set the widget_id to get the Twitter sidebar on the blog page.
+# To get one https://twitter.com/settings/widgets
+#TWITTER_WIDGET_ID: ''
# Locales we wish to support in this app, space-delimited
AVAILABLE_LOCALES: 'en es'
diff --git a/lib/configuration.rb b/lib/configuration.rb
index 2878ed3b5..a67880297 100644
--- a/lib/configuration.rb
+++ b/lib/configuration.rb
@@ -48,6 +48,7 @@ module Configuration
:TRACK_SENDER_EMAIL => 'contact@localhost',
:TRACK_SENDER_NAME => 'Alaveteli',
:TWITTER_USERNAME => '',
+ :TWITTER_WIDGET_ID => false,
:USE_DEFAULT_BROWSER_LANGUAGE => true,
:USE_GHOSTSCRIPT_COMPRESSION => false,
:UTILITY_SEARCH_PATH => ["/usr/bin", "/usr/local/bin"],