- 'app/controllers/application_controller.rb'
- 'app/controllers/geocoder_controller.rb'
- 'app/controllers/notes_controller.rb'
- - 'app/controllers/trace_controller.rb'
+ - 'app/controllers/traces_controller.rb'
- 'app/controllers/user_controller.rb'
- 'app/controllers/user_preferences_controller.rb'
- 'app/helpers/application_helper.rb'
if gpx_file.identifiable?
track << (XML::Node.new("name") << gpx_file.name)
track << (XML::Node.new("desc") << gpx_file.description)
- track << (XML::Node.new("url") << url_for(:controller => "trace", :action => "view", :display_name => gpx_file.user.display_name, :id => gpx_file.id))
+ track << (XML::Node.new("url") << url_for(:controller => "traces", :action => "view", :display_name => gpx_file.user.display_name, :id => gpx_file.id))
end
else
# use the anonymous track segment if the user hasn't allowed
-class TraceController < ApplicationController
+class TracesController < ApplicationController
layout "site", :except => :georss
skip_before_action :verify_authenticity_token, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
elsif current_user.nil? || @trace.user != current_user
head :forbidden
else
- @title = t "trace.edit.title", :name => @trace.name
+ @title = t ".title", :name => @trace.name
if request.post? && params[:trace]
@trace.description = params[:trace][:description]
end
def offline_warning
- flash.now[:warning] = t "trace.offline_warning.message" if STATUS == :gpx_offline
+ flash.now[:warning] = t "traces.offline_warning.message" if STATUS == :gpx_offline
end
def offline_redirect
-<%= image_tag(url_for(:controller => :trace, :action => :icon, :id => description.id, :display_name => description.user.display_name)) %>
+<%= image_tag(url_for(:controller => :traces, :action => :icon, :id => description.id, :display_name => description.user.display_name)) %>
<% if description.size -%>
<%= t ".description_with_count", :count => description.size, :user => description.user.display_name %>
<% else -%>
<td class="<%= cl %>">
<% if STATUS != :gpx_offline %>
<% if trace.inserted %>
- <a href="<%= url_for :controller => 'trace', :action => 'view', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'trace', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
+ <a href="<%= url_for :controller => 'traces', :action => 'view', :id => trace.id, :display_name => trace.user.display_name %>"><img src="<%= url_for :controller => 'traces', :action => 'icon', :id => trace.id, :display_name => trace.user.display_name %>" border="0" alt="" /></a>
<% else %>
<span class="trace_pending"><%= t '.pending' %></span>
<% end %>
<% end %>
</td>
- <td class="<%= cl %>"><%= link_to trace.name, {:controller => 'trace', :action => 'view', :display_name => trace.user.display_name, :id => trace.id} %>
+ <td class="<%= cl %>"><%= link_to trace.name, { :controller => 'traces', :action => 'view', :display_name => trace.user.display_name, :id => trace.id } %>
<span class="trace_summary" title="<%= trace.timestamp %>"> ...
<% if trace.inserted %>
(<%= t '.count_points', :count => trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/,'\1,') %>)
</div>
<div class='form-row'>
<label class="standard-label"><%= t '.visibility' %></label>
- <%= f.select :visibility, [[t('trace.visibility.private'),"private"],[t('trace.visibility.public'),"public"],[t('trace.visibility.trackable'),"trackable"],[t('trace.visibility.identifiable'),"identifiable"]] %>
+ <%= f.select :visibility, [[t('traces.visibility.private'),"private"],[t('traces.visibility.public'),"public"],[t('traces.visibility.trackable'),"trackable"],[t('traces.visibility.identifiable'),"identifiable"]] %>
<span class="form-help deemphasize">(<a href="<%= t '.visibility_help_url' %>"><%= t '.visibility_help' %></a>)</span>
</div>
</fieldset>
<h2><%= t '.heading', :name => h(@trace.name) %></h2>
<% end %>
-<img src="<%= url_for :controller => 'trace', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
+<img src="<%= url_for :controller => 'traces', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
<%= form_for @trace, :method => :post, :url => { :action => "edit" } do |f| %>
</div>
<div class='form-row'>
<label class='standard-label'><%= t '.visibility' %></label>
- <%= f.select :visibility, [[t('trace.visibility.private'),"private"], [t('trace.visibility.public'),"public"], [t('trace.visibility.trackable'),"trackable"], [t('trace.visibility.identifiable'),"identifiable"]] %> (<a href="<%= t '.visibility_help_url' %>"><%= t '.visibility_help' %></a>)
+ <%= f.select :visibility, [[t('traces.visibility.private'),"private"], [t('traces.visibility.public'),"public"], [t('traces.visibility.trackable'),"trackable"], [t('traces.visibility.identifiable'),"identifiable"]] %> (<a href="<%= t '.visibility_help_url' %>"><%= t '.visibility_help' %></a>)
</div>
</fieldset>
xml.channel do
xml.title t(".title")
xml.description t(".title")
- xml.link url_for(:controller => :trace, :action => :list, :only_path => false)
+ xml.link url_for(:controller => :traces, :action => :list, :only_path => false)
xml.image do
xml.url image_url("mag_map-rss2.0.png")
- xml.title t("trace.georss.title")
+ xml.title t(".title")
xml.width 100
xml.height 100
- xml.link url_for(:controller => :trace, :action => :list, :only_path => false)
+ xml.link url_for(:controller => :traces, :action => :list, :only_path => false)
end
@traces.each do |trace|
xml.item do
xml.title trace.name
- xml.link url_for(:controller => :trace, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
- xml.guid url_for(:controller => :trace, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
+ xml.link url_for(:controller => :traces, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
+ xml.guid url_for(:controller => :traces, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
xml.description do
xml.cdata! render(:partial => "description", :object => trace, :formats => [:html])
<li><%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %></li>
<li><%= link_to t('.upload_trace'), :action => 'create' %></li>
<% if @tag %>
- <li><%= link_to t('.see_all_traces'), :controller => 'trace', :action => 'list', :display_name => nil, :tag => nil, :page => nil %></li>
+ <li><%= link_to t('.see_all_traces'), :controller => 'traces', :action => 'list', :display_name => nil, :tag => nil, :page => nil %></li>
<li><%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %></li>
<% else %>
<% if @display_name %>
- <li><%= link_to t('.see_all_traces'), :controller => 'trace', :action => 'list', :display_name => nil, :tag => nil, :page => nil %></li>
+ <li><%= link_to t('.see_all_traces'), :controller => 'traces', :action => 'list', :display_name => nil, :tag => nil, :page => nil %></li>
<% end %>
<%= unless_user(@target_user, :li) do %>
<%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %>
<% if STATUS != :gpx_offline %>
<% if @trace.inserted %>
- <img src="<%= url_for :controller => 'trace', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
+ <img src="<%= url_for :controller => 'traces', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
<% else %>
<span class="trace_pending"><%= t '.pending' %></span>
<% end %>
<td><%= t '.tags' %></td>
<td>
<% unless @trace.tags.empty? %>
- <%= raw(@trace.tags.collect { |tag| link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } }.join(", ")) %>
+ <%= raw(@trace.tags.collect { |tag| link_to tag.tag, { :controller => 'traces', :action => 'list', :tag => tag.tag, :id => nil } }.join(", ")) %>
<% else %>
<i><%= t '.none' %></i>
<% end %>
</tr>
<tr>
<td><%= t '.visibility' %></td>
- <td><%= t "trace.visibility.#{@trace.visibility}" %></td>
+ <td><%= t "traces.visibility.#{@trace.visibility}" %></td>
</tr>
</table>
<%= if_user(@trace.user) do %>
<%= button_to t('.edit_track'), trace_edit_path(@trace) %>
<% end %>
- <%= button_to t('.delete_track'), { :controller => 'trace', :action => 'delete', :id => @trace.id }, :data => { :confirm => t('.confirm_delete') } %>
+ <%= button_to t('.delete_track'), { :controller => 'traces', :action => 'delete', :id => @trace.id }, :data => { :confirm => t('.confirm_delete') } %>
</div>
<% end %>
<%= link_to t('.my notes'), :controller => 'notes', :action=> 'mine' %>
</li>
<li>
- <%= link_to t('.my traces'), :controller => 'trace', :action=>'mine' %>
+ <%= link_to t('.my traces'), :controller => 'traces', :action => 'mine' %>
<span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
</li>
<li>
<%= link_to t('.notes'), :controller => 'notes', :action=> 'mine' %>
</li>
<li>
- <%= link_to t('.traces'), :controller => 'trace', :action => 'list', :display_name => @user.display_name %>
+ <%= link_to t('.traces'), :controller => 'traces', :action => 'list', :display_name => @user.display_name %>
<span class='count-number'><%= number_with_delimiter(@user.traces.size) %></span>
</li>
Just go to <a href='%{map_url}'>the map</a> and click the note icon:
<span class='icon note'></span>. This will add a marker to the map, which you can move
by dragging. Add your message, then click save, and other mappers will investigate.
- trace:
+ traces:
visibility:
private: "Private (only shared as anonymous, unordered points)"
public: "Public (shown in trace list and as anonymous, unordered points)"
put "user/preferences/:preference_key" => "user_preferences#update_one"
delete "user/preferences/:preference_key" => "user_preferences#delete_one"
- post "gpx/create" => "trace#api_create"
- get "gpx/:id" => "trace#api_read", :id => /\d+/
- put "gpx/:id" => "trace#api_update", :id => /\d+/
- delete "gpx/:id" => "trace#api_delete", :id => /\d+/
- get "gpx/:id/details" => "trace#api_read", :id => /\d+/
- get "gpx/:id/data" => "trace#api_data"
+ post "gpx/create" => "traces#api_create"
+ get "gpx/:id" => "traces#api_read", :id => /\d+/
+ put "gpx/:id" => "traces#api_update", :id => /\d+/
+ delete "gpx/:id" => "traces#api_delete", :id => /\d+/
+ get "gpx/:id/details" => "traces#api_read", :id => /\d+/
+ get "gpx/:id/data" => "traces#api_data"
# AMF (ActionScript) API
post "amf/read" => "amf#amf_read"
post "/preview/:type" => "site#preview", :as => :preview
# traces
- get "/user/:display_name/traces/tag/:tag/page/:page" => "trace#list", :page => /[1-9][0-9]*/
- get "/user/:display_name/traces/tag/:tag" => "trace#list"
- get "/user/:display_name/traces/page/:page" => "trace#list", :page => /[1-9][0-9]*/
- get "/user/:display_name/traces" => "trace#list"
- get "/user/:display_name/traces/tag/:tag/rss" => "trace#georss", :defaults => { :format => :rss }
- get "/user/:display_name/traces/rss" => "trace#georss", :defaults => { :format => :rss }
- get "/user/:display_name/traces/:id" => "trace#view"
- get "/user/:display_name/traces/:id/picture" => "trace#picture"
- get "/user/:display_name/traces/:id/icon" => "trace#icon"
- get "/traces/tag/:tag/page/:page" => "trace#list", :page => /[1-9][0-9]*/
- get "/traces/tag/:tag" => "trace#list"
- get "/traces/page/:page" => "trace#list", :page => /[1-9][0-9]*/
- get "/traces" => "trace#list"
- get "/traces/tag/:tag/rss" => "trace#georss", :defaults => { :format => :rss }
- get "/traces/rss" => "trace#georss", :defaults => { :format => :rss }
- get "/traces/mine/tag/:tag/page/:page" => "trace#mine", :page => /[1-9][0-9]*/
- get "/traces/mine/tag/:tag" => "trace#mine"
- get "/traces/mine/page/:page" => "trace#mine"
- get "/traces/mine" => "trace#mine"
- match "/trace/create" => "trace#create", :via => [:get, :post]
- get "/trace/:id/data" => "trace#data", :id => /\d+/, :as => "trace_data"
- match "/trace/:id/edit" => "trace#edit", :via => [:get, :post], :id => /\d+/, :as => "trace_edit"
- post "/trace/:id/delete" => "trace#delete", :id => /\d+/
+ get "/user/:display_name/traces/tag/:tag/page/:page" => "traces#list", :page => /[1-9][0-9]*/
+ get "/user/:display_name/traces/tag/:tag" => "traces#list"
+ get "/user/:display_name/traces/page/:page" => "traces#list", :page => /[1-9][0-9]*/
+ get "/user/:display_name/traces" => "traces#list"
+ get "/user/:display_name/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
+ get "/user/:display_name/traces/rss" => "traces#georss", :defaults => { :format => :rss }
+ get "/user/:display_name/traces/:id" => "traces#view"
+ get "/user/:display_name/traces/:id/picture" => "traces#picture"
+ get "/user/:display_name/traces/:id/icon" => "traces#icon"
+ get "/traces/tag/:tag/page/:page" => "traces#list", :page => /[1-9][0-9]*/
+ get "/traces/tag/:tag" => "traces#list"
+ get "/traces/page/:page" => "traces#list", :page => /[1-9][0-9]*/
+ get "/traces" => "traces#list"
+ get "/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
+ get "/traces/rss" => "traces#georss", :defaults => { :format => :rss }
+ get "/traces/mine/tag/:tag/page/:page" => "traces#mine", :page => /[1-9][0-9]*/
+ get "/traces/mine/tag/:tag" => "traces#mine"
+ get "/traces/mine/page/:page" => "traces#mine"
+ get "/traces/mine" => "traces#mine"
+ match "/trace/create" => "traces#create", :via => [:get, :post]
+ get "/trace/:id/data" => "traces#data", :id => /\d+/, :as => "trace_data"
+ match "/trace/:id/edit" => "traces#edit", :via => [:get, :post], :id => /\d+/, :as => "trace_edit"
+ post "/trace/:id/delete" => "traces#delete", :id => /\d+/
# diary pages
match "/diary/new" => "diary_entry#new", :via => [:get, :post]
require "digest"
require "minitest/mock"
-class TraceControllerTest < ActionController::TestCase
+class TracesControllerTest < ActionController::TestCase
def setup
@gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR")
Object.const_set("GPX_TRACE_DIR", Rails.root.join("test", "gpx", "traces"))
def test_routes
assert_routing(
{ :path => "/api/0.6/gpx/create", :method => :post },
- { :controller => "trace", :action => "api_create" }
+ { :controller => "traces", :action => "api_create" }
)
assert_routing(
{ :path => "/api/0.6/gpx/1", :method => :get },
- { :controller => "trace", :action => "api_read", :id => "1" }
+ { :controller => "traces", :action => "api_read", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/gpx/1", :method => :put },
- { :controller => "trace", :action => "api_update", :id => "1" }
+ { :controller => "traces", :action => "api_update", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/gpx/1", :method => :delete },
- { :controller => "trace", :action => "api_delete", :id => "1" }
+ { :controller => "traces", :action => "api_delete", :id => "1" }
)
assert_recognizes(
- { :controller => "trace", :action => "api_read", :id => "1" },
+ { :controller => "traces", :action => "api_read", :id => "1" },
{ :path => "/api/0.6/gpx/1/details", :method => :get }
)
assert_routing(
{ :path => "/api/0.6/gpx/1/data", :method => :get },
- { :controller => "trace", :action => "api_data", :id => "1" }
+ { :controller => "traces", :action => "api_data", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/gpx/1/data.xml", :method => :get },
- { :controller => "trace", :action => "api_data", :id => "1", :format => "xml" }
+ { :controller => "traces", :action => "api_data", :id => "1", :format => "xml" }
)
assert_routing(
{ :path => "/traces", :method => :get },
- { :controller => "trace", :action => "list" }
+ { :controller => "traces", :action => "list" }
)
assert_routing(
{ :path => "/traces/page/1", :method => :get },
- { :controller => "trace", :action => "list", :page => "1" }
+ { :controller => "traces", :action => "list", :page => "1" }
)
assert_routing(
{ :path => "/traces/tag/tagname", :method => :get },
- { :controller => "trace", :action => "list", :tag => "tagname" }
+ { :controller => "traces", :action => "list", :tag => "tagname" }
)
assert_routing(
{ :path => "/traces/tag/tagname/page/1", :method => :get },
- { :controller => "trace", :action => "list", :tag => "tagname", :page => "1" }
+ { :controller => "traces", :action => "list", :tag => "tagname", :page => "1" }
)
assert_routing(
{ :path => "/user/username/traces", :method => :get },
- { :controller => "trace", :action => "list", :display_name => "username" }
+ { :controller => "traces", :action => "list", :display_name => "username" }
)
assert_routing(
{ :path => "/user/username/traces/page/1", :method => :get },
- { :controller => "trace", :action => "list", :display_name => "username", :page => "1" }
+ { :controller => "traces", :action => "list", :display_name => "username", :page => "1" }
)
assert_routing(
{ :path => "/user/username/traces/tag/tagname", :method => :get },
- { :controller => "trace", :action => "list", :display_name => "username", :tag => "tagname" }
+ { :controller => "traces", :action => "list", :display_name => "username", :tag => "tagname" }
)
assert_routing(
{ :path => "/user/username/traces/tag/tagname/page/1", :method => :get },
- { :controller => "trace", :action => "list", :display_name => "username", :tag => "tagname", :page => "1" }
+ { :controller => "traces", :action => "list", :display_name => "username", :tag => "tagname", :page => "1" }
)
assert_routing(
{ :path => "/traces/mine", :method => :get },
- { :controller => "trace", :action => "mine" }
+ { :controller => "traces", :action => "mine" }
)
assert_routing(
{ :path => "/traces/mine/page/1", :method => :get },
- { :controller => "trace", :action => "mine", :page => "1" }
+ { :controller => "traces", :action => "mine", :page => "1" }
)
assert_routing(
{ :path => "/traces/mine/tag/tagname", :method => :get },
- { :controller => "trace", :action => "mine", :tag => "tagname" }
+ { :controller => "traces", :action => "mine", :tag => "tagname" }
)
assert_routing(
{ :path => "/traces/mine/tag/tagname/page/1", :method => :get },
- { :controller => "trace", :action => "mine", :tag => "tagname", :page => "1" }
+ { :controller => "traces", :action => "mine", :tag => "tagname", :page => "1" }
)
assert_routing(
{ :path => "/traces/rss", :method => :get },
- { :controller => "trace", :action => "georss", :format => :rss }
+ { :controller => "traces", :action => "georss", :format => :rss }
)
assert_routing(
{ :path => "/traces/tag/tagname/rss", :method => :get },
- { :controller => "trace", :action => "georss", :tag => "tagname", :format => :rss }
+ { :controller => "traces", :action => "georss", :tag => "tagname", :format => :rss }
)
assert_routing(
{ :path => "/user/username/traces/rss", :method => :get },
- { :controller => "trace", :action => "georss", :display_name => "username", :format => :rss }
+ { :controller => "traces", :action => "georss", :display_name => "username", :format => :rss }
)
assert_routing(
{ :path => "/user/username/traces/tag/tagname/rss", :method => :get },
- { :controller => "trace", :action => "georss", :display_name => "username", :tag => "tagname", :format => :rss }
+ { :controller => "traces", :action => "georss", :display_name => "username", :tag => "tagname", :format => :rss }
)
assert_routing(
{ :path => "/user/username/traces/1", :method => :get },
- { :controller => "trace", :action => "view", :display_name => "username", :id => "1" }
+ { :controller => "traces", :action => "view", :display_name => "username", :id => "1" }
)
assert_routing(
{ :path => "/user/username/traces/1/picture", :method => :get },
- { :controller => "trace", :action => "picture", :display_name => "username", :id => "1" }
+ { :controller => "traces", :action => "picture", :display_name => "username", :id => "1" }
)
assert_routing(
{ :path => "/user/username/traces/1/icon", :method => :get },
- { :controller => "trace", :action => "icon", :display_name => "username", :id => "1" }
+ { :controller => "traces", :action => "icon", :display_name => "username", :id => "1" }
)
assert_routing(
{ :path => "/trace/create", :method => :get },
- { :controller => "trace", :action => "create" }
+ { :controller => "traces", :action => "create" }
)
assert_routing(
{ :path => "/trace/create", :method => :post },
- { :controller => "trace", :action => "create" }
+ { :controller => "traces", :action => "create" }
)
assert_routing(
{ :path => "/trace/1/data", :method => :get },
- { :controller => "trace", :action => "data", :id => "1" }
+ { :controller => "traces", :action => "data", :id => "1" }
)
assert_routing(
{ :path => "/trace/1/data.xml", :method => :get },
- { :controller => "trace", :action => "data", :id => "1", :format => "xml" }
+ { :controller => "traces", :action => "data", :id => "1", :format => "xml" }
)
assert_routing(
{ :path => "/trace/1/edit", :method => :get },
- { :controller => "trace", :action => "edit", :id => "1" }
+ { :controller => "traces", :action => "edit", :id => "1" }
)
assert_routing(
{ :path => "/trace/1/edit", :method => :post },
- { :controller => "trace", :action => "edit", :id => "1" }
+ { :controller => "traces", :action => "edit", :id => "1" }
)
assert_routing(
{ :path => "/trace/1/delete", :method => :post },
- { :controller => "trace", :action => "delete", :id => "1" }
+ { :controller => "traces", :action => "delete", :id => "1" }
)
end
# Now try when logged in
get :mine, :session => { :user => user }
- assert_redirected_to :controller => "trace", :action => "list", :display_name => user.display_name
+ assert_redirected_to :action => "list", :display_name => user.display_name
# Fetch the actual list
get :list, :params => { :display_name => user.display_name }, :session => { :user => user }