]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/trace_controller.rb
trace bits and a georss class
[rails.git] / app / controllers / trace_controller.rb
index 06db32248229e3b139927f7a3b966ed5f7ecd02d..3448b43acf42e5226fa2e3d8bd5e8117cbe06a93 100644 (file)
@@ -3,7 +3,7 @@ class TraceController < ApplicationController
   layout 'site'
 
   def list
-    @traces = Trace.find(:all)
+    @traces = Trace.find(:all, :conditions => ['public = true'])
   end
 
   def mine
@@ -12,7 +12,11 @@ class TraceController < ApplicationController
 
   def view
     @trace = Trace.find(params[:id])
-    render :nothing, :status => 401 if @trace.user.id != @user.id
+    unless @trace.public
+      if @user
+        render :nothing, :status => 401 if @trace.user.id != @user.id
+      end
+    end
   end
 
   def create
@@ -34,6 +38,12 @@ class TraceController < ApplicationController
     redirect_to :action => 'mine'
   end
 
+  def georss
+    traces = Trace.find(:all, :conditions => ['public = true'], :order => 'timestamp DESC', :limit => 20)
+
+
+  end
+
   def picture
     trace = Trace.find(params[:id])
     send_data(trace.large_picture, :filename => "#{trace.id}.gif", :type => 'image/png', :disposition => 'inline') if trace.public
@@ -43,5 +53,4 @@ class TraceController < ApplicationController
     trace = Trace.find(params[:id])
     send_data(trace.icon_picture, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline') if trace.public
   end
-
 end