diff --git a/app/assets/stylesheets/components/common.scss b/app/assets/stylesheets/components/common.scss index 07854368..020bf413 100644 --- a/app/assets/stylesheets/components/common.scss +++ b/app/assets/stylesheets/components/common.scss @@ -145,7 +145,3 @@ footer { color: #BE1E2D; } } - -.locale_link { - margin: 0px 5px; -} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d0ee37ba..103cf92c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml index 2266faef..422b5898 100644 --- a/app/views/layouts/_footer.html.haml +++ b/app/views/layouts/_footer.html.haml @@ -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" + diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 84a91d27..af1795d1 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -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') @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 273d8d6b..47a7974f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/spec/features/contacts_spec.rb b/spec/features/contacts_spec.rb index 3a53d8cc..3752214c 100644 --- a/spec/features/contacts_spec.rb +++ b/spec/features/contacts_spec.rb @@ -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')