From d85a11d1a6072abe48ff75cc47624e104fa42c4a Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 31 Jan 2013 12:44:29 +1100 Subject: Fix rendering of atom feed and set correct content type --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 51e081c88..9b4746bde 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -157,10 +157,10 @@ class TrackController < ApplicationController def atom_feed_internal @xapian_object = perform_search([InfoRequestEvent], @track_thing.track_query, @track_thing.params[:feed_sortby], nil, 25, 1) respond_to do |format| - format.atom { render :template => 'track/atom_feed' } format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true, lambda { |t| @template.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) } ) } } + format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => :atom } end end -- cgit v1.2.3 From 5ff4b4610a810ff29750cd135574700c49929892 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 31 Jan 2013 12:51:15 +1100 Subject: Access view helper from controller using view_context --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 9b4746bde..23d79b30c 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -158,7 +158,7 @@ class TrackController < ApplicationController @xapian_object = perform_search([InfoRequestEvent], @track_thing.track_query, @track_thing.params[:feed_sortby], nil, 25, 1) respond_to do |format| format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true, - lambda { |t| @template.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) } + lambda { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) } ) } } format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => :atom } end -- cgit v1.2.3 From 10a76a091bce366a30850b3f60354e5fe52abf5e Mon Sep 17 00:00:00 2001 From: Henare Degan Date: Tue, 5 Mar 2013 14:08:12 +1100 Subject: Fix track searches by changing the way the routing works --- app/controllers/track_controller.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 23d79b30c..2679cacc9 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -80,10 +80,7 @@ class TrackController < ApplicationController # Track a search term def track_search_query - # XXX should be better thing in rails routes than having to do this - # join just to get / and . to work in a query. - query_array = params[:query_array] - @query = query_array.join("/") + @query = params[:query_array] # XXX more hackery to make alternate formats still work with query_array if /^(.*)\.json$/.match(@query) -- cgit v1.2.3 From 44ec166b8691743e0ffbcc108eaf41ab0d2ef3cd Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Tue, 26 Mar 2013 09:47:06 +1100 Subject: Change email address in header of source code to hello@mysociety.org --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 2679cacc9..9076148c4 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -3,7 +3,7 @@ # social bookmarking. # # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ class TrackController < ApplicationController -- cgit v1.2.3 From 2376834e80b736e4eb4f4dcbdbb3988cafa6cc5b Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Wed, 29 May 2013 15:25:02 +0100 Subject: Make sure Atom feeds are served with content type application/atom+xml Fixes #961 --- app/controllers/track_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/track_controller.rb') diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 9076148c4..40e82e7a4 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -157,7 +157,7 @@ class TrackController < ApplicationController format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true, lambda { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) } ) } } - format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => :atom } + format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => 'application/atom+xml' } end end -- cgit v1.2.3