layout 'site'
before_filter :authorize_web
+ before_filter :set_locale
before_filter :require_user, :only => [:mine, :create, :edit, :delete, :make_public]
before_filter :authorize, :only => [:api_details, :api_data, :api_create]
before_filter :check_database_readable, :except => [:api_details, :api_data, :api_create]
@tag = params[:tag]
files = Tracetag.find_all_by_tag(params[:tag]).collect { |tt| tt.gpx_id }
- conditions[0] += " AND gpx_files.id IN (#{files.join(',')})"
+
+ if files.length > 0
+ conditions[0] += " AND gpx_files.id IN (#{files.join(',')})"
+ else
+ conditions[0] += " AND 0 = 1"
+ end
end
conditions[0] += " AND gpx_files.visible = ?"
end
def mine
+ # Load the preference of whether the user set the trace public the last time
+ @trace = Trace.new
+ if @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil?
+ @trace.public = false
+ else
+ @trace.public = true
+ end
list(@user, "mine")
end
@trace.errors.add(:gpx_file, "can't be blank")
end
end
+ @title = I18n.t('trace.create.upload_trace')
end
def data