aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/track/atom_feed.atom.builder
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/track/atom_feed.atom.builder')
-rw-r--r--app/views/track/atom_feed.atom.builder24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/views/track/atom_feed.atom.builder b/app/views/track/atom_feed.atom.builder
new file mode 100644
index 000000000..627c53d11
--- /dev/null
+++ b/app/views/track/atom_feed.atom.builder
@@ -0,0 +1,24 @@
+atom_feed do |feed|
+ feed.title(@track_thing.params[:title_in_rss])
+
+ for search_result in @search_results
+ feed.entry(search_result) do |entry|
+ # Get the HTML content from the same partial template as website search does
+ content = ''
+ if search_result.class.to_s == 'InfoRequestEvent'
+ content += render :partial => 'request/request_listing_via_event', :locals => { :event => search_result, :info_request => search_result.info_request }
+ else
+ content = "<p><strong>Unknown search result type " + search_result.class.to_s + "</strong></p>"
+ end
+ # Pull out the heading as separate item, from the partial template
+ content.match(/(<a href="[^>]*">(.*)<\/a>\s+<br>)/)
+ heading = $1
+ heading_text = $2
+ content.sub!(heading, "")
+ # Render the atom
+ entry.title(heading_text, :type => 'html')
+ entry.content(content, :type => 'html')
+ end
+ end
+end
+