]> git.openstreetmap.org Git - rails.git/commitdiff
Set the default trace visibility on the upload form
authorTom Hughes <tom@compton.nu>
Tue, 24 Aug 2010 20:32:07 +0000 (21:32 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 24 Aug 2010 20:32:07 +0000 (21:32 +0100)
app/controllers/trace_controller.rb

index 1a75ac4cc455786b799ef7525245d09d154ad510..3777621a4f76705e1ddc17b34e1f4f4af31b9c5b 100644 (file)
@@ -105,7 +105,6 @@ class TraceController < ApplicationController
     @target_user = target_user
     @display_name = target_user.display_name if target_user
     @all_tags = tagset.values
     @target_user = target_user
     @display_name = target_user.display_name if target_user
     @all_tags = tagset.values
-    @trace = Trace.new(:visibility => default_visibility) if @user
   end
 
   def mine
   end
 
   def mine
@@ -130,6 +129,7 @@ class TraceController < ApplicationController
   def create
     if params[:trace]
       logger.info(params[:trace][:gpx_file].class.name)
   def create
     if params[:trace]
       logger.info(params[:trace][:gpx_file].class.name)
+
       if params[:trace][:gpx_file].respond_to?(:read)
         begin
           do_create(params[:trace][:gpx_file], params[:trace][:tagstring],
       if params[:trace][:gpx_file].respond_to?(:read)
         begin
           do_create(params[:trace][:gpx_file], params[:trace][:tagstring],
@@ -158,7 +158,10 @@ class TraceController < ApplicationController
         @trace.valid?
         @trace.errors.add(:gpx_file, "can't be blank")
       end
         @trace.valid?
         @trace.errors.add(:gpx_file, "can't be blank")
       end
+    else
+      @trace = Trace.new(:visibility => default_visibility)
     end
     end
+
     @title = t 'trace.create.upload_trace'
   end
 
     @title = t 'trace.create.upload_trace'
   end