X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e29e49dc7c3d1d9f59679f09a5eba8a6b56854a2..362f237e91541b7cef44629432ae500f4b0518f4:/app/controllers/trace_controller.rb
diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb
index 9b32c32a7..f8ce29aba 100644
--- a/app/controllers/trace_controller.rb
+++ b/app/controllers/trace_controller.rb
@@ -15,7 +15,8 @@ class TraceController < ApplicationController
before_filter :offline_redirect, :only => [:create, :edit, :delete, :data, :api_data, :api_create]
around_filter :api_call_handle_error, :only => [:api_details, :api_data, :api_create]
- caches_action :list, :view, :layout => false
+ caches_action :list, :unless => :logged_in?, :layout => false
+ caches_action :view, :layout => false
caches_action :georss, :layout => true
cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create]
cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create]
@@ -26,7 +27,7 @@ class TraceController < ApplicationController
# from display name, pick up user id if one user's traces only
display_name = params[:display_name]
if target_user.nil? and !display_name.blank?
- target_user = User.find(:first, :conditions => [ "visible = ? and display_name = ?", true, display_name])
+ target_user = User.find(:first, :conditions => { :status => ["active", "confirmed"], :display_name => display_name })
if target_user.nil?
@title = t'trace.no_such_user.title'
@not_found_user = display_name
@@ -80,11 +81,15 @@ class TraceController < ApplicationController
conditions[0] += " AND gpx_files.visible = ?"
conditions << true
- @trace_pages, @traces = paginate(:traces,
- :include => [:user, :tags],
- :conditions => conditions,
- :order => "gpx_files.timestamp DESC",
- :per_page => 20)
+ @page = (params[:page] || 1).to_i
+ @page_size = 20
+
+ @traces = Trace.find(:all,
+ :include => [:user, :tags],
+ :conditions => conditions,
+ :order => "gpx_files.timestamp DESC",
+ :offset => (@page - 1) * @page_size,
+ :limit => @page_size)
# put together SET of tags across traces, for related links
tagset = Hash.new
@@ -228,7 +233,7 @@ class TraceController < ApplicationController
rss = OSM::GeoRSS.new
traces.each do |trace|
- rss.add(trace.latitude, trace.longitude, trace.name, trace.user.display_name, url_for({:controller => 'trace', :action => 'view', :id => trace.id, :display_name => trace.user.display_name}), " 'icon', :id => trace.id, :user_login => trace.user.display_name})}'> GPX file with #{trace.size} points from #{trace.user.display_name}", trace.timestamp)
+ rss.add(trace.latitude, trace.longitude, trace.name, trace.user.display_name, url_for({:controller => 'trace', :action => 'view', :id => trace.id, :display_name => trace.user.display_name}), " 'icon', :id => trace.id, :display_name => trace.user.display_name})}'> GPX file with #{trace.size} points from #{trace.user.display_name}", trace.timestamp)
end
render :text => rss.to_s, :content_type => "application/rss+xml"