Merge remote-tracking branch 'upstream/pull/1857'
This commit is contained in:
commit
33ea119c8f
17 changed files with 89 additions and 89 deletions
|
@ -33,7 +33,7 @@ Lint/AssignmentInCondition:
|
||||||
- 'app/controllers/application_controller.rb'
|
- 'app/controllers/application_controller.rb'
|
||||||
- 'app/controllers/geocoder_controller.rb'
|
- 'app/controllers/geocoder_controller.rb'
|
||||||
- 'app/controllers/notes_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_controller.rb'
|
||||||
- 'app/controllers/user_preferences_controller.rb'
|
- 'app/controllers/user_preferences_controller.rb'
|
||||||
- 'app/helpers/application_helper.rb'
|
- 'app/helpers/application_helper.rb'
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ApiController < ApplicationController
|
||||||
if gpx_file.identifiable?
|
if gpx_file.identifiable?
|
||||||
track << (XML::Node.new("name") << gpx_file.name)
|
track << (XML::Node.new("name") << gpx_file.name)
|
||||||
track << (XML::Node.new("desc") << gpx_file.description)
|
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
|
end
|
||||||
else
|
else
|
||||||
# use the anonymous track segment if the user hasn't allowed
|
# use the anonymous track segment if the user hasn't allowed
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class TraceController < ApplicationController
|
class TracesController < ApplicationController
|
||||||
layout "site", :except => :georss
|
layout "site", :except => :georss
|
||||||
|
|
||||||
skip_before_action :verify_authenticity_token, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
|
skip_before_action :verify_authenticity_token, :only => [:api_create, :api_read, :api_update, :api_delete, :api_data]
|
||||||
|
@ -167,7 +167,7 @@ class TraceController < ApplicationController
|
||||||
elsif current_user.nil? || @trace.user != current_user
|
elsif current_user.nil? || @trace.user != current_user
|
||||||
head :forbidden
|
head :forbidden
|
||||||
else
|
else
|
||||||
@title = t "trace.edit.title", :name => @trace.name
|
@title = t ".title", :name => @trace.name
|
||||||
|
|
||||||
if request.post? && params[:trace]
|
if request.post? && params[:trace]
|
||||||
@trace.description = params[:trace][:description]
|
@trace.description = params[:trace][:description]
|
||||||
|
@ -384,7 +384,7 @@ class TraceController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def offline_warning
|
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
|
end
|
||||||
|
|
||||||
def offline_redirect
|
def offline_redirect
|
|
@ -1,4 +1,4 @@
|
||||||
<%= 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 -%>
|
<% if description.size -%>
|
||||||
<%= t ".description_with_count", :count => description.size, :user => description.user.display_name %>
|
<%= t ".description_with_count", :count => description.size, :user => description.user.display_name %>
|
||||||
<% else -%>
|
<% else -%>
|
|
@ -3,13 +3,13 @@
|
||||||
<td class="<%= cl %>">
|
<td class="<%= cl %>">
|
||||||
<% if STATUS != :gpx_offline %>
|
<% if STATUS != :gpx_offline %>
|
||||||
<% if trace.inserted %>
|
<% 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 %>
|
<% else %>
|
||||||
<span class="trace_pending"><%= t '.pending' %></span>
|
<span class="trace_pending"><%= t '.pending' %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</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 %>"> ...
|
<span class="trace_summary" title="<%= trace.timestamp %>"> ...
|
||||||
<% if trace.inserted %>
|
<% if trace.inserted %>
|
||||||
(<%= t '.count_points', :count => trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/,'\1,') %>)
|
(<%= t '.count_points', :count => trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/,'\1,') %>)
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class='form-row'>
|
<div class='form-row'>
|
||||||
<label class="standard-label"><%= t '.visibility' %></label>
|
<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>
|
<span class="form-help deemphasize">(<a href="<%= t '.visibility_help_url' %>"><%= t '.visibility_help' %></a>)</span>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
|
@ -2,7 +2,7 @@
|
||||||
<h2><%= t '.heading', :name => h(@trace.name) %></h2>
|
<h2><%= t '.heading', :name => h(@trace.name) %></h2>
|
||||||
<% end %>
|
<% 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| %>
|
<%= form_for @trace, :method => :post, :url => { :action => "edit" } do |f| %>
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class='form-row'>
|
<div class='form-row'>
|
||||||
<label class='standard-label'><%= t '.visibility' %></label>
|
<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>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -7,22 +7,22 @@ xml.rss("version" => "2.0",
|
||||||
xml.channel do
|
xml.channel do
|
||||||
xml.title t(".title")
|
xml.title t(".title")
|
||||||
xml.description 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.image do
|
||||||
xml.url image_url("mag_map-rss2.0.png")
|
xml.url image_url("mag_map-rss2.0.png")
|
||||||
xml.title t("trace.georss.title")
|
xml.title t(".title")
|
||||||
xml.width 100
|
xml.width 100
|
||||||
xml.height 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
|
end
|
||||||
|
|
||||||
@traces.each do |trace|
|
@traces.each do |trace|
|
||||||
xml.item do
|
xml.item do
|
||||||
xml.title trace.name
|
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.link url_for(:controller => :traces, :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.guid url_for(:controller => :traces, :action => :view, :id => trace.id, :display_name => trace.user.display_name, :only_path => false)
|
||||||
|
|
||||||
xml.description do
|
xml.description do
|
||||||
xml.cdata! render(:partial => "description", :object => trace, :formats => [:html])
|
xml.cdata! render(:partial => "description", :object => trace, :formats => [:html])
|
|
@ -5,11 +5,11 @@
|
||||||
<li><%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %></li>
|
<li><%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %></li>
|
||||||
<li><%= link_to t('.upload_trace'), :action => 'create' %></li>
|
<li><%= link_to t('.upload_trace'), :action => 'create' %></li>
|
||||||
<% if @tag %>
|
<% 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>
|
<li><%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %></li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if @display_name %>
|
<% 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 %>
|
<% end %>
|
||||||
<%= unless_user(@target_user, :li) do %>
|
<%= unless_user(@target_user, :li) do %>
|
||||||
<%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %>
|
<%= link_to t('.see_my_traces'), :action => 'mine', :tag => nil, :page => nil %>
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<% if STATUS != :gpx_offline %>
|
<% if STATUS != :gpx_offline %>
|
||||||
<% if @trace.inserted %>
|
<% 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 %>
|
<% else %>
|
||||||
<span class="trace_pending"><%= t '.pending' %></span>
|
<span class="trace_pending"><%= t '.pending' %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<td><%= t '.tags' %></td>
|
<td><%= t '.tags' %></td>
|
||||||
<td>
|
<td>
|
||||||
<% unless @trace.tags.empty? %>
|
<% 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 %>
|
<% else %>
|
||||||
<i><%= t '.none' %></i>
|
<i><%= t '.none' %></i>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= t '.visibility' %></td>
|
<td><%= t '.visibility' %></td>
|
||||||
<td><%= t "trace.visibility.#{@trace.visibility}" %></td>
|
<td><%= t "traces.visibility.#{@trace.visibility}" %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
@ -59,6 +59,6 @@
|
||||||
<%= if_user(@trace.user) do %>
|
<%= if_user(@trace.user) do %>
|
||||||
<%= button_to t('.edit_track'), trace_edit_path(@trace) %>
|
<%= button_to t('.edit_track'), trace_edit_path(@trace) %>
|
||||||
<% end %>
|
<% 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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
|
@ -14,7 +14,7 @@
|
||||||
<%= link_to t('.my notes'), :controller => 'notes', :action=> 'mine' %>
|
<%= link_to t('.my notes'), :controller => 'notes', :action=> 'mine' %>
|
||||||
</li>
|
</li>
|
||||||
<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>
|
<span class='count-number'><%= number_with_delimiter(current_user.traces.size) %></span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
<%= link_to t('.notes'), :controller => 'notes', :action=> 'mine' %>
|
<%= link_to t('.notes'), :controller => 'notes', :action=> 'mine' %>
|
||||||
</li>
|
</li>
|
||||||
<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>
|
<span class='count-number'><%= number_with_delimiter(@user.traces.size) %></span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -1569,7 +1569,7 @@ en:
|
||||||
Just go to <a href='%{map_url}'>the map</a> and click the note icon:
|
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
|
<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.
|
by dragging. Add your message, then click save, and other mappers will investigate.
|
||||||
trace:
|
traces:
|
||||||
visibility:
|
visibility:
|
||||||
private: "Private (only shared as anonymous, unordered points)"
|
private: "Private (only shared as anonymous, unordered points)"
|
||||||
public: "Public (shown in trace list and as anonymous, unordered points)"
|
public: "Public (shown in trace list and as anonymous, unordered points)"
|
||||||
|
|
|
@ -74,12 +74,12 @@ OpenStreetMap::Application.routes.draw do
|
||||||
put "user/preferences/:preference_key" => "user_preferences#update_one"
|
put "user/preferences/:preference_key" => "user_preferences#update_one"
|
||||||
delete "user/preferences/:preference_key" => "user_preferences#delete_one"
|
delete "user/preferences/:preference_key" => "user_preferences#delete_one"
|
||||||
|
|
||||||
post "gpx/create" => "trace#api_create"
|
post "gpx/create" => "traces#api_create"
|
||||||
get "gpx/:id" => "trace#api_read", :id => /\d+/
|
get "gpx/:id" => "traces#api_read", :id => /\d+/
|
||||||
put "gpx/:id" => "trace#api_update", :id => /\d+/
|
put "gpx/:id" => "traces#api_update", :id => /\d+/
|
||||||
delete "gpx/:id" => "trace#api_delete", :id => /\d+/
|
delete "gpx/:id" => "traces#api_delete", :id => /\d+/
|
||||||
get "gpx/:id/details" => "trace#api_read", :id => /\d+/
|
get "gpx/:id/details" => "traces#api_read", :id => /\d+/
|
||||||
get "gpx/:id/data" => "trace#api_data"
|
get "gpx/:id/data" => "traces#api_data"
|
||||||
|
|
||||||
# AMF (ActionScript) API
|
# AMF (ActionScript) API
|
||||||
post "amf/read" => "amf#amf_read"
|
post "amf/read" => "amf#amf_read"
|
||||||
|
@ -188,29 +188,29 @@ OpenStreetMap::Application.routes.draw do
|
||||||
post "/preview/:type" => "site#preview", :as => :preview
|
post "/preview/:type" => "site#preview", :as => :preview
|
||||||
|
|
||||||
# traces
|
# traces
|
||||||
get "/user/:display_name/traces/tag/:tag/page/:page" => "trace#list", :page => /[1-9][0-9]*/
|
get "/user/:display_name/traces/tag/:tag/page/:page" => "traces#list", :page => /[1-9][0-9]*/
|
||||||
get "/user/:display_name/traces/tag/:tag" => "trace#list"
|
get "/user/:display_name/traces/tag/:tag" => "traces#list"
|
||||||
get "/user/:display_name/traces/page/:page" => "trace#list", :page => /[1-9][0-9]*/
|
get "/user/:display_name/traces/page/:page" => "traces#list", :page => /[1-9][0-9]*/
|
||||||
get "/user/:display_name/traces" => "trace#list"
|
get "/user/:display_name/traces" => "traces#list"
|
||||||
get "/user/:display_name/traces/tag/:tag/rss" => "trace#georss", :defaults => { :format => :rss }
|
get "/user/:display_name/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
|
||||||
get "/user/:display_name/traces/rss" => "trace#georss", :defaults => { :format => :rss }
|
get "/user/:display_name/traces/rss" => "traces#georss", :defaults => { :format => :rss }
|
||||||
get "/user/:display_name/traces/:id" => "trace#view"
|
get "/user/:display_name/traces/:id" => "traces#view"
|
||||||
get "/user/:display_name/traces/:id/picture" => "trace#picture"
|
get "/user/:display_name/traces/:id/picture" => "traces#picture"
|
||||||
get "/user/:display_name/traces/:id/icon" => "trace#icon"
|
get "/user/:display_name/traces/:id/icon" => "traces#icon"
|
||||||
get "/traces/tag/:tag/page/:page" => "trace#list", :page => /[1-9][0-9]*/
|
get "/traces/tag/:tag/page/:page" => "traces#list", :page => /[1-9][0-9]*/
|
||||||
get "/traces/tag/:tag" => "trace#list"
|
get "/traces/tag/:tag" => "traces#list"
|
||||||
get "/traces/page/:page" => "trace#list", :page => /[1-9][0-9]*/
|
get "/traces/page/:page" => "traces#list", :page => /[1-9][0-9]*/
|
||||||
get "/traces" => "trace#list"
|
get "/traces" => "traces#list"
|
||||||
get "/traces/tag/:tag/rss" => "trace#georss", :defaults => { :format => :rss }
|
get "/traces/tag/:tag/rss" => "traces#georss", :defaults => { :format => :rss }
|
||||||
get "/traces/rss" => "trace#georss", :defaults => { :format => :rss }
|
get "/traces/rss" => "traces#georss", :defaults => { :format => :rss }
|
||||||
get "/traces/mine/tag/:tag/page/:page" => "trace#mine", :page => /[1-9][0-9]*/
|
get "/traces/mine/tag/:tag/page/:page" => "traces#mine", :page => /[1-9][0-9]*/
|
||||||
get "/traces/mine/tag/:tag" => "trace#mine"
|
get "/traces/mine/tag/:tag" => "traces#mine"
|
||||||
get "/traces/mine/page/:page" => "trace#mine"
|
get "/traces/mine/page/:page" => "traces#mine"
|
||||||
get "/traces/mine" => "trace#mine"
|
get "/traces/mine" => "traces#mine"
|
||||||
match "/trace/create" => "trace#create", :via => [:get, :post]
|
match "/trace/create" => "traces#create", :via => [:get, :post]
|
||||||
get "/trace/:id/data" => "trace#data", :id => /\d+/, :as => "trace_data"
|
get "/trace/:id/data" => "traces#data", :id => /\d+/, :as => "trace_data"
|
||||||
match "/trace/:id/edit" => "trace#edit", :via => [:get, :post], :id => /\d+/, :as => "trace_edit"
|
match "/trace/:id/edit" => "traces#edit", :via => [:get, :post], :id => /\d+/, :as => "trace_edit"
|
||||||
post "/trace/:id/delete" => "trace#delete", :id => /\d+/
|
post "/trace/:id/delete" => "traces#delete", :id => /\d+/
|
||||||
|
|
||||||
# diary pages
|
# diary pages
|
||||||
match "/diary/new" => "diary_entry#new", :via => [:get, :post]
|
match "/diary/new" => "diary_entry#new", :via => [:get, :post]
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "test_helper"
|
||||||
require "digest"
|
require "digest"
|
||||||
require "minitest/mock"
|
require "minitest/mock"
|
||||||
|
|
||||||
class TraceControllerTest < ActionController::TestCase
|
class TracesControllerTest < ActionController::TestCase
|
||||||
def setup
|
def setup
|
||||||
@gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR")
|
@gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR")
|
||||||
Object.const_set("GPX_TRACE_DIR", Rails.root.join("test", "gpx", "traces"))
|
Object.const_set("GPX_TRACE_DIR", Rails.root.join("test", "gpx", "traces"))
|
||||||
|
@ -27,140 +27,140 @@ class TraceControllerTest < ActionController::TestCase
|
||||||
def test_routes
|
def test_routes
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/gpx/create", :method => :post },
|
{ :path => "/api/0.6/gpx/create", :method => :post },
|
||||||
{ :controller => "trace", :action => "api_create" }
|
{ :controller => "traces", :action => "api_create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/gpx/1", :method => :get },
|
{ :path => "/api/0.6/gpx/1", :method => :get },
|
||||||
{ :controller => "trace", :action => "api_read", :id => "1" }
|
{ :controller => "traces", :action => "api_read", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/gpx/1", :method => :put },
|
{ :path => "/api/0.6/gpx/1", :method => :put },
|
||||||
{ :controller => "trace", :action => "api_update", :id => "1" }
|
{ :controller => "traces", :action => "api_update", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/gpx/1", :method => :delete },
|
{ :path => "/api/0.6/gpx/1", :method => :delete },
|
||||||
{ :controller => "trace", :action => "api_delete", :id => "1" }
|
{ :controller => "traces", :action => "api_delete", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_recognizes(
|
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 }
|
{ :path => "/api/0.6/gpx/1/details", :method => :get }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/gpx/1/data", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/gpx/1/data.xml", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/traces", :method => :get },
|
{ :path => "/traces", :method => :get },
|
||||||
{ :controller => "trace", :action => "list" }
|
{ :controller => "traces", :action => "list" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/page/1", :method => :get },
|
{ :path => "/traces/page/1", :method => :get },
|
||||||
{ :controller => "trace", :action => "list", :page => "1" }
|
{ :controller => "traces", :action => "list", :page => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/tag/tagname", :method => :get },
|
{ :path => "/traces/tag/tagname", :method => :get },
|
||||||
{ :controller => "trace", :action => "list", :tag => "tagname" }
|
{ :controller => "traces", :action => "list", :tag => "tagname" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/tag/tagname/page/1", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces", :method => :get },
|
{ :path => "/user/username/traces", :method => :get },
|
||||||
{ :controller => "trace", :action => "list", :display_name => "username" }
|
{ :controller => "traces", :action => "list", :display_name => "username" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/page/1", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/tag/tagname", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/tag/tagname/page/1", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/traces/mine", :method => :get },
|
{ :path => "/traces/mine", :method => :get },
|
||||||
{ :controller => "trace", :action => "mine" }
|
{ :controller => "traces", :action => "mine" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/mine/page/1", :method => :get },
|
{ :path => "/traces/mine/page/1", :method => :get },
|
||||||
{ :controller => "trace", :action => "mine", :page => "1" }
|
{ :controller => "traces", :action => "mine", :page => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/mine/tag/tagname", :method => :get },
|
{ :path => "/traces/mine/tag/tagname", :method => :get },
|
||||||
{ :controller => "trace", :action => "mine", :tag => "tagname" }
|
{ :controller => "traces", :action => "mine", :tag => "tagname" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/mine/tag/tagname/page/1", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/traces/rss", :method => :get },
|
{ :path => "/traces/rss", :method => :get },
|
||||||
{ :controller => "trace", :action => "georss", :format => :rss }
|
{ :controller => "traces", :action => "georss", :format => :rss }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/traces/tag/tagname/rss", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/rss", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/tag/tagname/rss", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/1", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/1/picture", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/user/username/traces/1/icon", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/trace/create", :method => :get },
|
{ :path => "/trace/create", :method => :get },
|
||||||
{ :controller => "trace", :action => "create" }
|
{ :controller => "traces", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/trace/create", :method => :post },
|
{ :path => "/trace/create", :method => :post },
|
||||||
{ :controller => "trace", :action => "create" }
|
{ :controller => "traces", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/trace/1/data", :method => :get },
|
{ :path => "/trace/1/data", :method => :get },
|
||||||
{ :controller => "trace", :action => "data", :id => "1" }
|
{ :controller => "traces", :action => "data", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/trace/1/data.xml", :method => :get },
|
{ :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(
|
assert_routing(
|
||||||
{ :path => "/trace/1/edit", :method => :get },
|
{ :path => "/trace/1/edit", :method => :get },
|
||||||
{ :controller => "trace", :action => "edit", :id => "1" }
|
{ :controller => "traces", :action => "edit", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/trace/1/edit", :method => :post },
|
{ :path => "/trace/1/edit", :method => :post },
|
||||||
{ :controller => "trace", :action => "edit", :id => "1" }
|
{ :controller => "traces", :action => "edit", :id => "1" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/trace/1/delete", :method => :post },
|
{ :path => "/trace/1/delete", :method => :post },
|
||||||
{ :controller => "trace", :action => "delete", :id => "1" }
|
{ :controller => "traces", :action => "delete", :id => "1" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ class TraceControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# Now try when logged in
|
# Now try when logged in
|
||||||
get :mine, :session => { :user => user }
|
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
|
# Fetch the actual list
|
||||||
get :list, :params => { :display_name => user.display_name }, :session => { :user => user }
|
get :list, :params => { :display_name => user.display_name }, :session => { :user => user }
|
Loading…
Add table
Add a link
Reference in a new issue