diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/body_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/general_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 5 | ||||
-rw-r--r-- | app/controllers/user_controller.rb | 3 | ||||
-rw-r--r-- | app/helpers/link_to_helper.rb | 4 | ||||
-rw-r--r-- | app/models/track_thing.rb | 36 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 6 | ||||
-rw-r--r-- | app/views/track/_tracking_people_and_link.rhtml | 10 |
8 files changed, 41 insertions, 29 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb index 866cfa8aa..a1b08448e 100644 --- a/app/controllers/body_controller.rb +++ b/app/controllers/body_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: body_controller.rb,v 1.12 2008-05-12 10:21:34 francis Exp $ +# $Id: body_controller.rb,v 1.13 2008-08-07 00:24:51 francis Exp $ class BodyController < ApplicationController # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL @@ -34,6 +34,7 @@ class BodyController < ApplicationController @public_body = @public_bodies[0] @track_thing = TrackThing.create_track_for_public_body(@public_body) + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] end def list diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index c01683c03..e7da01417 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -5,7 +5,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: general_controller.rb,v 1.30 2008-07-28 18:04:38 francis Exp $ +# $Id: general_controller.rb,v 1.31 2008-08-07 00:24:51 francis Exp $ class GeneralController < ApplicationController @@ -83,6 +83,7 @@ class GeneralController < ApplicationController @highlight_words = @xapian_requests.words_to_highlight @track_thing = TrackThing.create_track_for_search_query(query) + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] end # For debugging diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index f01f514a1..4cb3e497d 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_controller.rb,v 1.94 2008-06-23 23:20:45 francis Exp $ +# $Id: request_controller.rb,v 1.95 2008-08-07 00:24:51 francis Exp $ class RequestController < ApplicationController @@ -38,6 +38,7 @@ class RequestController < ApplicationController # Track corresponding to this page @track_thing = TrackThing.create_track_for_request(@info_request) + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] end # Requests similar to this one @@ -66,6 +67,8 @@ class RequestController < ApplicationController raise "unknown request list view " + @view.to_s end @xapian_object = perform_search([InfoRequestEvent], query, sortby, 'request_collapse') + + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] end # Page new form posts to diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 7e3b0643d..d5726ed44 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_controller.rb,v 1.51 2008-07-30 13:37:21 francis Exp $ +# $Id: user_controller.rb,v 1.52 2008-08-07 00:24:51 francis Exp $ class UserController < ApplicationController # Show page about a set of users with same url name @@ -24,6 +24,7 @@ class UserController < ApplicationController # Track corresponding to this page @track_thing = TrackThing.create_track_for_user(@display_user) + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] end # Login form diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index d78ca26d7..b255885cb 100644 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: link_to_helper.rb,v 1.34 2008-07-18 22:22:58 francis Exp $ +# $Id: link_to_helper.rb,v 1.35 2008-08-07 00:24:51 francis Exp $ module LinkToHelper @@ -97,7 +97,7 @@ module LinkToHelper elsif track_thing.track_type == 'user_updates' track_user_url(:url_name => track_thing.tracked_user.url_name, :feed => feed) elsif track_thing.track_type == 'search_query' - track_search_url(track_thing.track_query, :feed => feed) + track_search_url(:query_array => track_thing.track_query, :feed => feed) else raise "unknown tracking type " + track_thing.track_type end diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index 7165719db..632f55f1c 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -21,7 +21,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_thing.rb,v 1.27 2008-07-17 11:24:03 francis Exp $ +# $Id: track_thing.rb,v 1.28 2008-08-07 00:24:52 francis Exp $ class TrackThing < ActiveRecord::Base belongs_to :tracking_user, :class_name => 'User' @@ -74,7 +74,7 @@ class TrackThing < ActiveRecord::Base track_thing = TrackThing.new track_thing.track_type = 'public_body_updates' track_thing.public_body = public_body - track_thing.track_query = "variety:sent requested_from:" + public_body.url_name + track_thing.track_query = "requested_from:" + public_body.url_name return track_thing end @@ -82,7 +82,7 @@ class TrackThing < ActiveRecord::Base track_thing = TrackThing.new track_thing.track_type = 'user_updates' track_thing.tracked_user = user - track_thing.track_query = "variety:sent requested_by:" + user.url_name + track_thing.track_query = "requested_by:" + user.url_name return track_thing end @@ -154,17 +154,17 @@ class TrackThing < ActiveRecord::Base elsif self.track_type == 'public_body_updates' @params = { # Website - :set_title => "How would you like to be told about new requests to the public authority '" + CGI.escapeHTML(self.public_body.name) + "'?", + :set_title => "How would you like to track the public authority '" + CGI.escapeHTML(self.public_body.name) + "'?", :list_description => "'<a href=\"/body/" + CGI.escapeHTML(self.public_body.url_name) + "\">" + CGI.escapeHTML(self.public_body.name) + "</a>', a public authority", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how - :verb_on_page => "Be told about new requests to " + CGI.escapeHTML(self.public_body.name), - :verb_on_page_already => "being told about new requests to " + CGI.escapeHTML(self.public_body.name), + :verb_on_page => "Be told about requests to " + CGI.escapeHTML(self.public_body.name), + :verb_on_page_already => "being told about requests to " + CGI.escapeHTML(self.public_body.name), # Email - :title_in_email => "New " + self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", - :title_in_rss => "New " + self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", + :title_in_email => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", + :title_in_rss => self.public_body.law_only_short + " requests to '" + self.public_body.name + "'", # Authentication - :web => "To be told about new requests to the public authority '" + CGI.escapeHTML(self.public_body.name) + "'", - :email => "Then you will be emailed whenever someone requests something from '" + CGI.escapeHTML(self.public_body.name) + "'.", - :email_subject => "Confirm you want to be told about new requests to '" + CGI.escapeHTML(self.public_body.name) + "'", + :web => "To be told about requests to the public authority '" + CGI.escapeHTML(self.public_body.name) + "'", + :email => "Then you will be emailed whenever someone requests something or gets a response from '" + CGI.escapeHTML(self.public_body.name) + "'.", + :email_subject => "Confirm you want to be told about requests to '" + CGI.escapeHTML(self.public_body.name) + "'", # RSS sorting :feed_sortby => 'newest' } @@ -173,15 +173,15 @@ class TrackThing < ActiveRecord::Base # Website :set_title => "How would you like track the person '" + CGI.escapeHTML(self.tracked_user.name) + "'?", :list_description => "'<a href=\"/user/" + CGI.escapeHTML(self.tracked_user.url_name) + "\">" + CGI.escapeHTML(self.tracked_user.name) + "</a>', a person", # XXX yeuch, sometimes I just want to call view helpers from the model, sorry! can't work out how - :verb_on_page => "Be told about new requests by this person", - :verb_on_page_already => "being told about new requests by this person", + :verb_on_page => "Be told about requests by this person", + :verb_on_page_already => "being told about requests by this person", # Email - :title_in_email => "New FOI requests by '" + self.tracked_user.name + "'", - :title_in_rss => "New FOI requests by '" + self.tracked_user.name + "'", + :title_in_email => "FOI requests by '" + self.tracked_user.name + "'", + :title_in_rss => "FOI requests by '" + self.tracked_user.name + "'", # Authentication - :web => "To be told about new requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'", - :email => "Then you will be emailed whenever '" + CGI.escapeHTML(self.tracked_user.name) + "' requests something", - :email_subject => "Confirm you want to be told about new requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'", + :web => "To be told about requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'", + :email => "Then you will be emailed whenever '" + CGI.escapeHTML(self.tracked_user.name) + "' requests something or gets a response", + :email_subject => "Confirm you want to be told about requests by '" + CGI.escapeHTML(self.tracked_user.name) + "'", # RSS sorting :feed_sortby => 'newest' } diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 564903f0d..3f7f15dc4 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -16,6 +16,12 @@ %> <%= stylesheet_link_tag 'yucky-green', :title => "Yucky Green", :rel => yucky ? "stylesheet" : "alternate stylesheet" %> <%= stylesheet_link_tag 'main', :title => "Main", :rel => yucky ? "alternate stylesheet" : "stylesheet" %> + + <% if @feed_autodetect %> + <% for feed in @feed_autodetect %> + <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>"> + <% end %> + <% end %> </head> <body> <div id="banner"> diff --git a/app/views/track/_tracking_people_and_link.rhtml b/app/views/track/_tracking_people_and_link.rhtml index fb59ca85c..3c8953336 100644 --- a/app/views/track/_tracking_people_and_link.rhtml +++ b/app/views/track/_tracking_people_and_link.rhtml @@ -22,10 +22,10 @@ <% if own_request %> <p>You will be emailed when there are updates to your own request.</p> <p>You may also <%= link_to "get an RSS feed", do_track_url(track_thing) %> - <img src="/images/feed-14.png" alt="" class="rss"></p> + <img src="/images/feed-16.png" alt="" class="rss"></p> <% else %> <%= link_to track_thing.params[:verb_on_page], do_track_url(track_thing) %> - (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">) + (by email or RSS feed <img src="/images/feed-16.png" alt="" class="rss">) <% end %> <% end %> </p> @@ -33,13 +33,13 @@ <% if own_request %> <p>You will be emailed when there are updates to your own request.</p> <p>You may also get an <%= link_to 'RSS feed', do_track_url(track_thing) %> - <img src="/images/feed-14.png" alt="" class="rss"></p> + <img src="/images/feed-16.png" alt="" class="rss"></p> <% else %> <p>Be the first to <%= link_to MySociety::Format.lcfirst(track_thing.params[:verb_on_page]), do_track_url(track_thing) %> - (by email or RSS feed <img src="/images/feed-14.png" alt="" class="rss">)</p> + (by email or RSS feed <img src="/images/feed-16.png" alt="" class="rss">)</p> <% end %> <% end %> -<!-- <p><%= link_to '<img src="/images/feed-14.png" alt="" class="rss"> RSS feed', do_track_url(track_thing, 'feed') %></p> --> +<div class="feed_link"><%= link_to '<img src="/images/feed-16.png" alt="" class="rss">', do_track_url(track_thing, 'feed') %> <%= link_to 'RSS feed', do_track_url(track_thing, 'feed') %></div> |