From ba221a5c15e6b2d818df6cf0a8d9c5c62906d213 Mon Sep 17 00:00:00 2001 From: hukl Date: Fri, 11 Sep 2009 22:32:25 +0200 Subject: first steps for recent changes rss feed --- app/controllers/rss_controller.rb | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'app/controllers/rss_controller.rb') diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb index 4c2a2e8..e749449 100644 --- a/app/controllers/rss_controller.rb +++ b/app/controllers/rss_controller.rb @@ -1,8 +1,9 @@ class RssController < ApplicationController - def updates - @host = request.protocol + request.host_with_port - + before_filter :authenticate, :only => :recent_changes + before_filter :get_host + + def updates @items = Page.heads.find_tagged_with( "update", :order => "published_at DESC", @@ -14,4 +15,25 @@ class RssController < ApplicationController end end + def recent_changes + @items = Page.all( + :limit => 20, + :order => "updated_at desc", + :conditions => [ + "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days + ] + ) + end + + protected + def authenticate + authenticate_or_request_with_http_basic do |username, password| + username == "recent" && password == "d@t3N+kLAu-23" + end + end + + def get_host + @host = request.protocol + request.host_with_port + end + end -- cgit v1.3