From: Andy Allan Date: Wed, 29 May 2019 13:55:27 +0000 (+0200) Subject: Refactor some diary entry routes to use resources X-Git-Tag: live~2551^2~2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/fbcd2bc10a5f97a1ecd5d6d76a039ebd85365d2e Refactor some diary entry routes to use resources --- diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index a2a63b406..725000a13 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -49,7 +49,7 @@ <% end %>
  • <%= link_to t("layouts.gps_traces"), traces_path %>
  • -
  • <%= link_to t("layouts.user_diaries"), diary_path %>
  • +
  • <%= link_to t("layouts.user_diaries"), diary_entries_path %>
  • <%= link_to t("layouts.copyright"), copyright_path %>
  • <%= link_to t("layouts.help"), help_path %>
  • <%= link_to t("layouts.about"), about_path %>
  • @@ -65,7 +65,7 @@ <% end %>
  • <%= link_to t("layouts.gps_traces"), traces_path %>
  • -
  • <%= link_to t("layouts.user_diaries"), diary_path %>
  • +
  • <%= link_to t("layouts.user_diaries"), diary_entries_path %>
  • <%= link_to t("layouts.copyright"), copyright_path %>
  • <%= link_to t("layouts.help"), help_path %>
  • <%= link_to t("layouts.about"), about_path %>
  • diff --git a/app/views/site/about.html.erb b/app/views/site/about.html.erb index 219e0ab6b..886aaf006 100644 --- a/app/views/site/about.html.erb +++ b/app/views/site/about.html.erb @@ -17,7 +17,7 @@

    <%= t ".community_driven_title" %>

    -

    <%= t ".community_driven_html", :diary_path => diary_path %>

    +

    <%= t ".community_driven_html", :diary_path => diary_entries_path %>

    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 5090cbee0..87eb9b45f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -205,7 +205,7 @@ <% else %>
    <%= render :partial => "contact", :collection => friends, :locals => { :type => "friend" } %> @@ -221,7 +221,7 @@ <% else %>
    • <%= link_to t(".nearby_changesets"), nearby_changesets_path %>
    • -
    • <%= link_to t(".nearby_diaries"), nearby_diaries_path %>
    • +
    • <%= link_to t(".nearby_diaries"), nearby_diary_entries_path %>
    <%= render :partial => "contact", :collection => nearby, :locals => { :type => "nearby mapper" } %> diff --git a/config/routes.rb b/config/routes.rb index 12a282818..63ce06167 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -216,9 +216,12 @@ OpenStreetMap::Application.routes.draw do post "/trace/:id/delete" => "traces#delete", :id => /\d+/ # diary pages - resources :diary_entries, :path => "diary", :only => [:new, :create] - get "/diary/friends" => "diary_entries#index", :friends => true, :as => "friend_diaries" - get "/diary/nearby" => "diary_entries#index", :nearby => true, :as => "nearby_diaries" + resources :diary_entries, :path => "diary", :only => [:new, :create, :index] do + collection do + get "friends" => "diary_entries#index", :friends => true + get "nearby" => "diary_entries#index", :nearby => true + end + end 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 } @@ -226,7 +229,6 @@ OpenStreetMap::Application.routes.draw do 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" scope "/user/:display_name" do resources :diary_entries, :path => "diary", :only => [:edit, :update, :show] end diff --git a/test/system/diary_entry_test.rb b/test/system/diary_entry_test.rb index 39ccc04b2..6b6a51de5 100644 --- a/test/system/diary_entry_test.rb +++ b/test/system/diary_entry_test.rb @@ -8,7 +8,7 @@ class DiaryEntrySystemTest < ApplicationSystemTestCase test "reply to diary entry should prefill the message subject" do sign_in_as(create(:user)) - visit diary_path + visit diary_entries_path click_on "Reply to this entry"