From dd0373a3ee1e04297a588b98c139c1b559a8e85e Mon Sep 17 00:00:00 2001 From: Mackenzie Morgan Date: Thu, 26 May 2016 11:51:46 -0400 Subject: [PATCH 1/2] Use standardized & translateable strings for the photo show page Fixes #876 --- app/views/photos/show.html.haml | 6 +++--- config/locales/en.yml | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/photos/show.html.haml b/app/views/photos/show.html.haml index d09464152..5d941c2ba 100644 --- a/app/views/photos/show.html.haml +++ b/app/views/photos/show.html.haml @@ -24,13 +24,13 @@ %ul - if @photo.plantings.size > 0 - @photo.plantings.each do |p| - %li= link_to p, p + %li= link_to t('.thing_by', thing: Planting.model_name.singular, owner: p.owner), p - if @photo.harvests.size > 0 - @photo.harvests.each do |h| - %li= link_to h, h + %li= link_to t('.thing_by', thing: Harvest.model_name.singular, owner: h.owner), h - if @photo.gardens.size > 0 - @photo.gardens.each do |g| - %li= link_to g, g + %li= link_to t('.thing_by', thing: Garden.model_name.singular, owner: g.owner), g .row diff --git a/config/locales/en.yml b/config/locales/en.yml index 27e8c5a91..480db0e0c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -54,6 +54,10 @@ en: crop_plantings: "Everyone's %{crop} plantings" owner_plantings: "%{owner} plantings" + photos: + show: + thing_by: "A %{thing} by %{owner}" + harvests: index: title: From 58f4ae32d07033db9cd3dbf1e3e224bcd9713401 Mon Sep 17 00:00:00 2001 From: Mackenzie Morgan Date: Thu, 26 May 2016 12:28:58 -0400 Subject: [PATCH 2/2] test update --- spec/features/photos/show_photo_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/photos/show_photo_spec.rb b/spec/features/photos/show_photo_spec.rb index 238e69eda..bf72f5fd6 100644 --- a/spec/features/photos/show_photo_spec.rb +++ b/spec/features/photos/show_photo_spec.rb @@ -14,7 +14,7 @@ feature "show photo page" do scenario "shows linkback to planting" do planting.photos << photo visit photo_path(photo) - expect(page).to have_link planting, href: planting_path(planting) + expect(page).to have_link "A planting by #{planting.owner}", href: planting_path(planting) end end @@ -24,7 +24,7 @@ feature "show photo page" do scenario "shows linkback to harvest" do harvest.photos << photo visit photo_path(photo) - expect(page).to have_link harvest, href: harvest_path(harvest) + expect(page).to have_link "A harvest by #{harvest.owner}", href: harvest_path(harvest) end end @@ -34,7 +34,7 @@ feature "show photo page" do scenario "shows linkback to garden" do garden.photos << photo visit photo_path(photo) - expect(page).to have_link garden, href: garden_path(garden) + expect(page).to have_link "A garden by #{garden.owner}", href: garden_path(garden) end end end