aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/general_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r--app/controllers/general_controller.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index efab26fad..3bf113efb 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -49,14 +49,22 @@ class GeneralController < ApplicationController
# Display WhatDoTheyKnow category from mySociety blog
def blog
feed_url = 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/'
- all_url = 'http://www.mysociety.org/category/projects/whatdotheyknow/'
- @output = ''
content = open(feed_url).read
@data = XmlSimple.xml_in(content)
@channel = @data['channel'][0]
@items = @channel['item']
- @feed_autodetect = [ { :url => @channel['link'][0]['href'], :title => "WhatDoTheyKnow blog"} ]
+ @feed_autodetect = [ { :url => feed_url, :title => "WhatDoTheyKnow blog"} ]
+
+ twitter_url = 'http://api.twitter.com/1/statuses/user_timeline/whatdotheyknow.rss' # @whatdotheyknow
+ content = open(twitter_url).read
+ @data = XmlSimple.xml_in(content)
+ @channel = @data['channel'][0]
+ @items = @channel['item'] + @items
+
+ @feed_autodetect += [ { :url => twitter_url, :title => "WhatDoTheyKnow tweets"} ]
+
+ @items.sort! { |a,b| Time.parse(b['pubDate'][0]) <=> Time.parse(a['pubDate'][0]) }
end
# Just does a redirect from ?query= search to /query