aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/default.atom.erb1
-rw-r--r--app/views/request/_request_listing_via_event.rhtml4
-rw-r--r--app/views/request/show.rhtml6
-rw-r--r--app/views/track/atom_feed.atom.builder24
-rw-r--r--app/views/track/track_set.rhtml6
-rw-r--r--app/views/track_mailer/event_digest.rhtml4
-rw-r--r--app/views/user/show.rhtml9
7 files changed, 42 insertions, 12 deletions
diff --git a/app/views/layouts/default.atom.erb b/app/views/layouts/default.atom.erb
new file mode 100644
index 000000000..37f0bddbd
--- /dev/null
+++ b/app/views/layouts/default.atom.erb
@@ -0,0 +1 @@
+<%= yield %>
diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml
index 8e673a142..79bbe0ef4 100644
--- a/app/views/request/_request_listing_via_event.rhtml
+++ b/app/views/request/_request_listing_via_event.rhtml
@@ -4,9 +4,9 @@
<%= link_to @highlighting['InfoRequestEvent'][event.id]["title"], request_url(info_request) %>
<% @highlighting['InfoRequestEvent'][event.id].delete("title") %>
<% elsif not event.incoming_message.nil? %>
- <%= link_to "Response to '" + h(info_request.title) + "'", request_url(info_request)+"#incoming-"+event.incoming_message.id.to_s %>
+ <%= link_to "Response to '" + h(info_request.title) + "'", incoming_message_url(event.incoming_message) %>
<% elsif not event.outgoing_message.nil? and event.event_type == 'followup_sent' %>
- <%= link_to "Follow up message for '" + h(info_request.title) + "'", request_url(info_request)+"#outgoing-"+event.outgoing_message.id.to_s %>
+ <%= link_to "Follow up message for '" + h(info_request.title) + "'", outgoing_message_url(event.outgoing_message) %>
<% else %>
<%= link_to h(info_request.title), request_url(info_request) %>
<% end %>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index ff3330362..702a8c2e9 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -79,12 +79,12 @@
(<%= link_to "alter your subscriptions", user_url(@user) %>).
<% else %>
<%= link_to "Track updates to this request", track_request_url(:url_title => @info_request.url_title) %>
- (by email or RSS)
+ (by email or RSS feed)
<% end %>
</p>
<% else %>
- <%= link_to "Track updates to this request", track_request_url(:url_title => @info_request.url_title) %>
- (by email or RSS; be the first)
+ Be the first to <%= link_to "track updates to this request", track_request_url(:url_title => @info_request.url_title) %>
+ (by email or RSS feed)
<% end %>
<% if @info_requests_same_user_same_body.size > 0 %>
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
+
diff --git a/app/views/track/track_set.rhtml b/app/views/track/track_set.rhtml
index 47e4f59a1..90b767219 100644
--- a/app/views/track/track_set.rhtml
+++ b/app/views/track/track_set.rhtml
@@ -13,11 +13,9 @@
<br> -->
<%= radio_button "track_thing", "track_medium", "email_daily" %>
<label for="track_thing_track_medium_email_daily">Send me emails at most once a day</label>
- <!--
<br>
- <%= radio_button "track_thing", "track_medium", "rss" %>
- <label for="track__thingtrack_medium_rss">Give me a feed to use in my news reader (RSS)</label>
- -->
+ <%= radio_button "track_thing", "track_medium", "feed" %>
+ <label for="track_thing_track_medium_feed">Give me a feed to use in my news reader (RSS)</label>
</div>
<p class="form_note">
diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml
index f88a23bdf..9c8a5ad9a 100644
--- a/app/views/track_mailer/event_digest.rhtml
+++ b/app/views/track_mailer/event_digest.rhtml
@@ -20,10 +20,10 @@
extract.gsub!(/\s+/, ' ')
if event.event_type == 'response'
- url = main_url(request_url(event.info_request))+"#incoming-"+event.incoming_message.id.to_s
+ url = incoming_message_url(event.incoming_message)
main_text += event.info_request.public_body.name + " sent a response to " + event.info_request.user.name
elsif event.event_type == 'followup_sent'
- url = main_url(request_url(event.info_request))+"#outgoing-"+event.outgoing_message.id.to_s
+ url = outgoing_message_url(event.outgoing_message)
main_text += event.info_request.user.name + " sent a follow up message to " + event.info_request.public_body.name
elsif event.event_type == 'sent'
# this is unlikely to happen in real life, but happens in the test code
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index b80ab35f5..402ccf251 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -31,7 +31,14 @@
<% for track_thing in @display_user.track_things %>
<li>
<% form_tag :controller => 'track', :action => 'delete', :track_id => track_thing.id do %>
- <%= track_thing.params[:list_description] %>
+ <%= track_thing.params[:list_description] %>,
+ <% if track_thing.track_medium == 'email_daily' %>
+ by email daily
+ <% elsif track_thing.track_medium == 'feed' %>
+ by <%= link_to "RSS feed", :controller => 'track', :action => 'atom_feed', :track_id => track_thing.id %>
+ <% else %>
+ <% raise "unknown track medium '" + track_thing.track_medium + "'" %>
+ <% end %>
<!-- (<%= link_to "view latest updates", :controller => 'general', :action => 'search', :query => track_thing.track_query %>) -->
<%= submit_tag "Delete" %>
<% end %>