From: Tom Hughes Date: Thu, 8 Nov 2018 17:44:57 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/2052' X-Git-Tag: live~2776 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/70d6880e10881dfd4b68f51cf16609a9f8aaff24?hp=10294f4849b5d97185c618687a710a2dfc19f148 Merge remote-tracking branch 'upstream/pull/2052' --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ea957a8ca..7232d199b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -177,7 +177,7 @@ Style/FrozenStringLiteralComment: # Cop supports --auto-correct. Style/IfUnlessModifier: Exclude: - - 'app/controllers/way_controller.rb' + - 'app/controllers/ways_controller.rb' # Offense count: 70 # Cop supports --auto-correct. diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entries_controller.rb similarity index 82% rename from app/controllers/diary_entry_controller.rb rename to app/controllers/diary_entries_controller.rb index 70cb1654d..456ce99ad 100644 --- a/app/controllers/diary_entry_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -1,4 +1,4 @@ -class DiaryEntryController < ApplicationController +class DiaryEntriesController < ApplicationController layout "site", :except => :rss before_action :authorize_web @@ -12,7 +12,7 @@ class DiaryEntryController < ApplicationController before_action :allow_thirdparty_images, :only => [:new, :edit, :index, :show, :comments] def new - @title = t "diary_entry.new.title" + @title = t "diary_entries.new.title" if request.post? @diary_entry = DiaryEntry.new(entry_params) @@ -44,7 +44,7 @@ class DiaryEntryController < ApplicationController end def edit - @title = t "diary_entry.edit.title" + @title = t "diary_entries.edit.title" @diary_entry = DiaryEntry.find(params[:id]) if current_user != @diary_entry.user @@ -105,7 +105,7 @@ class DiaryEntryController < ApplicationController @user = User.active.find_by(:display_name => params[:display_name]) if @user - @title = t "diary_entry.index.user_title", :user => @user.display_name + @title = t "diary_entries.index.user_title", :user => @user.display_name @entries = @user.diary_entries else render_unknown_user params[:display_name] @@ -113,7 +113,7 @@ class DiaryEntryController < ApplicationController end elsif params[:friends] if current_user - @title = t "diary_entry.index.title_friends" + @title = t "diary_entries.index.title_friends" @entries = DiaryEntry.where(:user_id => current_user.friend_users) else require_user @@ -121,7 +121,7 @@ class DiaryEntryController < ApplicationController end elsif params[:nearby] if current_user - @title = t "diary_entry.index.title_nearby" + @title = t "diary_entries.index.title_nearby" @entries = DiaryEntry.where(:user_id => current_user.nearby) else require_user @@ -131,10 +131,10 @@ class DiaryEntryController < ApplicationController @entries = DiaryEntry.joins(:user).where(:users => { :status => %w[active confirmed] }) if params[:language] - @title = t "diary_entry.index.in_language_title", :language => Language.find(params[:language]).english_name + @title = t "diary_entries.index.in_language_title", :language => Language.find(params[:language]).english_name @entries = @entries.where(:language_code => params[:language]) else - @title = t "diary_entry.index.title" + @title = t "diary_entries.index.title" end end @@ -156,9 +156,9 @@ class DiaryEntryController < ApplicationController if user @entries = user.diary_entries - @title = t("diary_entry.feed.user.title", :user => user.display_name) - @description = t("diary_entry.feed.user.description", :user => user.display_name) - @link = url_for :controller => "diary_entry", :action => "index", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL + @title = t("diary_entries.feed.user.title", :user => user.display_name) + @description = t("diary_entries.feed.user.description", :user => user.display_name) + @link = url_for :action => "index", :display_name => user.display_name, :host => SERVER_URL, :protocol => SERVER_PROTOCOL else head :not_found return @@ -168,13 +168,13 @@ class DiaryEntryController < ApplicationController if params[:language] @entries = @entries.where(:language_code => params[:language]) - @title = t("diary_entry.feed.language.title", :language_name => Language.find(params[:language]).english_name) - @description = t("diary_entry.feed.language.description", :language_name => Language.find(params[:language]).english_name) - @link = url_for :controller => "diary_entry", :action => "index", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL + @title = t("diary_entries.feed.language.title", :language_name => Language.find(params[:language]).english_name) + @description = t("diary_entries.feed.language.description", :language_name => Language.find(params[:language]).english_name) + @link = url_for :action => "index", :language => params[:language], :host => SERVER_URL, :protocol => SERVER_PROTOCOL else - @title = t("diary_entry.feed.all.title") - @description = t("diary_entry.feed.all.description") - @link = url_for :controller => "diary_entry", :action => "index", :host => SERVER_URL, :protocol => SERVER_PROTOCOL + @title = t("diary_entries.feed.all.title") + @description = t("diary_entries.feed.all.description") + @link = url_for :action => "index", :host => SERVER_URL, :protocol => SERVER_PROTOCOL end end @@ -184,9 +184,9 @@ class DiaryEntryController < ApplicationController def show @entry = @user.diary_entries.visible.where(:id => params[:id]).first if @entry - @title = t "diary_entry.show.title", :user => params[:display_name], :title => @entry.title + @title = t "diary_entries.show.title", :user => params[:display_name], :title => @entry.title else - @title = t "diary_entry.no_such_entry.title", :id => params[:id] + @title = t "diary_entries.no_such_entry.title", :id => params[:id] render :action => "no_such_entry", :status => :not_found end end diff --git a/app/controllers/node_controller.rb b/app/controllers/nodes_controller.rb similarity index 98% rename from app/controllers/node_controller.rb rename to app/controllers/nodes_controller.rb index 84b814a34..baa6d8195 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -1,6 +1,6 @@ # The NodeController is the RESTful interface to Node objects -class NodeController < ApplicationController +class NodesController < ApplicationController require "xml/libxml" skip_before_action :verify_authenticity_token diff --git a/app/controllers/old_node_controller.rb b/app/controllers/old_nodes_controller.rb similarity index 84% rename from app/controllers/old_node_controller.rb rename to app/controllers/old_nodes_controller.rb index a32e299fe..43c8b6b75 100644 --- a/app/controllers/old_node_controller.rb +++ b/app/controllers/old_nodes_controller.rb @@ -1,4 +1,4 @@ -class OldNodeController < OldController +class OldNodesController < OldController private def lookup_old_element diff --git a/app/controllers/old_relation_controller.rb b/app/controllers/old_relations_controller.rb similarity index 83% rename from app/controllers/old_relation_controller.rb rename to app/controllers/old_relations_controller.rb index 78eca324c..40c450376 100644 --- a/app/controllers/old_relation_controller.rb +++ b/app/controllers/old_relations_controller.rb @@ -1,4 +1,4 @@ -class OldRelationController < OldController +class OldRelationsController < OldController private def lookup_old_element diff --git a/app/controllers/old_way_controller.rb b/app/controllers/old_ways_controller.rb similarity index 84% rename from app/controllers/old_way_controller.rb rename to app/controllers/old_ways_controller.rb index 1daab997a..c8185c633 100644 --- a/app/controllers/old_way_controller.rb +++ b/app/controllers/old_ways_controller.rb @@ -1,4 +1,4 @@ -class OldWayController < OldController +class OldWaysController < OldController private def lookup_old_element diff --git a/app/controllers/relation_controller.rb b/app/controllers/relations_controller.rb similarity index 99% rename from app/controllers/relation_controller.rb rename to app/controllers/relations_controller.rb index 059fb8d7e..b9108cea1 100644 --- a/app/controllers/relation_controller.rb +++ b/app/controllers/relations_controller.rb @@ -1,4 +1,4 @@ -class RelationController < ApplicationController +class RelationsController < ApplicationController require "xml/libxml" skip_before_action :verify_authenticity_token diff --git a/app/controllers/way_controller.rb b/app/controllers/ways_controller.rb similarity index 98% rename from app/controllers/way_controller.rb rename to app/controllers/ways_controller.rb index e48073e10..39129ebf3 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/ways_controller.rb @@ -1,4 +1,4 @@ -class WayController < ApplicationController +class WaysController < ApplicationController require "xml/libxml" skip_before_action :verify_authenticity_token diff --git a/app/views/browse/feature.html.erb b/app/views/browse/feature.html.erb index 38657f4d1..c3fadbe31 100644 --- a/app/views/browse/feature.html.erb +++ b/app/views/browse/feature.html.erb @@ -8,7 +8,7 @@ <%= render :partial => @type, :object => @feature %>
- <%= link_to(t('browse.download_xml'), :controller => @type, :action => "read") %> + <%= link_to(t('browse.download_xml'), :controller => @type.pluralize, :action => "read") %> · <%= link_to(t('browse.view_history'), :action => "#{@type}_history") %>
diff --git a/app/views/browse/history.html.erb b/app/views/browse/history.html.erb index 5f5dd4db3..6cf0a3569 100644 --- a/app/views/browse/history.html.erb +++ b/app/views/browse/history.html.erb @@ -8,7 +8,7 @@ <%= render :partial => @type, :collection => @feature.send("old_#{@type}s").reverse %>
- <%= link_to(t('browse.download_xml'), :controller => "old_#{@type}", :action => "history") %> + <%= link_to(t('browse.download_xml'), :controller => "old_#{@type.pluralize}", :action => "history") %> · <%= link_to(t('browse.view_details'), :action => @type) %>
diff --git a/app/views/diary_entry/_diary_comment.html.erb b/app/views/diary_entries/_diary_comment.html.erb similarity index 100% rename from app/views/diary_entry/_diary_comment.html.erb rename to app/views/diary_entries/_diary_comment.html.erb diff --git a/app/views/diary_entry/_diary_entry.html.erb b/app/views/diary_entries/_diary_entry.html.erb similarity index 95% rename from app/views/diary_entry/_diary_entry.html.erb rename to app/views/diary_entries/_diary_entry.html.erb index ec2f22601..e41eeae66 100644 --- a/app/views/diary_entry/_diary_entry.html.erb +++ b/app/views/diary_entries/_diary_entry.html.erb @@ -7,7 +7,7 @@

