Skip to content

Commit

Permalink
Feed discovery fix + full feed option
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Jun 17, 2010
1 parent 9c557b3 commit c9cdabd
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions vendor/modules/blog/app/models/blog/rss_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_feed
item = { :title => post.title,
:guid => post.id,
:published_at => post.published_at.to_s(:rfc822),
:description => replace_relative_urls(post.preview)
:description => replace_relative_urls(@options.full ? post.body_content : post.preview)
}
post.blog_categories.each do |cat|
item[:categories] ||= []
Expand Down Expand Up @@ -90,15 +90,16 @@ def replace_link_hrefs(txt)
end

class Options < Feed::AdminController::RssModuleOptions
attributes :feed_identifier => nil, :limit => 10
attributes :feed_identifier => nil, :limit => 10, :full => false

validates_presence_of :feed_identifier, :limit
validates_numericality_of :limit

integer_options :limit

options_form(fld(:feed_identifier, :select, :options => :feed_identifier_options, :label => 'Feed'),
fld(:limit, :text_field)
fld(:limit, :text_field),
fld(:full,:yes_no)
)

def validate
Expand All @@ -113,13 +114,13 @@ def feed_identifier_options
opts = [['--Select Feed--', nil]]

revisions.each do |rev|
par = rev.page_paragraphs[0]
blog = Blog::BlogBlog.find_by_id(par.data[:blog_id]) if par
detail_page = par.data[:detail_page] if par && par.data[:detail_page]
if par && blog && rev.revision_container.is_a?(SiteNode)
opts << [ blog.name + ' - ' + rev.revision_container.node_path, "#{rev.revision_container_id},#{blog.id},#{detail_page}" ]
end
par = rev.page_paragraphs.detect { |p| p.display_module =='/blog/page' && p.display_type == 'entry_list' }
blog = Blog::BlogBlog.find_by_id(par.data[:blog_id]) if par
detail_page = par.data[:detail_page] if par && par.data[:detail_page]

if par && blog && rev.revision_container.is_a?(SiteNode)
opts << [ blog.name + ' - ' + rev.revision_container.node_path, "#{rev.revision_container_id},#{blog.id},#{detail_page}" ]
end
end
opts
end
Expand Down

0 comments on commit c9cdabd

Please sign in to comment.