add atom feed
This commit is contained in:
parent
0e547febf1
commit
4e04cce391
|
@ -1,15 +1,20 @@
|
|||
module Routes
|
||||
class Post < Controller
|
||||
def self.get(session)
|
||||
define_posts(session)
|
||||
session.options[:render] = 'posts/index'
|
||||
end
|
||||
|
||||
def self.define_posts(session)
|
||||
posts = DB[:posts].
|
||||
filter(:released => true).
|
||||
select(:posts__id___post_id, :written, :title, :content).
|
||||
select(:posts__id___post_id, :written, :title, :content, :username).
|
||||
join(:accounts, :id___account_id => :account_id).
|
||||
reverse_order(:written)
|
||||
posts = posts.where(:posts__id => session.options[:id]) if session.options[:id]
|
||||
puts posts.literal(:account__id___account_id)
|
||||
if session.options[:id]
|
||||
posts = posts.where(:posts__id => session.options[:id])
|
||||
end
|
||||
session.options[:posts] = posts
|
||||
session.options[:render] = 'posts/index'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
doctype xml
|
||||
feed xmlns='http://www.w3.org/2005/Atom'
|
||||
title zero-knowledge
|
||||
link href='http://zero-knowledge.org'
|
||||
link type='application/atom+xml' rel='self' href='http://zero-knowledge.org'
|
||||
updated=fetch(:posts).first[:written].xmlschema
|
||||
id http://zero-knowledge.org/
|
||||
-for post in fetch(:posts)
|
||||
entry
|
||||
id="http://zero-knowledge.org/post/#{post[:post_id]}"
|
||||
link(type='text/html' rel='alternate'
|
||||
href="http://zero-knowledge.org/post/#{post[:post_id]}")
|
||||
title=post[:title]
|
||||
updated=post[:written].xmlschema
|
||||
author
|
||||
name=post[:username]
|
||||
summary type='html'=post[:content]
|
||||
content type='html'=post[:content]
|
Loading…
Reference in New Issue