<%= link_to h(diary_entry.title), diary_entry_path(diary_entry.user, diary_entry) %>

- <%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'index', :display_name => nil, :language => diary_entry.language_code)) %> + <%= raw(t '.posted_by', :link_user => (link_to h(diary_entry.user.display_name), user_path(diary_entry.user)), :created => l(diary_entry.created_at, :format => :blog), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entries', :action => 'index', :display_name => nil, :language => diary_entry.language_code)) %> diff --git a/app/views/diary_entry/_diary_index_entry.html.erb b/app/views/diary_entries/_diary_index_entry.html.erb similarity index 100% rename from app/views/diary_entry/_diary_index_entry.html.erb rename to app/views/diary_entries/_diary_index_entry.html.erb diff --git a/app/views/diary_entry/_location.html.erb b/app/views/diary_entries/_location.html.erb similarity index 100% rename from app/views/diary_entry/_location.html.erb rename to app/views/diary_entries/_location.html.erb diff --git a/app/views/diary_entry/comments.html.erb b/app/views/diary_entries/comments.html.erb similarity index 100% rename from app/views/diary_entry/comments.html.erb rename to app/views/diary_entries/comments.html.erb diff --git a/app/views/diary_entry/edit.html.erb b/app/views/diary_entries/edit.html.erb similarity index 96% rename from app/views/diary_entry/edit.html.erb rename to app/views/diary_entries/edit.html.erb index d408938e5..b46dadf1c 100644 --- a/app/views/diary_entry/edit.html.erb +++ b/app/views/diary_entries/edit.html.erb @@ -43,7 +43,7 @@ <% if action_name == 'new' %> - <%= submit_tag t('diary_entry.new.publish_button') %> + <%= submit_tag t('diary_entries.new.publish_button') %> <% else %> <%= submit_tag t('.save_button') %> <% end %> diff --git a/app/views/diary_entry/index.html.erb b/app/views/diary_entries/index.html.erb similarity index 87% rename from app/views/diary_entry/index.html.erb rename to app/views/diary_entries/index.html.erb index 021cb2058..63a805b3c 100644 --- a/app/views/diary_entry/index.html.erb +++ b/app/views/diary_entries/index.html.erb @@ -13,13 +13,13 @@ <% if @user %> <% if @user == current_user %>
-
  • <%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('.new_title')} %>
  • +
  • <%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), diary_new_path, {:title => t('.new_title')} %>
  • <% end %> <% else %> <% if current_user %>
    -
  • <%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('.new_title')} %>
  • +
  • <%= link_to image_tag("new.png", :class => "small_icon", :border=>0) + t('.new'), diary_new_path, {:title => t('.new_title')} %>
  • <% end %> <% end %> diff --git a/app/views/diary_entry/no_such_entry.html.erb b/app/views/diary_entries/no_such_entry.html.erb similarity index 100% rename from app/views/diary_entry/no_such_entry.html.erb rename to app/views/diary_entries/no_such_entry.html.erb diff --git a/app/views/diary_entry/rss.rss.builder b/app/views/diary_entries/rss.rss.builder similarity index 100% rename from app/views/diary_entry/rss.rss.builder rename to app/views/diary_entries/rss.rss.builder diff --git a/app/views/diary_entry/show.html.erb b/app/views/diary_entries/show.html.erb similarity index 100% rename from app/views/diary_entry/show.html.erb rename to app/views/diary_entries/show.html.erb diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 7aa3abd27..c7a41b687 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -18,11 +18,11 @@ <%= number_with_delimiter(current_user.traces.size) %>
  • - <%= link_to t('.my diary'), :controller => 'diary_entry', :action => 'index', :display_name => current_user.display_name %> + <%= link_to t('.my diary'), :controller => 'diary_entries', :action => 'index', :display_name => current_user.display_name %> <%= number_with_delimiter(current_user.diary_entries.size) %>
  • - <%= link_to t('.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => current_user.display_name %> + <%= link_to t('.my comments' ), :controller => 'diary_entries', :action => 'comments', :display_name => current_user.display_name %>
  • <%= link_to t('.my settings'), :controller => 'users', :action => 'account', :display_name => current_user.display_name %> @@ -66,11 +66,11 @@ <%= link_to t('.send message'), new_message_path(@user) %>
  • - <%= link_to t('.diary'), :controller => 'diary_entry', :action => 'index', :display_name => @user.display_name %> + <%= link_to t('.diary'), :controller => 'diary_entries', :action => 'index', :display_name => @user.display_name %> <%= number_with_delimiter(@user.diary_entries.size) %>
  • - <%= link_to t('.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @user.display_name %> + <%= link_to t('.comments'), :controller => 'diary_entries', :action => 'comments', :display_name => @user.display_name %>
  • <% if current_user and current_user.is_friends_with?(@user) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 6a496be1a..197c6308c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -253,7 +253,7 @@ en: title_particular: "OpenStreetMap changeset #%{changeset_id} discussion" timeout: sorry: "Sorry, the list of changeset comments you requested took too long to retrieve." - diary_entry: + diary_entries: new: title: New Diary Entry publish_button: "Publish" diff --git a/config/routes.rb b/config/routes.rb index 7c3bf0b94..781466064 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,38 +20,38 @@ OpenStreetMap::Application.routes.draw do 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+/ - put "node/create" => "node#create" - get "node/:id/ways" => "way#ways_for_node", :id => /\d+/ - get "node/:id/relations" => "relation#relations_for_node", :id => /\d+/ - get "node/:id/history" => "old_node#history", :id => /\d+/ - post "node/:id/:version/redact" => "old_node#redact", :version => /\d+/, :id => /\d+/ - get "node/:id/:version" => "old_node#version", :id => /\d+/, :version => /\d+/ - get "node/:id" => "node#read", :id => /\d+/ - put "node/:id" => "node#update", :id => /\d+/ - delete "node/:id" => "node#delete", :id => /\d+/ - get "nodes" => "node#nodes" - - put "way/create" => "way#create" - get "way/:id/history" => "old_way#history", :id => /\d+/ - get "way/:id/full" => "way#full", :id => /\d+/ - get "way/:id/relations" => "relation#relations_for_way", :id => /\d+/ - post "way/:id/:version/redact" => "old_way#redact", :version => /\d+/, :id => /\d+/ - get "way/:id/:version" => "old_way#version", :id => /\d+/, :version => /\d+/ - get "way/:id" => "way#read", :id => /\d+/ - put "way/:id" => "way#update", :id => /\d+/ - delete "way/:id" => "way#delete", :id => /\d+/ - get "ways" => "way#ways" - - put "relation/create" => "relation#create" - get "relation/:id/relations" => "relation#relations_for_relation", :id => /\d+/ - get "relation/:id/history" => "old_relation#history", :id => /\d+/ - get "relation/:id/full" => "relation#full", :id => /\d+/ - post "relation/:id/:version/redact" => "old_relation#redact", :version => /\d+/, :id => /\d+/ - get "relation/:id/:version" => "old_relation#version", :id => /\d+/, :version => /\d+/ - get "relation/:id" => "relation#read", :id => /\d+/ - put "relation/:id" => "relation#update", :id => /\d+/ - delete "relation/:id" => "relation#delete", :id => /\d+/ - get "relations" => "relation#relations" + put "node/create" => "nodes#create" + get "node/:id/ways" => "ways#ways_for_node", :id => /\d+/ + get "node/:id/relations" => "relations#relations_for_node", :id => /\d+/ + get "node/:id/history" => "old_nodes#history", :id => /\d+/ + post "node/:id/:version/redact" => "old_nodes#redact", :version => /\d+/, :id => /\d+/ + get "node/:id/:version" => "old_nodes#version", :id => /\d+/, :version => /\d+/ + get "node/:id" => "nodes#read", :id => /\d+/ + put "node/:id" => "nodes#update", :id => /\d+/ + delete "node/:id" => "nodes#delete", :id => /\d+/ + get "nodes" => "nodes#nodes" + + put "way/create" => "ways#create" + get "way/:id/history" => "old_ways#history", :id => /\d+/ + get "way/:id/full" => "ways#full", :id => /\d+/ + get "way/:id/relations" => "relations#relations_for_way", :id => /\d+/ + post "way/:id/:version/redact" => "old_ways#redact", :version => /\d+/, :id => /\d+/ + get "way/:id/:version" => "old_ways#version", :id => /\d+/, :version => /\d+/ + get "way/:id" => "ways#read", :id => /\d+/ + put "way/:id" => "ways#update", :id => /\d+/ + delete "way/:id" => "ways#delete", :id => /\d+/ + get "ways" => "ways#ways" + + put "relation/create" => "relations#create" + get "relation/:id/relations" => "relations#relations_for_relation", :id => /\d+/ + get "relation/:id/history" => "old_relations#history", :id => /\d+/ + get "relation/:id/full" => "relations#full", :id => /\d+/ + post "relation/:id/:version/redact" => "old_relations#redact", :version => /\d+/, :id => /\d+/ + get "relation/:id/:version" => "old_relations#version", :id => /\d+/, :version => /\d+/ + get "relation/:id" => "relations#read", :id => /\d+/ + put "relation/:id" => "relations#update", :id => /\d+/ + delete "relation/:id" => "relations#delete", :id => /\d+/ + get "relations" => "relations#relations" get "map" => "api#map" @@ -214,24 +214,24 @@ OpenStreetMap::Application.routes.draw do post "/trace/:id/delete" => "traces#delete", :id => /\d+/ # diary pages - match "/diary/new" => "diary_entry#new", :via => [:get, :post] - get "/diary/friends" => "diary_entry#index", :friends => true, :as => "friend_diaries" - get "/diary/nearby" => "diary_entry#index", :nearby => true, :as => "nearby_diaries" - get "/user/:display_name/diary/rss" => "diary_entry#rss", :defaults => { :format => :rss } - get "/diary/:language/rss" => "diary_entry#rss", :defaults => { :format => :rss } - get "/diary/rss" => "diary_entry#rss", :defaults => { :format => :rss } - get "/user/:display_name/diary/comments/:page" => "diary_entry#comments", :page => /[1-9][0-9]*/ - get "/user/:display_name/diary/comments/" => "diary_entry#comments" - get "/user/:display_name/diary" => "diary_entry#index" - get "/diary/:language" => "diary_entry#index" - get "/diary" => "diary_entry#index" - get "/user/:display_name/diary/:id" => "diary_entry#show", :id => /\d+/, :as => :diary_entry - post "/user/:display_name/diary/:id/newcomment" => "diary_entry#comment", :id => /\d+/ - match "/user/:display_name/diary/:id/edit" => "diary_entry#edit", :via => [:get, :post], :id => /\d+/ - post "/user/:display_name/diary/:id/hide" => "diary_entry#hide", :id => /\d+/, :as => :hide_diary_entry - post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entry#hidecomment", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment - post "/user/:display_name/diary/:id/subscribe" => "diary_entry#subscribe", :as => :diary_entry_subscribe, :id => /\d+/ - post "/user/:display_name/diary/:id/unsubscribe" => "diary_entry#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/ + match "/diary/new" => "diary_entries#new", :via => [:get, :post] + get "/diary/friends" => "diary_entries#index", :friends => true, :as => "friend_diaries" + get "/diary/nearby" => "diary_entries#index", :nearby => true, :as => "nearby_diaries" + get "/user/:display_name/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss } + get "/diary/:language/rss" => "diary_entries#rss", :defaults => { :format => :rss } + get "/diary/rss" => "diary_entries#rss", :defaults => { :format => :rss } + get "/user/:display_name/diary/comments/:page" => "diary_entries#comments", :page => /[1-9][0-9]*/ + get "/user/:display_name/diary/comments/" => "diary_entries#comments" + get "/user/:display_name/diary" => "diary_entries#index" + get "/diary/:language" => "diary_entries#index" + get "/diary" => "diary_entries#index" + get "/user/:display_name/diary/:id" => "diary_entries#show", :id => /\d+/, :as => :diary_entry + post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/ + match "/user/:display_name/diary/:id/edit" => "diary_entries#edit", :via => [:get, :post], :id => /\d+/ + post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry + post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_entries#hidecomment", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment + post "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :as => :diary_entry_subscribe, :id => /\d+/ + post "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :as => :diary_entry_unsubscribe, :id => /\d+/ # user pages get "/user/:display_name" => "users#show", :as => "user" diff --git a/test/controllers/changeset_controller_test.rb b/test/controllers/changeset_controller_test.rb index 72cf68ad9..7dc479cad 100644 --- a/test/controllers/changeset_controller_test.rb +++ b/test/controllers/changeset_controller_test.rb @@ -1508,7 +1508,7 @@ CHANGESET changeset_id = @response.body.to_i # add a single node to it - with_controller(NodeController.new) do + with_controller(NodesController.new) do content "" put :create assert_response :success, "Couldn't create node." @@ -1523,7 +1523,7 @@ CHANGESET assert_select "osm>changeset[max_lat='2.0000000']", 1 # add another node to it - with_controller(NodeController.new) do + with_controller(NodesController.new) do content "" put :create assert_response :success, "Couldn't create second node." @@ -1538,7 +1538,7 @@ CHANGESET assert_select "osm>changeset[max_lat='2.0000000']", 1 # add (delete) a way to it, which contains a point at (3,3) - with_controller(WayController.new) do + with_controller(WaysController.new) do content update_changeset(way.to_xml, changeset_id) put :delete, :params => { :id => way.id } assert_response :success, "Couldn't delete a way." @@ -1818,7 +1818,7 @@ CHANGESET changeset.num_changes = Changeset::MAX_ELEMENTS - offset changeset.save! - with_controller(NodeController.new) do + with_controller(NodesController.new) do # create a new node content "" put :create diff --git a/test/controllers/diary_entry_controller_test.rb b/test/controllers/diary_entries_controller_test.rb similarity index 94% rename from test/controllers/diary_entry_controller_test.rb rename to test/controllers/diary_entries_controller_test.rb index cec225047..426bc3851 100644 --- a/test/controllers/diary_entry_controller_test.rb +++ b/test/controllers/diary_entries_controller_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class DiaryEntryControllerTest < ActionController::TestCase +class DiaryEntriesControllerTest < ActionController::TestCase include ActionView::Helpers::NumberHelper def setup @@ -16,86 +16,86 @@ class DiaryEntryControllerTest < ActionController::TestCase def test_routes assert_routing( { :path => "/diary", :method => :get }, - { :controller => "diary_entry", :action => "index" } + { :controller => "diary_entries", :action => "index" } ) assert_routing( { :path => "/diary/language", :method => :get }, - { :controller => "diary_entry", :action => "index", :language => "language" } + { :controller => "diary_entries", :action => "index", :language => "language" } ) assert_routing( { :path => "/user/username/diary", :method => :get }, - { :controller => "diary_entry", :action => "index", :display_name => "username" } + { :controller => "diary_entries", :action => "index", :display_name => "username" } ) assert_routing( { :path => "/diary/friends", :method => :get }, - { :controller => "diary_entry", :action => "index", :friends => true } + { :controller => "diary_entries", :action => "index", :friends => true } ) assert_routing( { :path => "/diary/nearby", :method => :get }, - { :controller => "diary_entry", :action => "index", :nearby => true } + { :controller => "diary_entries", :action => "index", :nearby => true } ) assert_routing( { :path => "/diary/rss", :method => :get }, - { :controller => "diary_entry", :action => "rss", :format => :rss } + { :controller => "diary_entries", :action => "rss", :format => :rss } ) assert_routing( { :path => "/diary/language/rss", :method => :get }, - { :controller => "diary_entry", :action => "rss", :language => "language", :format => :rss } + { :controller => "diary_entries", :action => "rss", :language => "language", :format => :rss } ) assert_routing( { :path => "/user/username/diary/rss", :method => :get }, - { :controller => "diary_entry", :action => "rss", :display_name => "username", :format => :rss } + { :controller => "diary_entries", :action => "rss", :display_name => "username", :format => :rss } ) assert_routing( { :path => "/user/username/diary/comments", :method => :get }, - { :controller => "diary_entry", :action => "comments", :display_name => "username" } + { :controller => "diary_entries", :action => "comments", :display_name => "username" } ) assert_routing( { :path => "/user/username/diary/comments/1", :method => :get }, - { :controller => "diary_entry", :action => "comments", :display_name => "username", :page => "1" } + { :controller => "diary_entries", :action => "comments", :display_name => "username", :page => "1" } ) assert_routing( { :path => "/diary/new", :method => :get }, - { :controller => "diary_entry", :action => "new" } + { :controller => "diary_entries", :action => "new" } ) assert_routing( { :path => "/diary/new", :method => :post }, - { :controller => "diary_entry", :action => "new" } + { :controller => "diary_entries", :action => "new" } ) assert_routing( { :path => "/user/username/diary/1", :method => :get }, - { :controller => "diary_entry", :action => "show", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "show", :display_name => "username", :id => "1" } ) assert_routing( { :path => "/user/username/diary/1/edit", :method => :get }, - { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "edit", :display_name => "username", :id => "1" } ) assert_routing( { :path => "/user/username/diary/1/edit", :method => :post }, - { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "edit", :display_name => "username", :id => "1" } ) assert_routing( { :path => "/user/username/diary/1/newcomment", :method => :post }, - { :controller => "diary_entry", :action => "comment", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "comment", :display_name => "username", :id => "1" } ) assert_routing( { :path => "/user/username/diary/1/hide", :method => :post }, - { :controller => "diary_entry", :action => "hide", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "hide", :display_name => "username", :id => "1" } ) assert_routing( { :path => "/user/username/diary/1/hidecomment/2", :method => :post }, - { :controller => "diary_entry", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" } + { :controller => "diary_entries", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" } ) assert_routing( { :path => "/user/username/diary/1/subscribe", :method => :post }, - { :controller => "diary_entry", :action => "subscribe", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "subscribe", :display_name => "username", :id => "1" } ) assert_routing( { :path => "/user/username/diary/1/unsubscribe", :method => :post }, - { :controller => "diary_entry", :action => "unsubscribe", :display_name => "username", :id => "1" } + { :controller => "diary_entries", :action => "unsubscribe", :display_name => "username", :id => "1" } ) end @@ -316,7 +316,7 @@ class DiaryEntryControllerTest < ActionController::TestCase :params => { :display_name => entry.user.display_name, :id => entry.id }, :session => { :user => entry.user } assert_response :success - assert_template "diary_entry/show" + assert_template "show" assert_select "title", :text => /Users' diaries | /, :count => 1 assert_select "div.content-heading", :count => 1 do assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1 @@ -337,7 +337,7 @@ class DiaryEntryControllerTest < ActionController::TestCase :params => { :display_name => entry.user.display_name, :id => entry.id }, :session => { :user => create(:user) } assert_response :success - assert_template "diary_entry/show" + assert_template "show" assert_select "title", :text => /Users' diaries | /, :count => 1 assert_select "div.content-heading", :count => 1 do assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1 diff --git a/test/controllers/node_controller_test.rb b/test/controllers/nodes_controller_test.rb similarity index 98% rename from test/controllers/node_controller_test.rb rename to test/controllers/nodes_controller_test.rb index 5f737f798..3cd4244e1 100644 --- a/test/controllers/node_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb @@ -1,28 +1,28 @@ require "test_helper" -class NodeControllerTest < ActionController::TestCase +class NodesControllerTest < ActionController::TestCase ## # test all routes which lead to this controller def test_routes assert_routing( { :path => "/api/0.6/node/create", :method => :put }, - { :controller => "node", :action => "create" } + { :controller => "nodes", :action => "create" } ) assert_routing( { :path => "/api/0.6/node/1", :method => :get }, - { :controller => "node", :action => "read", :id => "1" } + { :controller => "nodes", :action => "read", :id => "1" } ) assert_routing( { :path => "/api/0.6/node/1", :method => :put }, - { :controller => "node", :action => "update", :id => "1" } + { :controller => "nodes", :action => "update", :id => "1" } ) assert_routing( { :path => "/api/0.6/node/1", :method => :delete }, - { :controller => "node", :action => "delete", :id => "1" } + { :controller => "nodes", :action => "delete", :id => "1" } ) assert_routing( { :path => "/api/0.6/nodes", :method => :get }, - { :controller => "node", :action => "nodes" } + { :controller => "nodes", :action => "nodes" } ) end diff --git a/test/controllers/old_node_controller_test.rb b/test/controllers/old_nodes_controller_test.rb similarity index 96% rename from test/controllers/old_node_controller_test.rb rename to test/controllers/old_nodes_controller_test.rb index 346634f7d..2568cbfd8 100644 --- a/test/controllers/old_node_controller_test.rb +++ b/test/controllers/old_nodes_controller_test.rb @@ -1,7 +1,6 @@ require "test_helper" -require "old_node_controller" -class OldNodeControllerTest < ActionController::TestCase +class OldNodesControllerTest < ActionController::TestCase # # TODO: test history # @@ -11,15 +10,15 @@ class OldNodeControllerTest < ActionController::TestCase def test_routes assert_routing( { :path => "/api/0.6/node/1/history", :method => :get }, - { :controller => "old_node", :action => "history", :id => "1" } + { :controller => "old_nodes", :action => "history", :id => "1" } ) assert_routing( { :path => "/api/0.6/node/1/2", :method => :get }, - { :controller => "old_node", :action => "version", :id => "1", :version => "2" } + { :controller => "old_nodes", :action => "version", :id => "1", :version => "2" } ) assert_routing( { :path => "/api/0.6/node/1/2/redact", :method => :post }, - { :controller => "old_node", :action => "redact", :id => "1", :version => "2" } + { :controller => "old_nodes", :action => "redact", :id => "1", :version => "2" } ) end @@ -59,7 +58,7 @@ class OldNodeControllerTest < ActionController::TestCase # move the node somewhere else xml_node["lat"] = precision(rand * 180 - 90).to_s xml_node["lon"] = precision(rand * 360 - 180).to_s - with_controller(NodeController.new) do + with_controller(NodesController.new) do content xml_doc put :update, :params => { :id => nodeid } assert_response :forbidden, "Should have rejected node update" @@ -75,7 +74,7 @@ class OldNodeControllerTest < ActionController::TestCase xml_tag["k"] = random_string xml_tag["v"] = random_string xml_node << xml_tag - with_controller(NodeController.new) do + with_controller(NodesController.new) do content xml_doc put :update, :params => { :id => nodeid } assert_response :forbidden, @@ -109,7 +108,7 @@ class OldNodeControllerTest < ActionController::TestCase # move the node somewhere else xml_node["lat"] = precision(rand * 180 - 90).to_s xml_node["lon"] = precision(rand * 360 - 180).to_s - with_controller(NodeController.new) do + with_controller(NodesController.new) do content xml_doc put :update, :params => { :id => nodeid } assert_response :success @@ -125,7 +124,7 @@ class OldNodeControllerTest < ActionController::TestCase xml_tag["k"] = random_string xml_tag["v"] = random_string xml_node << xml_tag - with_controller(NodeController.new) do + with_controller(NodesController.new) do content xml_doc put :update, :params => { :id => nodeid } assert_response :success, @@ -390,7 +389,7 @@ class OldNodeControllerTest < ActionController::TestCase def check_current_version(node_id) # get the current version of the node - current_node = with_controller(NodeController.new) do + current_node = with_controller(NodesController.new) do get :read, :params => { :id => node_id } assert_response :success, "cant get current node #{node_id}" Node.from_xml(@response.body) diff --git a/test/controllers/old_relation_controller_test.rb b/test/controllers/old_relations_controller_test.rb similarity index 97% rename from test/controllers/old_relation_controller_test.rb rename to test/controllers/old_relations_controller_test.rb index be91962f8..51e6c565a 100644 --- a/test/controllers/old_relation_controller_test.rb +++ b/test/controllers/old_relations_controller_test.rb @@ -1,21 +1,20 @@ require "test_helper" -require "old_relation_controller" -class OldRelationControllerTest < ActionController::TestCase +class OldRelationsControllerTest < ActionController::TestCase ## # test all routes which lead to this controller def test_routes assert_routing( { :path => "/api/0.6/relation/1/history", :method => :get }, - { :controller => "old_relation", :action => "history", :id => "1" } + { :controller => "old_relations", :action => "history", :id => "1" } ) assert_routing( { :path => "/api/0.6/relation/1/2", :method => :get }, - { :controller => "old_relation", :action => "version", :id => "1", :version => "2" } + { :controller => "old_relations", :action => "version", :id => "1", :version => "2" } ) assert_routing( { :path => "/api/0.6/relation/1/2/redact", :method => :post }, - { :controller => "old_relation", :action => "redact", :id => "1", :version => "2" } + { :controller => "old_relations", :action => "redact", :id => "1", :version => "2" } ) end @@ -225,7 +224,7 @@ class OldRelationControllerTest < ActionController::TestCase # version which we're getting from the versions call. def check_current_version(relation_id) # get the current version - current_relation = with_controller(RelationController.new) do + current_relation = with_controller(RelationsController.new) do get :read, :params => { :id => relation_id } assert_response :success, "can't get current relation #{relation_id}" Relation.from_xml(@response.body) diff --git a/test/controllers/old_way_controller_test.rb b/test/controllers/old_ways_controller_test.rb similarity index 97% rename from test/controllers/old_way_controller_test.rb rename to test/controllers/old_ways_controller_test.rb index 1fff79187..0dd2d5e3c 100644 --- a/test/controllers/old_way_controller_test.rb +++ b/test/controllers/old_ways_controller_test.rb @@ -1,21 +1,20 @@ require "test_helper" -require "old_way_controller" -class OldWayControllerTest < ActionController::TestCase +class OldWaysControllerTest < ActionController::TestCase ## # test all routes which lead to this controller def test_routes assert_routing( { :path => "/api/0.6/way/1/history", :method => :get }, - { :controller => "old_way", :action => "history", :id => "1" } + { :controller => "old_ways", :action => "history", :id => "1" } ) assert_routing( { :path => "/api/0.6/way/1/2", :method => :get }, - { :controller => "old_way", :action => "version", :id => "1", :version => "2" } + { :controller => "old_ways", :action => "version", :id => "1", :version => "2" } ) assert_routing( { :path => "/api/0.6/way/1/2/redact", :method => :post }, - { :controller => "old_way", :action => "redact", :id => "1", :version => "2" } + { :controller => "old_ways", :action => "redact", :id => "1", :version => "2" } ) end @@ -265,7 +264,7 @@ class OldWayControllerTest < ActionController::TestCase # version which we're getting from the versions call. def check_current_version(way_id) # get the current version - current_way = with_controller(WayController.new) do + current_way = with_controller(WaysController.new) do get :read, :params => { :id => way_id } assert_response :success, "can't get current way #{way_id}" Way.from_xml(@response.body) diff --git a/test/controllers/relation_controller_test.rb b/test/controllers/relations_controller_test.rb similarity index 97% rename from test/controllers/relation_controller_test.rb rename to test/controllers/relations_controller_test.rb index 8a7e8b2fe..1613fbf7a 100644 --- a/test/controllers/relation_controller_test.rb +++ b/test/controllers/relations_controller_test.rb @@ -1,46 +1,45 @@ require "test_helper" -require "relation_controller" -class RelationControllerTest < ActionController::TestCase +class RelationsControllerTest < ActionController::TestCase ## # test all routes which lead to this controller def test_routes assert_routing( { :path => "/api/0.6/relation/create", :method => :put }, - { :controller => "relation", :action => "create" } + { :controller => "relations", :action => "create" } ) assert_routing( { :path => "/api/0.6/relation/1/full", :method => :get }, - { :controller => "relation", :action => "full", :id => "1" } + { :controller => "relations", :action => "full", :id => "1" } ) assert_routing( { :path => "/api/0.6/relation/1", :method => :get }, - { :controller => "relation", :action => "read", :id => "1" } + { :controller => "relations", :action => "read", :id => "1" } ) assert_routing( { :path => "/api/0.6/relation/1", :method => :put }, - { :controller => "relation", :action => "update", :id => "1" } + { :controller => "relations", :action => "update", :id => "1" } ) assert_routing( { :path => "/api/0.6/relation/1", :method => :delete }, - { :controller => "relation", :action => "delete", :id => "1" } + { :controller => "relations", :action => "delete", :id => "1" } ) assert_routing( { :path => "/api/0.6/relations", :method => :get }, - { :controller => "relation", :action => "relations" } + { :controller => "relations", :action => "relations" } ) assert_routing( { :path => "/api/0.6/node/1/relations", :method => :get }, - { :controller => "relation", :action => "relations_for_node", :id => "1" } + { :controller => "relations", :action => "relations_for_node", :id => "1" } ) assert_routing( { :path => "/api/0.6/way/1/relations", :method => :get }, - { :controller => "relation", :action => "relations_for_way", :id => "1" } + { :controller => "relations", :action => "relations_for_way", :id => "1" } ) assert_routing( { :path => "/api/0.6/relation/1/relations", :method => :get }, - { :controller => "relation", :action => "relations_for_relation", :id => "1" } + { :controller => "relations", :action => "relations_for_relation", :id => "1" } ) end @@ -785,7 +784,7 @@ OSM check_ordering(doc, @response.body) # check the ordering in the history tables: - with_controller(OldRelationController.new) do + with_controller(OldRelationsController.new) do get :version, :params => { :id => relation_id, :version => 2 } assert_response :success, "can't read back version 2 of the relation #{relation_id}" check_ordering(doc, @response.body) @@ -868,7 +867,7 @@ OSM check_ordering(doc, @response.body) # check the ordering in the history tables: - with_controller(OldRelationController.new) do + with_controller(OldRelationsController.new) do get :version, :params => { :id => relation_id, :version => 1 } assert_response :success, "can't read back version 1 of the relation: #{@response.body}" check_ordering(doc, @response.body) @@ -982,7 +981,7 @@ OSM if ver.nil? get :read, :params => { :id => id } else - with_controller(OldRelationController.new) do + with_controller(OldRelationsController.new) do get :version, :params => { :id => id, :version => ver } end end diff --git a/test/controllers/way_controller_test.rb b/test/controllers/ways_controller_test.rb similarity index 98% rename from test/controllers/way_controller_test.rb rename to test/controllers/ways_controller_test.rb index 3d466de8b..1199e5d94 100644 --- a/test/controllers/way_controller_test.rb +++ b/test/controllers/ways_controller_test.rb @@ -1,33 +1,32 @@ require "test_helper" -require "way_controller" -class WayControllerTest < ActionController::TestCase +class WaysControllerTest < ActionController::TestCase ## # test all routes which lead to this controller def test_routes assert_routing( { :path => "/api/0.6/way/create", :method => :put }, - { :controller => "way", :action => "create" } + { :controller => "ways", :action => "create" } ) assert_routing( { :path => "/api/0.6/way/1/full", :method => :get }, - { :controller => "way", :action => "full", :id => "1" } + { :controller => "ways", :action => "full", :id => "1" } ) assert_routing( { :path => "/api/0.6/way/1", :method => :get }, - { :controller => "way", :action => "read", :id => "1" } + { :controller => "ways", :action => "read", :id => "1" } ) assert_routing( { :path => "/api/0.6/way/1", :method => :put }, - { :controller => "way", :action => "update", :id => "1" } + { :controller => "ways", :action => "update", :id => "1" } ) assert_routing( { :path => "/api/0.6/way/1", :method => :delete }, - { :controller => "way", :action => "delete", :id => "1" } + { :controller => "ways", :action => "delete", :id => "1" } ) assert_routing( { :path => "/api/0.6/ways", :method => :get }, - { :controller => "way", :action => "ways" } + { :controller => "ways", :action => "ways" } ) end diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 89e5a3893..050fa0e9f 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -38,7 +38,7 @@ class ApplicationHelperTest < ActionView::TestCase end def test_rss_link_to - link = rss_link_to(:controller => :diary_entry, :action => :rss) + link = rss_link_to(:controller => :diary_entries, :action => :rss) assert_dom_equal "", link end diff --git a/test/integration/user_diaries_test.rb b/test/integration/user_diaries_test.rb index 57b4a8b0c..026028d5f 100644 --- a/test/integration/user_diaries_test.rb +++ b/test/integration/user_diaries_test.rb @@ -29,7 +29,7 @@ class UserDiariesTest < ActionDispatch::IntegrationTest follow_redirect! assert_response :success - assert_template "diary_entry/edit" + assert_template "diary_entries/edit" # print @response.body # print @html_document.to_yaml diff --git a/test/system/report_diary_comment_test.rb b/test/system/report_diary_comment_test.rb index 18be7e649..61879a32f 100644 --- a/test/system/report_diary_comment_test.rb +++ b/test/system/report_diary_comment_test.rb @@ -11,7 +11,7 @@ class ReportDiaryCommentTest < ApplicationSystemTestCase visit diary_entry_path(@diary_entry.user.display_name, @diary_entry) assert page.has_content?(@comment.body) - assert_not page.has_content?(I18n.t("diary_entry.diary_comment.report")) + assert_not page.has_content?(I18n.t("diary_entries.diary_comment.report")) end def test_it_works @@ -19,7 +19,7 @@ class ReportDiaryCommentTest < ApplicationSystemTestCase visit diary_entry_path(@diary_entry.user.display_name, @diary_entry) assert page.has_content? @diary_entry.title - click_on I18n.t("diary_entry.diary_comment.report") + click_on I18n.t("diary_entries.diary_comment.report") assert page.has_content? "Report" assert page.has_content? I18n.t("reports.new.disclaimer.intro") diff --git a/test/system/report_diary_entry_test.rb b/test/system/report_diary_entry_test.rb index 1db733ab7..9d232f8d4 100644 --- a/test/system/report_diary_entry_test.rb +++ b/test/system/report_diary_entry_test.rb @@ -10,7 +10,7 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase visit diary_entry_path(@diary_entry.user.display_name, @diary_entry) assert page.has_content?(@diary_entry.title) - assert_not page.has_content?(I18n.t("diary_entry.diary_entry.report")) + assert_not page.has_content?(I18n.t("diary_entries.diary_entry.report")) end def test_it_works @@ -18,7 +18,7 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase visit diary_entry_path(@diary_entry.user.display_name, @diary_entry) assert page.has_content? @diary_entry.title - click_on I18n.t("diary_entry.diary_entry.report") + click_on I18n.t("diary_entries.diary_entry.report") assert page.has_content? "Report" assert page.has_content? I18n.t("reports.new.disclaimer.intro") @@ -42,7 +42,7 @@ class ReportDiaryEntryTest < ApplicationSystemTestCase visit diary_entry_path(@diary_entry.user.display_name, @diary_entry) assert page.has_content? @diary_entry.title - click_on I18n.t("diary_entry.diary_entry.report") + click_on I18n.t("diary_entries.diary_entry.report") assert page.has_content? "Report" assert page.has_content? I18n.t("reports.new.disclaimer.intro")