diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/general_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/public_body_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/user_controller.rb | 2 | ||||
-rw-r--r-- | app/views/help/api.rhtml | 9 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 5 |
6 files changed, 16 insertions, 8 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 0bea01a6f..21e715424 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -153,7 +153,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] } ] + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] end # Jump to a random request diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 0a2e72a5a..0ef143f7f 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -46,7 +46,7 @@ class PublicBodyController < ApplicationController end @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] } ] + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] respond_to do |format| format.html { @has_json = true } diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index e69059f6c..8425b33d6 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -64,7 +64,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] } ] + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] # For send followup link at bottom @last_response = @info_request.get_last_response @@ -172,7 +172,7 @@ class RequestController < ApplicationController @title = @title + " (page " + @page.to_s + ")" if (@page > 1) - @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] # Don't let robots go more than 20 pages in if @page > 20 diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 288e1cc20..1fa3a1778 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -40,7 +40,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] } ] + @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ] # All tracks for the user if @is_you diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml index 46c12b9ec..6f27cf908 100644 --- a/app/views/help/api.rhtml +++ b/app/views/help/api.rhtml @@ -51,14 +51,19 @@ tips</a> for details. <h2> 3. JSON structured data </h2> -<p>Request, public authority and user pages have JSON feeds, which let you download -information about objects in a structured form. Find them by: +<p>Quite a few pages have JSON versions, which let you download information about +objects in a structured form. Find them by: <ul> <li>Adding <tt>.json</tt> to the end of the URL. </li> <li>Look for the <tt><link rel="alternate" type="application/json"></tt> tag in the head of the HTML. </li> </ul> </p> +<p>Requests, users and authorities all have JSON versions containing basic +information about them. Every Atom feed has a JSON equivalent, containing +information about the list of events in the feed. +</p> + <hr> <h2> 4. Spreadsheet of all authorities </h2> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 7d91ae4e6..84bc7afde 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -28,10 +28,13 @@ <% if @feed_autodetect %> <% for feed in @feed_autodetect %> <link rel="alternate" type="application/atom+xml" title="<%=h feed[:title] %>" href="<%=h feed[:url]%>"> + <% if feed[:has_json] %> + <link rel="alternate" type="application/json" title="JSON version of <%=h feed[:title] %>" href="<%=h feed[:url]%>.json"> + <% end %> <% end %> <% end %> <% if @has_json %> - <link rel="alternate" type="application/json" title="JSON version" href="<%=h main_url(request.request_uri) %>.json"> + <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h main_url(request.request_uri) %>.json"> <% end %> <% if @no_crawl %> |