summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluca-marie <ml.kochsiek@fu-berlin.de>2016-08-26 17:16:35 +0200
committerthea <ta.kupler@gmail.com>2016-09-01 12:09:37 +0200
commite87d797cdbfe5ebe8dff789742adb6a82d92aae4 (patch)
tree6cd29e707506b779714f1947f6113b85ba02844f
parent1959dd6077d9cac95d678b5378022234ccbf979b (diff)
Small updates on method to check if twitter feed enabled
-rw-r--r--app/helpers/twitter_helper.rb5
-rw-r--r--app/views/twitter/_index.html.erb2
2 files changed, 5 insertions, 2 deletions
diff --git a/app/helpers/twitter_helper.rb b/app/helpers/twitter_helper.rb
index 9fd4ffd..b01293f 100644
--- a/app/helpers/twitter_helper.rb
+++ b/app/helpers/twitter_helper.rb
@@ -1,4 +1,7 @@
module TwitterHelper
+ def twitter_enabled
+ Rails.application.secrets.twitter['enabled'] == true
+ end
def twitter_client
Twitter::REST::Client.new do |config|
@@ -20,5 +23,3 @@ module TwitterHelper
twitter_client.user_timeline(twitter_handle).select{ |tweet| tweet.text.start_with?('RT','@')==false}
end
end
-
-# unless Rails.application.secrets.twitter['enabled'] == false
diff --git a/app/views/twitter/_index.html.erb b/app/views/twitter/_index.html.erb
index 3dab567..8ac65be 100644
--- a/app/views/twitter/_index.html.erb
+++ b/app/views/twitter/_index.html.erb
@@ -1,3 +1,4 @@
+<% if twitter_enabled == true %>
<div class="twitter">
<div class="twitter_header">
Tweets by <%= twitter_name %></p>
@@ -22,3 +23,4 @@
To prevent leakage no links are displayed. For more information visit @<%= twitter_name %> on twitter.com.</p>
</div>
</div>
+<% end %>