@action = action
@display_name = target_user.display_name if target_user
@all_tags = tagset.values
+ @trace = Trace.new(:visibility => default_visibility) if @user
end
def mine
- # Load the preference of whether the user set the trace public the last time
- @trace = Trace.new
- visibility = @user.preferences.find(:first, :conditions => {:k => "gps.trace.visibility"})
- if visibility
- @trace.visibility = visibility.v
- elsif @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil?
- @trace.visibility = "private"
- else
- @trace.visibility = "public"
- end
- list(@user, "mine")
+ redirect_to :action => :list, :display_name => @user.display_name
end
def view
redirect_to :action => :offline if OSM_STATUS == :gpx_offline
end
+ def default_visibility
+ visibility = @user.preferences.find(:first, :conditions => {:k => "gps.trace.visibility"})
+
+ if visibility
+ visibility.v
+ elsif @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil?
+ "private"
+ else
+ "public"
+ end
+ end
+
end
+<% if @user.traces.count(:conditions => ["inserted=?", false]) > 4 %>
+ <p><%= t'trace.trace_header.traces_waiting', :count => @user.traces.count(:conditions => ["inserted=?", false]) %></p>
+<% end %>
+
<% form_for :trace, @trace, :url => { :action => "create" }, :html => { :multipart => true } do |f| %>
<table>
<tr><td align="right"><%= t'trace.trace_form.upload_gpx' %></td><td><%= f.file_field :gpx_file, :size => 50, :maxlength => 255 %></td></tr>
| <%= link_to t('trace.trace_header.see_your_traces'), :controller => 'trace', :action => 'mine' %>
<% end %>
</p>
-
-<% if @user and @user.traces.count(:conditions => ["inserted=?", false]) > 4 %>
- <p><%= t'trace.trace_header.traces_waiting', :count => @user.traces.count(:conditions => ["inserted=?", false]) %></p>
-<% end %>
<%= render :partial => 'trace_header' %>
-
+<% if @user and @user.display_name == @display_name %>
+ <%= render :partial => 'trace_form' %>
+<% end %>
<%= render :partial => 'trace_list' %>
+++ /dev/null
-<%= render :partial => 'trace_header' %>
-<%= render :partial => 'trace_form' %>
-<%= render :partial => 'trace_list' %>