/forum_topics.atom: add atom feed for forum topics.
This commit is contained in:
16
app/views/forum_topics/index.atom.builder
Normal file
16
app/views/forum_topics/index.atom.builder
Normal file
@@ -0,0 +1,16 @@
|
||||
atom_feed do |feed|
|
||||
feed.title("Forum Topics")
|
||||
feed.updated(@forum_topics.first.try(:updated_at))
|
||||
|
||||
@forum_topics.each do |topic|
|
||||
feed.entry(topic, published: topic.created_at, updated: topic.updated_at) do |entry|
|
||||
entry.title("[#{topic.category_name}] #{topic.title}")
|
||||
entry.content(format_text(topic.original_post.body), type: "html")
|
||||
|
||||
entry.author do |author|
|
||||
author.name(topic.creator.name)
|
||||
author.uri(user_url(topic.creator_id))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -22,3 +22,5 @@
|
||||
<% content_for(:page_title) do %>
|
||||
Forum - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:html_header, auto_discovery_link_tag(:atom, forum_topics_url(:atom), title: "Forum Topics")) %>
|
||||
|
||||
16
app/views/forum_topics/show.atom.builder
Normal file
16
app/views/forum_topics/show.atom.builder
Normal file
@@ -0,0 +1,16 @@
|
||||
atom_feed do |feed|
|
||||
feed.title(@forum_topic.title)
|
||||
feed.updated(@forum_topic.try(:updated_at))
|
||||
|
||||
@forum_posts.each do |post|
|
||||
feed.entry(post, published: post.created_at, updated: post.updated_at) do |entry|
|
||||
entry.title("@#{post.creator.name}: #{strip_dtext(post.body).truncate(50, separator: /[[:space:]]/)}")
|
||||
entry.content(format_text(post.body), type: "html")
|
||||
|
||||
entry.author do |author|
|
||||
author.name(post.creator.name)
|
||||
author.uri(user_url(post.creator))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -57,3 +57,5 @@
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:html_header, auto_discovery_link_tag(:atom, forum_topics_url(@forum_topic, :atom), title: @forum_topic.title)) %>
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
<li><h1>Forum</h1></li>
|
||||
<li><%= link_to("Help", wiki_pages_path(:title => "help:forum")) %></li>
|
||||
<li><%= link_to("Listing", forum_topics_path) %></li>
|
||||
<li><%= link_to("RSS", forum_topics_path(:atom)) %></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><h1>Wiki</h1></li>
|
||||
|
||||
Reference in New Issue
Block a user