From 945df7f195e23425396f7fb44549ba76f1ef4fd8 Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Sat, 3 May 2008 14:18:22 +0000 Subject: [PATCH 1/4] add a go button to the search form as in bug 589 --- app/views/site/_search.rhtml | 4 +++- public/stylesheets/site.css | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/site/_search.rhtml b/app/views/site/_search.rhtml index bdfc2fb57..43853dcf0 100644 --- a/app/views/site/_search.rhtml +++ b/app/views/site/_search.rhtml @@ -39,7 +39,9 @@ :complete => "endSearch()", :url => { :controller => :geocoder, :action => :search }) do %> <%= text_field_tag :query, h(params[:query]) %> - <% end %> + + <%= submit_tag 'Go' %> + <% end %>

Searching...

diff --git a/public/stylesheets/site.css b/public/stylesheets/site.css index 51cde8392..e1b877e03 100644 --- a/public/stylesheets/site.css +++ b/public/stylesheets/site.css @@ -354,8 +354,9 @@ hides rule from IE5-Mac \*/ padding: 0px; } -.optionalbox input { - width: 100%; + +.optionalbox input[type="text"] { + width: 110px; } .search_form { From 3d0f2130dab94f33b0e73d9304c2fdc527fff106 Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Sat, 3 May 2008 14:29:01 +0000 Subject: [PATCH 2/4] fix bug 871 - show a good error message if gps trace not found --- app/controllers/trace_controller.rb | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 4db6e8e15..3bb0d3323 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -83,6 +83,13 @@ class TraceController < ApplicationController def view @trace = Trace.find(params[:id]) + + unless @trace + flash[:notice] = "OH NOES! Trace not found!" + redirect_to :controller => 'trace', :action => 'list' + return + end + @title = "Viewing trace #{@trace.name}" if !@trace.visible? render :nothing => true, :status => :not_found @@ -90,7 +97,8 @@ class TraceController < ApplicationController render :nothing => true, :status => :forbidden end rescue ActiveRecord::RecordNotFound - render :nothing => true, :status => :not_found + flash[:notice] = "GPX file not found" + redirect_to :controller => 'trace', :action => 'list' end def create @@ -107,11 +115,11 @@ class TraceController < ApplicationController end else @trace = Trace.new({:name => "Dummy", - :tagstring => params[:trace][:tagstring], - :description => params[:trace][:description], - :public => params[:trace][:public], - :inserted => false, :user => @user, - :timestamp => Time.now}) + :tagstring => params[:trace][:tagstring], + :description => params[:trace][:description], + :public => params[:trace][:public], + :inserted => false, :user => @user, + :timestamp => Time.now}) @trace.valid? @trace.errors.add(:gpx_file, "can't be blank") end @@ -196,7 +204,7 @@ class TraceController < ApplicationController conditions[0] += " AND users.display_name = ?" conditions << params[:display_name] end - + if params[:tag] conditions[0] += " AND EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)" conditions << params[:tag] @@ -286,7 +294,7 @@ class TraceController < ApplicationController end end -private + private def do_create(file, tags, description, public) name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, '_') @@ -295,7 +303,7 @@ private File.open(filename, "w") { |f| f.write(file.read) } @trace = Trace.new({:name => name, :tagstring => tags, - :description => description, :public => public}) + :description => description, :public => public}) @trace.inserted = false @trace.user = @user @trace.timestamp = Time.now From a6b8346c18860dd8aa0b0a26a4e1ebdb171cd907 Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Sat, 3 May 2008 14:45:15 +0000 Subject: [PATCH 3/4] fix migration to remove original stupid index hopefully --- db/migrate/012_add_user_preference_id.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/012_add_user_preference_id.rb b/db/migrate/012_add_user_preference_id.rb index 9dee2378a..7357ca9b2 100644 --- a/db/migrate/012_add_user_preference_id.rb +++ b/db/migrate/012_add_user_preference_id.rb @@ -1,7 +1,7 @@ class AddUserPreferenceId < ActiveRecord::Migration def self.up + remove_index 'user_preferences', ['id', 'k'] add_column "user_preferences", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT" - add_index "user_preferences", ["id"], :name => "user_preferences_id_idx" end From e15fa25639e96c7c1582d793b5b6c22c1969d2f9 Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Sat, 3 May 2008 14:56:43 +0000 Subject: [PATCH 4/4] rails_port: fix migration to create a primary key with auto increment (don't know if that will actually generate valid keys if there is already data in the table.) --- db/migrate/012_add_user_preference_id.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/migrate/012_add_user_preference_id.rb b/db/migrate/012_add_user_preference_id.rb index 7357ca9b2..e644e87a1 100644 --- a/db/migrate/012_add_user_preference_id.rb +++ b/db/migrate/012_add_user_preference_id.rb @@ -1,7 +1,9 @@ class AddUserPreferenceId < ActiveRecord::Migration def self.up - remove_index 'user_preferences', ['id', 'k'] - add_column "user_preferences", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT" + remove_primary_key 'user_preferences' + add_column "user_preferences", "id", :bigint, :limit => 64, :null => false + add_primary_key "user_preferences", ["id"] + change_column "user_preferences", "id", :bigint, :limit => 64, :null => false, :options => "AUTO_INCREMENT" add_index "user_preferences", ["id"], :name => "user_preferences_id_idx" end