IZ MS blogs ctivity streams/atom

This commit is contained in:
maxwell 2010-07-16 16:07:58 -07:00
parent 0bafac9c26
commit c124a9ab41
2 changed files with 21 additions and 3 deletions

View file

@ -4,9 +4,10 @@ class BlogsController < ApplicationController
def index
@blogs = Blog.paginate :page => params[:page], :order => 'created_at DESC'
format.html
format.atom {render :xml => Diaspora::XML::generate(:current_url => request.url, :objects => @bookmarks)}
respond_to do |format|
format.html
format.atom {render :xml => Diaspora::XML::generate(:current_url => request.url, :objects => @blogs)}
end
end

View file

@ -188,6 +188,23 @@ module Diaspora
XML
end
def self.Blog_build_entry(blog)
<<-XML
<entry>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
<title>#{blog.title}</title>
<content>#{blog.body}</content>
<permalink>
<link rel="alternate" type="text/html" href="#{OWNER.url}blogs/#{blog.id}"/>
</permalink>
<id>#{OWNER.url}blogs/#{blog.id}</id>
<published>#{blog.created_at.xmlschema}</published>
<updated>#{blog.updated_at.xmlschema}</updated>
</entry>
XML
end
def self.footer
<<-XML.strip
</feed>