From 207c2a704c1ac2c5744f2677b3743d5a3e39ee35 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 15 May 2019 13:44:36 +0300 Subject: [PATCH] Rename profile page in registrar area to account --- .../{profile_controller.rb => account_controller.rb} | 2 +- app/controllers/registrar/sessions_controller.rb | 2 +- app/views/layouts/registrar/base.html.erb | 2 +- .../registrar/{profile => account}/_linked_users.html.erb | 0 app/views/registrar/{profile => account}/show.html.erb | 0 app/views/registrar/base/_current_user.html.erb | 2 +- config/locales/registrar/{profile.en.yml => account.en.yml} | 4 ++-- config/routes.rb | 2 +- spec/features/registrar/linked_users_spec.rb | 2 +- test/system/registrar_area/sign_in/password_test.rb | 4 ++-- 10 files changed, 10 insertions(+), 10 deletions(-) rename app/controllers/registrar/{profile_controller.rb => account_controller.rb} (84%) rename app/views/registrar/{profile => account}/_linked_users.html.erb (100%) rename app/views/registrar/{profile => account}/show.html.erb (100%) rename config/locales/registrar/{profile.en.yml => account.en.yml} (71%) diff --git a/app/controllers/registrar/profile_controller.rb b/app/controllers/registrar/account_controller.rb similarity index 84% rename from app/controllers/registrar/profile_controller.rb rename to app/controllers/registrar/account_controller.rb index 1fe6d6a0b..2c942aed7 100644 --- a/app/controllers/registrar/profile_controller.rb +++ b/app/controllers/registrar/account_controller.rb @@ -1,5 +1,5 @@ class Registrar - class ProfileController < BaseController + class AccountController < BaseController skip_authorization_check helper_method :linked_users diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index e8873c584..c97c3155d 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -182,7 +182,7 @@ class Registrar if can?(:show, :poll) registrar_root_path else - registrar_profile_path + registrar_account_path end end diff --git a/app/views/layouts/registrar/base.html.erb b/app/views/layouts/registrar/base.html.erb index e3e93f89f..4d4f1b972 100644 --- a/app/views/layouts/registrar/base.html.erb +++ b/app/views/layouts/registrar/base.html.erb @@ -24,7 +24,7 @@ - <%= link_to can?(:show, :poll) ? registrar_root_path : registrar_profile_path, + <%= link_to can?(:show, :poll) ? registrar_root_path : registrar_account_path, class: 'navbar-brand' do %> <%= t(:registrar_head_title) %> <% if unstable_env.present? %> diff --git a/app/views/registrar/profile/_linked_users.html.erb b/app/views/registrar/account/_linked_users.html.erb similarity index 100% rename from app/views/registrar/profile/_linked_users.html.erb rename to app/views/registrar/account/_linked_users.html.erb diff --git a/app/views/registrar/profile/show.html.erb b/app/views/registrar/account/show.html.erb similarity index 100% rename from app/views/registrar/profile/show.html.erb rename to app/views/registrar/account/show.html.erb diff --git a/app/views/registrar/base/_current_user.html.erb b/app/views/registrar/base/_current_user.html.erb index f200c9376..a21792b3c 100644 --- a/app/views/registrar/base/_current_user.html.erb +++ b/app/views/registrar/base/_current_user.html.erb @@ -1,4 +1,4 @@ <% current_user_presenter = UserPresenter.new(user: current_registrar_user, view: self) %> -<%= link_to current_user_presenter.login_with_role, registrar_profile_path, class: 'navbar-link' %> +<%= link_to current_user_presenter.login_with_role, registrar_account_path, class: 'navbar-link' %> | <%= link_to t('.sign_out'), destroy_registrar_user_session_path, method: :delete, class: 'navbar-link' %> diff --git a/config/locales/registrar/profile.en.yml b/config/locales/registrar/account.en.yml similarity index 71% rename from config/locales/registrar/profile.en.yml rename to config/locales/registrar/account.en.yml index 2ccec1406..42e0de6de 100644 --- a/config/locales/registrar/profile.en.yml +++ b/config/locales/registrar/account.en.yml @@ -1,8 +1,8 @@ en: registrar: - profile: + account: show: - header: My profile + header: Your account linked_users: header: Linked users diff --git a/config/routes.rb b/config/routes.rb index 0f093d45b..23ac67a50 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,7 +66,7 @@ Rails.application.routes.draw do resources :account_activities put 'current_user/switch/:new_user_id', to: 'current_user#switch', as: :switch_current_user - resource :profile, controller: :profile, only: :show + resource :account, controller: :account, only: :show resources :domains do collection do diff --git a/spec/features/registrar/linked_users_spec.rb b/spec/features/registrar/linked_users_spec.rb index f7731a168..aa1e3785b 100644 --- a/spec/features/registrar/linked_users_spec.rb +++ b/spec/features/registrar/linked_users_spec.rb @@ -10,7 +10,7 @@ RSpec.feature 'Registrar area linked users', settings: false do end scenario 'switches current user to a linked one' do - visit registrar_profile_path + visit registrar_account_path click_link_or_button 'switch-current-user-2-btn' expect(page).to have_text('You are now signed in as a user "new-user-name"') end diff --git a/test/system/registrar_area/sign_in/password_test.rb b/test/system/registrar_area/sign_in/password_test.rb index 04dffd07b..433c56d9d 100644 --- a/test/system/registrar_area/sign_in/password_test.rb +++ b/test/system/registrar_area/sign_in/password_test.rb @@ -17,10 +17,10 @@ class RegistrarAreaPasswordSignInTest < ApplicationSystemTestCase assert_current_path registrar_root_path end - def test_after_successful_sign_in_billing_user_sees_profile + def test_after_successful_sign_in_billing_user_sees_account @user.update!(roles: [ApiUser::BILLING]) login_with_correct_credentials - assert_current_path registrar_profile_path + assert_current_path registrar_account_path end def test_wrong_password