summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/rss_controller.rb1
-rw-r--r--app/helpers/link_helper.rb9
-rw-r--r--app/views/rss/updates.xml.builder11
3 files changed, 15 insertions, 6 deletions
diff --git a/app/controllers/rss_controller.rb b/app/controllers/rss_controller.rb
index d2540d0..4c2a2e8 100644
--- a/app/controllers/rss_controller.rb
+++ b/app/controllers/rss_controller.rb
@@ -1,6 +1,7 @@
1class RssController < ApplicationController 1class RssController < ApplicationController
2 2
3 def updates 3 def updates
4 @host = request.protocol + request.host_with_port
4 5
5 @items = Page.heads.find_tagged_with( 6 @items = Page.heads.find_tagged_with(
6 "update", 7 "update",
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb
index b40aa4b..2d31230 100644
--- a/app/helpers/link_helper.rb
+++ b/app/helpers/link_helper.rb
@@ -1,5 +1,14 @@
1module LinkHelper 1module LinkHelper
2 2
3 def content_path_helper path_array
4 url_for(
5 :controller => :content,
6 :action => :render_page,
7 :locale => params[:locale] || I18n.locale,
8 :page_path => path_array
9 )
10 end
11
3 def link_to_path title, path, html_options = {} 12 def link_to_path title, path, html_options = {}
4 if params[:page_path] 13 if params[:page_path]
5 active = (params[:page_path].join("/") == path.sub(/^\//, "")) 14 active = (params[:page_path].join("/") == path.sub(/^\//, ""))
diff --git a/app/views/rss/updates.xml.builder b/app/views/rss/updates.xml.builder
index 8d873c0..57a0f42 100644
--- a/app/views/rss/updates.xml.builder
+++ b/app/views/rss/updates.xml.builder
@@ -1,8 +1,9 @@
1xml.instruct! 1xml.instruct!
2xml.feed(:xmlns => "http://www.w3.org/2005/Atom") do 2
3xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do
3 xml.title("Chaos Computer Club Updates") 4 xml.title("Chaos Computer Club Updates")
4 xml.link(:href => "http://www.ccc.de/") 5 xml.link(:href => "http://www.ccc.de/")
5 xml.link(:rel => "self", :href => "/updates.xml") 6 xml.link(:rel => "self", :href => "/rss/updates.xml")
6 xml.updated(@items.first.published_at.xmlschema) 7 xml.updated(@items.first.published_at.xmlschema)
7 xml.author do 8 xml.author do
8 xml.name("Chaos Computer Club e.V.") 9 xml.name("Chaos Computer Club e.V.")
@@ -12,13 +13,11 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom") do
12 @items.each do |item| 13 @items.each do |item|
13 xml.entry do 14 xml.entry do
14 xml.title(item.title) 15 xml.title(item.title)
15 port = (request.port != 80) ? port = ":#{request.port}" : ""
16 xml.link( 16 xml.link(
17 :href => "#{request.protocol}#{request.host}#{port}/#{I18n.locale.to_s}" \ 17 :href => content_path_helper(item.node.unique_path),
18 "#{item.public_link}",
19 :rel => "alternate" 18 :rel => "alternate"
20 ) 19 )
21 xml.id(request.protocol + request.host + port + item.public_link) 20 xml.id(content_path_helper(item.node.unique_path))
22 xml.updated(item.updated_at.xmlschema) 21 xml.updated(item.updated_at.xmlschema)
23 xml.content(:type => "xhtml") do 22 xml.content(:type => "xhtml") do
24 xml.div(item.body, :xmlns => "http://www.w3.org/1999/xhtml") 23 xml.div(item.body, :xmlns => "http://www.w3.org/1999/xhtml")