From 11e52dbe98b93a3f9a5eab4174492e959d20c368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 11 Oct 2019 02:28:00 +0200 Subject: [PATCH] Remove kaminari_path The main reason to use it was the `rel` attribute for previous/next pages not being indexed correctly by certain search engines when using a relative URL. However, AFAIK that only applied to `` tags, not to `` tags, and only if a `` tag was defined. In any case, it looks like the same search engines don't use the `rel` attribute for previous/next to index pages anymore. --- app/helpers/application_helper.rb | 4 ---- app/views/kaminari/_first_page.html.erb | 2 +- app/views/kaminari/_last_page.html.erb | 2 +- app/views/kaminari/_next_page.html.erb | 2 +- app/views/kaminari/_page.html.erb | 2 +- app/views/kaminari/_prev_page.html.erb | 2 +- spec/features/admin/site_customization/documents_spec.rb | 2 +- spec/features/proposals_spec.rb | 2 +- 8 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1033d0420..9785c46cf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -55,10 +55,6 @@ module ApplicationHelper SiteCustomization::ContentBlock.block_for(name, locale) end - def kaminari_path(url) - "#{root_url.chomp("\/")}#{url}" - end - def self.asset_data_base64(path) asset = (Rails.application.assets || ::Sprockets::Railtie.build_environment(Rails.application)) .find_asset(path) diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb index a5335a30b..c97a20740 100644 --- a/app/views/kaminari/_first_page.html.erb +++ b/app/views/kaminari/_first_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.first"), kaminari_path(url), :remote => remote %> + <%= link_to t("views.pagination.first"), url, :remote => remote %>
  • diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb index 697b3bd15..cc2929aa0 100644 --- a/app/views/kaminari/_last_page.html.erb +++ b/app/views/kaminari/_last_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.last"), kaminari_path(url), :remote => remote %> + <%= link_to t("views.pagination.last"), url, :remote => remote %>
  • diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb index 366367031..6da585a67 100644 --- a/app/views/kaminari/_next_page.html.erb +++ b/app/views/kaminari/_next_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.next"), kaminari_path(url), :rel => "next", :remote => remote %> + <%= link_to t("views.pagination.next"), url, :rel => "next", :remote => remote %>
  • diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb index 5d9e7a0d8..c82b8968c 100644 --- a/app/views/kaminari/_page.html.erb +++ b/app/views/kaminari/_page.html.erb @@ -5,6 +5,6 @@ <% else %>
  • - <%= link_to page, kaminari_path(url), { :remote => remote, :rel => page.next? ? "next" : page.prev? ? "prev" : nil } %> + <%= link_to page, url, { :remote => remote, :rel => page.next? ? "next" : page.prev? ? "prev" : nil } %>
  • <% end %> diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb index d0147ff5c..2ee045967 100644 --- a/app/views/kaminari/_prev_page.html.erb +++ b/app/views/kaminari/_prev_page.html.erb @@ -1,3 +1,3 @@
  • - <%= link_to t("views.pagination.previous"), kaminari_path(url), :rel => "prev", :remote => remote %> + <%= link_to t("views.pagination.previous"), url, :rel => "prev", :remote => remote %>
  • diff --git a/spec/features/admin/site_customization/documents_spec.rb b/spec/features/admin/site_customization/documents_spec.rb index 92f322fac..3d13b30b8 100644 --- a/spec/features/admin/site_customization/documents_spec.rb +++ b/spec/features/admin/site_customization/documents_spec.rb @@ -47,7 +47,7 @@ describe "Documents" do within("ul.pagination") do expect(page).to have_content("1") - expect(page).to have_link("2", href: admin_site_customization_documents_url(page: 2)) + expect(page).to have_link("2", href: admin_site_customization_documents_path(page: 2)) expect(page).not_to have_content("3") click_link "Next", exact: false end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index b4b6e0cfa..a048f7c3c 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -103,7 +103,7 @@ describe "Proposals" do within("ul.pagination") do expect(page).to have_content("1") - expect(page).to have_link("2", href: "http://www.example.com/proposals?page=2") + expect(page).to have_link("2", href: "/proposals?page=2") expect(page).not_to have_content("3") click_link "Next", exact: false end