Exclude:
- 'app/controllers/users_controller.rb'
- 'app/helpers/application_helper.rb'
- - 'app/helpers/changeset_helper.rb'
+ - 'app/helpers/changesets_helper.rb'
- 'app/helpers/geocoder_helper.rb'
- 'app/helpers/note_helper.rb'
- 'app/helpers/open_graph_helper.rb'
# The ChangesetController is the RESTful interface to Changeset objects
-class ChangesetController < ApplicationController
+class ChangesetsController < ApplicationController
layout "site"
require "xml/libxml"
-module ChangesetHelper
+module ChangesetsHelper
def changeset_user_link(changeset)
if changeset.user.status == "deleted"
t("users.no_such_user.deleted")
def changeset_index_title(params, user)
if params[:friends] && user
- t "changeset.index.title_friend"
+ t "changesets.index.title_friend"
elsif params[:nearby] && user
- t "changeset.index.title_nearby"
+ t "changesets.index.title_nearby"
elsif params[:display_name]
- t "changeset.index.title_user", :user => params[:display_name]
+ t "changesets.index.title_user", :user => params[:display_name]
else
- t "changeset.index.title"
+ t "changesets.index.title"
end
end
end
<% end %>
<%=
user = (@prev_by_user || @next_by_user).user.display_name
- link_to content_tag(:bdi, user), :controller => "changeset", :action => "index", :display_name => user
+ link_to content_tag(:bdi, user), :controller => "changesets", :action => "index", :display_name => user
%>
<% if @next_by_user %>
·
<% end %>
<div class='secondary-actions'>
- <%= link_to(t('.changesetxml'), :controller => "changeset", :action => "read") %>
+ <%= link_to(t('.changesetxml'), :controller => "changesets", :action => "read") %>
·
- <%= link_to(t('.osmchangexml'), :controller => "changeset", :action => "download") %>
+ <%= link_to(t('.osmchangexml'), :controller => "changesets", :action => "download") %>
</div>
<%
set_title(changeset_index_title(params, current_user))
if params[:display_name]
- @heading = t('changeset.index.title_user', :user => link_to(params[:display_name], user_path(:display_name => params[:display_name]))).html_safe
+ @heading = t('changesets.index.title_user', :user => link_to(params[:display_name], user_path(:display_name => params[:display_name]))).html_safe
else
@heading = @title
end
<p>
<% if @page > 1 %>
-<%= link_to t('changeset.changeset_paging_nav.previous'), @params.merge({ :page => @page - 1 }) %>
+<%= link_to t('changesets.changeset_paging_nav.previous'), @params.merge({ :page => @page - 1 }) %>
<% else %>
-<%= t('changeset.changeset_paging_nav.previous') %>
+<%= t('changesets.changeset_paging_nav.previous') %>
<% end %>
-| <%= t('changeset.changeset_paging_nav.showing_page', :page => @page) %> |
+| <%= t('changesets.changeset_paging_nav.showing_page', :page => @page) %> |
<% if @notes.size < @page_size %>
-<%= t('changeset.changeset_paging_nav.next') %>
+<%= t('changesets.changeset_paging_nav.next') %>
<% else %>
-<%= link_to t('changeset.changeset_paging_nav.next'), @params.merge({ :page => @page + 1 }) %>
+<%= link_to t('changesets.changeset_paging_nav.next'), @params.merge({ :page => @page + 1 }) %>
<% end %>
</p>
<% comment = changeset.tags['comment'].to_s != '' ? changeset.tags['comment'] : t('browse.no_comment') %>
"<%= link_to(comment,
{:controller => 'browse', :action => 'changeset', :id => changeset.id},
- {:title => t('changeset.changeset.view_changeset_details')})
+ {:title => t('changesets.changeset.view_changeset_details')})
%>"
<% else %>
- <%= t'changeset.changeset.no_edits' %>
+ <%= t'changesets.changeset.no_edits' %>
<% end %>
</p>
<!-- Displaying user's own profile page to themself -->
<ul class='secondary-actions clearfix'>
<li>
- <%= link_to t('.my edits'), :controller => 'changeset', :action => 'index', :display_name => current_user.display_name %>
+ <%= link_to t('.my edits'), :controller => 'changesets', :action => 'index', :display_name => current_user.display_name %>
<span class='count-number'><%= number_with_delimiter(current_user.changesets.size) %></span>
</li>
<li>
<ul class='secondary-actions clearfix'>
<li>
- <%= link_to t('.edits'), :controller => 'changeset', :action => 'index', :display_name => @user.display_name %>
+ <%= link_to t('.edits'), :controller => 'changesets', :action => 'index', :display_name => @user.display_name %>
<span class='count-number'><%= number_with_delimiter(@user.changesets.size) %></span>
</li>
<li>
introduction: "Click on the map to find nearby features."
nearby: "Nearby features"
enclosing: "Enclosing features"
- changeset:
+ changesets:
changeset_paging_nav:
showing_page: "Page %{page}"
next: "Next ยป"
get "capabilities" => "api#capabilities"
get "permissions" => "api#permissions"
- put "changeset/create" => "changeset#create"
- post "changeset/:id/upload" => "changeset#upload", :id => /\d+/
- get "changeset/:id/download" => "changeset#download", :as => :changeset_download, :id => /\d+/
- post "changeset/:id/expand_bbox" => "changeset#expand_bbox", :id => /\d+/
- get "changeset/:id" => "changeset#read", :as => :changeset_read, :id => /\d+/
- post "changeset/:id/subscribe" => "changeset#subscribe", :as => :changeset_subscribe, :id => /\d+/
- post "changeset/:id/unsubscribe" => "changeset#unsubscribe", :as => :changeset_unsubscribe, :id => /\d+/
- put "changeset/:id" => "changeset#update", :id => /\d+/
- put "changeset/:id/close" => "changeset#close", :id => /\d+/
- get "changesets" => "changeset#query"
+ put "changeset/create" => "changesets#create"
+ post "changeset/:id/upload" => "changesets#upload", :id => /\d+/
+ get "changeset/:id/download" => "changesets#download", :as => :changeset_download, :id => /\d+/
+ post "changeset/:id/expand_bbox" => "changesets#expand_bbox", :id => /\d+/
+ get "changeset/:id" => "changesets#read", :as => :changeset_read, :id => /\d+/
+ post "changeset/:id/subscribe" => "changesets#subscribe", :as => :changeset_subscribe, :id => /\d+/
+ post "changeset/:id/unsubscribe" => "changesets#unsubscribe", :as => :changeset_unsubscribe, :id => /\d+/
+ put "changeset/:id" => "changesets#update", :id => /\d+/
+ put "changeset/:id/close" => "changesets#close", :id => /\d+/
+ get "changesets" => "changesets#query"
post "changeset/:id/comment" => "changeset_comments#create", :as => :changeset_comment, :id => /\d+/
post "changeset/comment/:id/hide" => "changeset_comments#destroy", :as => :changeset_comment_hide, :id => /\d+/
post "changeset/comment/:id/unhide" => "changeset_comments#restore", :as => :changeset_comment_unhide, :id => /\d+/
get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" }
get "/note/:id" => "browse#note", :id => /\d+/, :as => "browse_note"
get "/note/new" => "browse#new_note"
- get "/user/:display_name/history" => "changeset#index"
- get "/user/:display_name/history/feed" => "changeset#feed", :defaults => { :format => :atom }
+ get "/user/:display_name/history" => "changesets#index"
+ get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom }
get "/user/:display_name/notes" => "notes#mine"
- get "/history/friends" => "changeset#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
- get "/history/nearby" => "changeset#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
+ get "/history/friends" => "changesets#index", :friends => true, :as => "friend_changesets", :defaults => { :format => :html }
+ get "/history/nearby" => "changesets#index", :nearby => true, :as => "nearby_changesets", :defaults => { :format => :html }
get "/browse/way/:id", :to => redirect(:path => "/way/%{id}")
get "/browse/way/:id/history", :to => redirect(:path => "/way/%{id}/history")
get "/fixthemap" => "site#fixthemap"
get "/help" => "site#help"
get "/about" => "site#about"
- get "/history" => "changeset#index"
- get "/history/feed" => "changeset#feed", :defaults => { :format => :atom }
+ get "/history" => "changesets#index"
+ get "/history/feed" => "changesets#feed", :defaults => { :format => :atom }
get "/history/comments/feed" => "changeset_comments#index", :as => :changesets_comments_feed, :defaults => { :format => "rss" }
get "/export" => "site#export"
match "/login" => "users#login", :via => [:get, :post]
require "test_helper"
-require "changeset_controller"
-class ChangesetControllerTest < ActionController::TestCase
+class ChangesetsControllerTest < ActionController::TestCase
##
# test all routes which lead to this controller
def test_routes
assert_routing(
{ :path => "/api/0.6/changeset/create", :method => :put },
- { :controller => "changeset", :action => "create" }
+ { :controller => "changesets", :action => "create" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1/upload", :method => :post },
- { :controller => "changeset", :action => "upload", :id => "1" }
+ { :controller => "changesets", :action => "upload", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1/download", :method => :get },
- { :controller => "changeset", :action => "download", :id => "1" }
+ { :controller => "changesets", :action => "download", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1/expand_bbox", :method => :post },
- { :controller => "changeset", :action => "expand_bbox", :id => "1" }
+ { :controller => "changesets", :action => "expand_bbox", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1", :method => :get },
- { :controller => "changeset", :action => "read", :id => "1" }
+ { :controller => "changesets", :action => "read", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1/subscribe", :method => :post },
- { :controller => "changeset", :action => "subscribe", :id => "1" }
+ { :controller => "changesets", :action => "subscribe", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1/unsubscribe", :method => :post },
- { :controller => "changeset", :action => "unsubscribe", :id => "1" }
+ { :controller => "changesets", :action => "unsubscribe", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1", :method => :put },
- { :controller => "changeset", :action => "update", :id => "1" }
+ { :controller => "changesets", :action => "update", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/1/close", :method => :put },
- { :controller => "changeset", :action => "close", :id => "1" }
+ { :controller => "changesets", :action => "close", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changesets", :method => :get },
- { :controller => "changeset", :action => "query" }
+ { :controller => "changesets", :action => "query" }
)
assert_routing(
{ :path => "/user/name/history", :method => :get },
- { :controller => "changeset", :action => "index", :display_name => "name" }
+ { :controller => "changesets", :action => "index", :display_name => "name" }
)
assert_routing(
{ :path => "/user/name/history/feed", :method => :get },
- { :controller => "changeset", :action => "feed", :display_name => "name", :format => :atom }
+ { :controller => "changesets", :action => "feed", :display_name => "name", :format => :atom }
)
assert_routing(
{ :path => "/history/friends", :method => :get },
- { :controller => "changeset", :action => "index", :friends => true, :format => :html }
+ { :controller => "changesets", :action => "index", :friends => true, :format => :html }
)
assert_routing(
{ :path => "/history/nearby", :method => :get },
- { :controller => "changeset", :action => "index", :nearby => true, :format => :html }
+ { :controller => "changesets", :action => "index", :nearby => true, :format => :html }
)
assert_routing(
{ :path => "/history", :method => :get },
- { :controller => "changeset", :action => "index" }
+ { :controller => "changesets", :action => "index" }
)
assert_routing(
{ :path => "/history/feed", :method => :get },
- { :controller => "changeset", :action => "feed", :format => :atom }
+ { :controller => "changesets", :action => "feed", :format => :atom }
)
end
# create a new changeset for this operation, so we are assured
# that the bounding box will be newly-generated.
- changeset_id = with_controller(ChangesetController.new) do
+ changeset_id = with_controller(ChangesetsController.new) do
content "<osm><changeset/></osm>"
put :create
assert_response :forbidden, "shouldn't be able to create changeset for modify test, as should get forbidden"
# create a new changeset for this operation, so we are assured
# that the bounding box will be newly-generated.
- changeset_id = with_controller(ChangesetController.new) do
+ changeset_id = with_controller(ChangesetsController.new) do
content "<osm><changeset/></osm>"
put :create
assert_response :success, "couldn't create changeset for modify test"
yield changeset_id
# now download the changeset to check its bounding box
- with_controller(ChangesetController.new) do
+ with_controller(ChangesetsController.new) do
get :read, :params => { :id => changeset_id }
assert_response :success, "can't re-read changeset for modify test"
assert_select "osm>changeset", 1, "Changeset element doesn't exist in #{@response.body}"
cs_id = rel.find("//osm/relation").first["changeset"].to_i
version = nil
- with_controller(ChangesetController.new) do
+ with_controller(ChangesetsController.new) do
doc = OSM::API.new.get_xml_doc
change = XML::Node.new "osmChange"
doc.root = change
end
def test_atom_link_to
- link = atom_link_to(:controller => :changeset, :action => :feed)
+ link = atom_link_to(:controller => :changesets, :action => :feed)
assert_dom_equal "<a class=\"rsssmall\" href=\"/history/feed\"><img border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
end
require "test_helper"
-class ChangesetHelperTest < ActionView::TestCase
+class ChangesetsHelperTest < ActionView::TestCase
def test_changeset_user_link
changeset = create(:changeset)
assert_equal %(<a href="/user/#{ERB::Util.u(changeset.user.display_name)}">#{changeset.user.display_name}</a>), changeset_user_link(changeset)
try_password_login user.email, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login uppercase_user.email, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", uppercase_user.display_name
end
try_password_login user.email, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login user.email.upcase, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login user.email.titlecase, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login user.display_name, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login uppercase_user.display_name, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", uppercase_user.display_name
end
try_password_login user.display_name, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login user.display_name.upcase, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login user.display_name.downcase, "test"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
try_password_login user.email, "test", "yes"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
assert session.key?(:_remember_for)
end
try_password_login user.display_name, "test", "yes"
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
assert session.key?(:_remember_for)
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
assert session.key?(:_remember_for)
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
u = User.find_by(:display_name => user.display_name)
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end
assert_response :redirect
follow_redirect!
assert_response :success
- assert_template "changeset/history"
+ assert_template "changesets/history"
assert_select "span.username", user.display_name
end