From 8ef8761fa52de493c01403211fd3a4481ba759ac Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Thu, 30 Nov 2006 17:25:31 +0000 Subject: [PATCH] trace stuff in rails port --- app/controllers/trace_controller.rb | 4 ++++ app/models/trace.rb | 1 - app/views/site/edit.rhtml | 11 +++++------ app/views/trace/mine.rhtml | 12 ++++++++++++ config/routes.rb | 2 +- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 1c1b968d6..0b39d52ce 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -6,6 +6,10 @@ class TraceController < ApplicationController @traces = Trace.find(:all) end + def mine + @traces = Trace.find(:all, :conditions => ['user_id = ?', @user.id]) + end + def create @params['trace']['name'] = @params['trace']['gpx_file'].original_filename.gsub(/[^a-zA-Z0-9.]/, '_') # This makes sure filenames are sane @params['trace']['data'] = @params['trace']['gpx_file'].read diff --git a/app/models/trace.rb b/app/models/trace.rb index 0c3caa90c..451067b21 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -1,7 +1,6 @@ class Trace < ActiveRecord::Base set_table_name 'gpx_files' - has_many :old_nodes, :foreign_key => :id belongs_to :user def tags=(bleh) diff --git a/app/views/site/edit.rhtml b/app/views/site/edit.rhtml index 1dfeea792..42f428a62 100644 --- a/app/views/site/edit.rhtml +++ b/app/views/site/edit.rhtml @@ -7,13 +7,12 @@ archive="OSMApplet.jar, commons-codec-1.3.jar, core.jar, commons-logging.jar, commons-httpclient-3.0-rc3.jar, MinML2.jar, plugin.jar, thinlet.jar" width="700" height="500" - MAYSCRIPT="true" - > - - - + MAYSCRIPT="true" > + + + - + Your browser needs to support Java to edit maps.
diff --git a/app/views/trace/mine.rhtml b/app/views/trace/mine.rhtml index 41aa0bc1e..d651d1e8b 100644 --- a/app/views/trace/mine.rhtml +++ b/app/views/trace/mine.rhtml @@ -18,5 +18,17 @@
<%= end_form_tag %> + + + + + + + <%= render :partial => 'trace', :collection => @traces %> +
+ <% end %> + + + diff --git a/config/routes.rb b/config/routes.rb index d6ac73468..3f4b9904e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,7 +27,7 @@ ActionController::Routing::Routes.draw do |map| map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password' map.connect '/traces', :controller => 'trace', :action => 'list' - map.connect '/traces/mine', :controller => 'trace', :action => 'users' + map.connect '/traces/mine', :controller => 'trace', :action => 'mine' map.connect '/traces/user/:user/:id', :controller => 'trace', :action => 'list', :id => nil map.connect ':controller/:action/:id' -- 2.39.5