diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/contact_mailer/to_admin_message.rhtml (renamed from app/views/contact_mailer/message.rhtml) | 0 | ||||
-rw-r--r-- | app/views/track/atom_feed.atom.builder | 25 | ||||
-rw-r--r-- | app/views/track/atom_feed.atom.erb | 30 |
3 files changed, 30 insertions, 25 deletions
diff --git a/app/views/contact_mailer/message.rhtml b/app/views/contact_mailer/to_admin_message.rhtml index 9c0a74c02..9c0a74c02 100644 --- a/app/views/contact_mailer/message.rhtml +++ b/app/views/contact_mailer/to_admin_message.rhtml diff --git a/app/views/track/atom_feed.atom.builder b/app/views/track/atom_feed.atom.builder deleted file mode 100644 index d1e9310b8..000000000 --- a/app/views/track/atom_feed.atom.builder +++ /dev/null @@ -1,25 +0,0 @@ -atom_feed do |feed| - feed.title(@track_thing.params[:title_in_rss]) - @highlight_words = @xapian_object.words_to_highlight - - for result in @xapian_object.results - feed.entry(result[:model]) do |entry| - # Get the HTML content from the same partial template as website search does - content = '' - if result[:model].class.to_s == 'InfoRequestEvent' - content += render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } - else - content = "<p><strong>Unknown search result type " + result[:model].class.to_s + "</strong></p>" - end - # Pull out the heading as separate item, from the partial template - content.match(/(<span class="head">\s+<a href="[^>]*">(.*)<\/a>\s+<\/span>)/) - 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 - diff --git a/app/views/track/atom_feed.atom.erb b/app/views/track/atom_feed.atom.erb new file mode 100644 index 000000000..23c932308 --- /dev/null +++ b/app/views/track/atom_feed.atom.erb @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> + <id>tag:<%= request.host %>,2005:<%= request.fullpath.split(".")[0] %></id> + <link type="text/html" rel="alternate" href="<%= request.protocol + request.host_with_port %>"/> + <link type="application/atom+xml" rel="self" href="<%= request.url %>"/> + <title><%= @track_thing.params[:title_in_rss] %></title> + <% @xapian_object.results.each do |result| %> + <% + # Get the HTML content from the same partial template as website search does + content = '' + if result[:model].class.to_s == 'InfoRequestEvent' + content += render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } + else + content = "<p><strong>Unknown search result type " + result[:model].class.to_s + "</strong></p>" + end + # Pull out the heading as separate item, from the partial template + content.match(/(<span class="head">\s+<a href="[^>]*">(.*)<\/a>\s+<\/span>)/) + heading = $1 + heading_text = $2 + content.sub!(heading, "") + %> + <entry> + <id>tag:<%= request.host %>,2005:<%= result[:model].class %>/<%= result[:model].id %></id> + <published><%= result[:model].created_at.xmlschema %></published> + <link type="text/html" rel="alternate" href="<%= polymorphic_url(result[:model]) %>"/> + <title type="html"><%= heading_text %></title> + <content type="html"><%= content %></content> + </entry> + <% end %> +</feed> |