diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-06-07 16:51:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-07 16:51:08 +0200 |
commit | 560ec24e585face30ee99d5bba39a02948fd118f (patch) | |
tree | 7e2739d163f9318b9e8defd27c93fbd31d472766 | |
parent | cdb420862eb54f6fbfde3b8485a61e0c052ff9f4 (diff) |
Change /settings/preferences to redirect to appearance, add /settings/preferences/other (#10988)
-rw-r--r-- | app/controllers/settings/preferences/other_controller.rb | 9 | ||||
-rw-r--r-- | app/views/settings/preferences/other/show.html.haml (renamed from app/views/settings/preferences/show.html.haml) | 0 | ||||
-rw-r--r-- | config/navigation.rb | 4 | ||||
-rw-r--r-- | config/routes.rb | 6 | ||||
-rw-r--r-- | spec/controllers/settings/preferences/other_controller_spec.rb (renamed from spec/controllers/settings/preferences_controller_spec.rb) | 6 |
5 files changed, 18 insertions, 7 deletions
diff --git a/app/controllers/settings/preferences/other_controller.rb b/app/controllers/settings/preferences/other_controller.rb new file mode 100644 index 000000000..07eb89a76 --- /dev/null +++ b/app/controllers/settings/preferences/other_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class Settings::Preferences::OtherController < Settings::PreferencesController + private + + def after_update_redirect_path + settings_preferences_other_path + end +end diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/other/show.html.haml index c966a16bc..c966a16bc 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/other/show.html.haml diff --git a/config/navigation.rb b/config/navigation.rb index 45e5bc562..df1024189 100644 --- a/config/navigation.rb +++ b/config/navigation.rb @@ -10,10 +10,10 @@ SimpleNavigation::Configuration.run do |navigation| s.item :identity_proofs, safe_join([fa_icon('key fw'), t('settings.identity_proofs')]), settings_identity_proofs_path, highlights_on: %r{/settings/identity_proofs*}, if: proc { current_account.identity_proofs.exists? } end - n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_appearance_url do |s| + n.item :preferences, safe_join([fa_icon('cog fw'), t('settings.preferences')]), settings_preferences_url do |s| s.item :appearance, safe_join([fa_icon('desktop fw'), t('settings.appearance')]), settings_preferences_appearance_url s.item :notifications, safe_join([fa_icon('bell fw'), t('settings.notifications')]), settings_preferences_notifications_url - s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_url + s.item :other, safe_join([fa_icon('cog fw'), t('preferences.other')]), settings_preferences_other_url end n.item :relationships, safe_join([fa_icon('users fw'), t('settings.relationships')]), relationships_url diff --git a/config/routes.rb b/config/routes.rb index 2b35472bd..145079c69 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -87,15 +87,17 @@ Rails.application.routes.draw do get '/explore', to: 'directories#index', as: :explore get '/explore/:id', to: 'directories#show', as: :explore_hashtag - get '/settings', to: redirect('/settings/preferences') + get '/settings', to: redirect('/settings/profile') namespace :settings do resource :profile, only: [:show, :update] - resource :preferences, only: [:show, :update] + + get :preferences, to: redirect('/settings/preferences/appearance') namespace :preferences do resource :appearance, only: [:show, :update], controller: :appearance resource :notifications, only: [:show, :update] + resource :other, only: [:show, :update], controller: :other end resource :import, only: [:show, :create] diff --git a/spec/controllers/settings/preferences_controller_spec.rb b/spec/controllers/settings/preferences/other_controller_spec.rb index f2028cf39..1b556ac7f 100644 --- a/spec/controllers/settings/preferences_controller_spec.rb +++ b/spec/controllers/settings/preferences/other_controller_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe Settings::PreferencesController do +describe Settings::Preferences::OtherController do render_views let(:user) { Fabricate(:user, filtered_languages: []) } @@ -20,7 +20,7 @@ describe Settings::PreferencesController do it 'updates the user record' do put :update, params: { user: { locale: 'en', chosen_languages: ['es', 'fr', ''] } } - expect(response).to redirect_to(settings_preferences_path) + expect(response).to redirect_to(settings_preferences_other_path) user.reload expect(user.locale).to eq 'en' expect(user.chosen_languages).to eq ['es', 'fr'] @@ -37,7 +37,7 @@ describe Settings::PreferencesController do } } - expect(response).to redirect_to(settings_preferences_path) + expect(response).to redirect_to(settings_preferences_other_path) user.reload expect(user.settings['boost_modal']).to be true expect(user.settings['delete_modal']).to be false |