From: Steve Coast Date: Fri, 8 Dec 2006 18:00:56 +0000 (+0000) Subject: innitial by tag / by user code X-Git-Tag: live~8605 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/374d9ea486dcf6bb6ad2fe5bb4e5a180a8f556a3?hp=e5f292cf21a5fa72733080a294484e0e4208e0e7 innitial by tag / by user code --- diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 3f689fd3a..fa062b728 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -4,11 +4,21 @@ class TraceController < ApplicationController def list @page = params[:page].to_i + + opt = Hash.new + opt[:conditions] = ['public = true'] + opt[:order] = 'timestamp DESC' + opt[:limit] = 20 + if @page > 0 - @traces = Trace.find(:all , :conditions => ['public = true'], :order => 'timestamp DESC', :offset => 20*@page, :limit => 20) - else - @traces = Trace.find(:all , :conditions => ['public = true'], :order => 'timestamp DESC', :limit => 20) + opt[:offset => 20*@page] end + + if params[:tag] + + end + + @traces = Trace.find(:all , opt) end def view diff --git a/config/routes.rb b/config/routes.rb index 28d40bd5d..a8da5d596 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -34,9 +34,11 @@ ActionController::Routing::Routes.draw do |map| map.connect '/traces/page/:page', :controller => 'trace', :action => 'list' map.connect '/traces/mine', :controller => 'trace', :action => 'mine' map.connect '/traces/rss', :controller => 'trace', :action => 'georss' + map.connect '/traces/user/:display_name/', :controller => 'trace', :action => 'list', :id => nil map.connect '/traces/user/:display_name/:id', :controller => 'trace', :action => 'view', :id => nil map.connect '/traces/user/:display_name/:id/picture', :controller => 'trace', :action => 'picture', :id => nil map.connect '/traces/user/:display_name/:id/icon', :controller => 'trace', :action => 'icon', :id => nil + map.connect '/traces/tag/:tag/', :controller => 'trace', :action => 'list', :id => nil # fall through map.connect ':controller/:action/:id'