Skip to content

Commit

Permalink
Revert "Add a locale switcher (#620)"
Browse files Browse the repository at this point in the history
(This PR still needs some work.)

This reverts commit aed3e1e.
  • Loading branch information
DeeDeeG committed Apr 23, 2020
1 parent aed3e1e commit 6b49bca
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 45 deletions.
4 changes: 0 additions & 4 deletions app/assets/stylesheets/components/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,3 @@ footer {
color: #BE1E2D;
}
}

.locale_link {
margin: 0px 5px;
}
6 changes: 1 addition & 5 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ def mobile_filter_header
end

def set_locale
I18n.locale = params[:locale] || http_accept_language.language_region_compatible_from(I18n.available_locales)
I18n.locale = http_accept_language.language_region_compatible_from(I18n.available_locales)
end

def default_url_options
{ locale: I18n.locale }
end

end
18 changes: 1 addition & 17 deletions app/views/layouts/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,4 @@
%a{:href => "https://patreon.com/refugerestrooms"} #{t('.on-patreon')}
%br/
= "\© #{t('.copyleft')} #{Date.today.year} #{t('.refuge-restrooms')}".html_safe
%br/
%br/
= link_to 'English', request.query_parameters.merge({:locale => 'en'}), class: "locale_link"
•
= link_to 'Español', request.query_parameters.merge({:locale => 'es'}), class: "locale_link"
•
= link_to 'Filipino/Tagalog', request.query_parameters.merge({:locale => 'fil'}), class: "locale_link"
•
= link_to 'Français', request.query_parameters.merge({:locale => 'fr'}), class: "locale_link"
•
= link_to 'हिन्दी', request.query_parameters.merge({:locale => 'hi'}), class: "locale_link"
•
= link_to 'Italiano', request.query_parameters.merge({:locale => 'it'}), class: "locale_link"
•
= link_to 'polski', request.query_parameters.merge({:locale => 'pl'}), class: "locale_link"
•
= link_to 'Português do Brasil', request.query_parameters.merge({:locale => 'pt-BR'}), class: "locale_link"

4 changes: 2 additions & 2 deletions app/views/layouts/_navigation.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%nav.nav.navbar-default{:role => "navigation"}
/ Brand and toggle get grouped for better mobile display
.navbar-header
= link_to root_path, id: "logo", class: "toiletLogo" do
%a#logo.toiletLogo{:href => "/"}
.navbar-brand Refuge Restrooms
%button.navbar-toggle{"data-target" => "#bs-example-navbar-collapse-1", "data-toggle" => "collapse", :type => "button"}
%span.sr-only= t('.toggle-navigation-button-label')
Expand All @@ -21,5 +21,5 @@
%b.caret
%ul.dropdown-menu
%li= link_to t('.download-unisex-restroom-signs-hyperlink-label'), page_path('signs')
%li= link_to t('.public-api-hyperlink-label'), api_docs_path
%li= link_to t('.public-api-hyperlink-label'), '/api/docs/'
/ /.navbar-collapse
23 changes: 7 additions & 16 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,18 @@
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

devise_for :admin_users, ActiveAdmin::Devise.config
get '/:locale' => 'pages#index'
root 'pages#index'

ActiveAdmin.routes(self)
scope "(:locale)" do
resources :restrooms, except: [:edit, :destroy]
end
resources :restrooms, except: [:edit, :destroy]

namespace :api do
scope "(:locale)" do
resources :docs, only: [:index]
end
resources :docs, only: [:index]
end

mount API::Base => '/api'
scope "(:locale)" do
get '/contact', to: 'contacts#new'
get "/*id" => 'pages#show', as: :page, format: false
end

scope "(:locale)" do
resources "contacts", only: [:new, :create]
end
get '/contact', to: 'contacts#new'
get "/*id" => 'pages#show', as: :page, format: false
root 'pages#index'

resources "contacts", only: [:new, :create]
end
2 changes: 1 addition & 1 deletion spec/features/contacts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
it 'should show a generic contact when contact is not from restroom form' do
restroom = create(:restroom, name: "Mission Creek Cafe")

visit restroom_path(:id => restroom.id)
visit restroom_path restroom
click_link 'Contact'

expect(page).to_not have_content('Mission Creek Cafe')
Expand Down

0 comments on commit 6b49bca

Please sign in to comment.