diff options
| author | hukl <contact@smyck.org> | 2009-09-11 22:32:25 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-11 22:32:25 +0200 |
| commit | ba221a5c15e6b2d818df6cf0a8d9c5c62906d213 (patch) | |
| tree | 96203d13757cd05124ac73682162b639e286524b /app/controllers | |
| parent | 7b34b515a6a24579d8c84c9b8b84f818289b898f (diff) | |
first steps for recent changes rss feed
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/rss_controller.rb | 28 |
1 files changed, 25 insertions, 3 deletions
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 @@ | |||
| 1 | class RssController < ApplicationController | 1 | class RssController < ApplicationController |
| 2 | 2 | ||
| 3 | def updates | 3 | before_filter :authenticate, :only => :recent_changes |
| 4 | @host = request.protocol + request.host_with_port | 4 | before_filter :get_host |
| 5 | 5 | ||
| 6 | def updates | ||
| 6 | @items = Page.heads.find_tagged_with( | 7 | @items = Page.heads.find_tagged_with( |
| 7 | "update", | 8 | "update", |
| 8 | :order => "published_at DESC", | 9 | :order => "published_at DESC", |
| @@ -14,4 +15,25 @@ class RssController < ApplicationController | |||
| 14 | end | 15 | end |
| 15 | end | 16 | end |
| 16 | 17 | ||
| 18 | def recent_changes | ||
| 19 | @items = Page.all( | ||
| 20 | :limit => 20, | ||
| 21 | :order => "updated_at desc", | ||
| 22 | :conditions => [ | ||
| 23 | "updated_at < ? AND updated_at > ?", Time.now, Time.now-14.days | ||
| 24 | ] | ||
| 25 | ) | ||
| 26 | end | ||
| 27 | |||
| 28 | protected | ||
| 29 | def authenticate | ||
| 30 | authenticate_or_request_with_http_basic do |username, password| | ||
| 31 | username == "recent" && password == "d@t3N+kLAu-23" | ||
| 32 | end | ||
| 33 | end | ||
| 34 | |||
| 35 | def get_host | ||
| 36 | @host = request.protocol + request.host_with_port | ||
| 37 | end | ||
| 38 | |||
| 17 | end | 39 | end |
