Browse Source

Add possessive gem for names formatting

pull/624/head
Kat 3 years ago
parent
commit
f8a203e3fe
  1. 1
      Gemfile
  2. 2
      Gemfile.lock
  3. 4
      app/controllers/users_controller.rb
  4. 6
      config/locales/devise.en.yml

1
Gemfile

@ -59,6 +59,7 @@ gem "sentry-rails"
gem "sentry-ruby" gem "sentry-ruby"
# Pagination # Pagination
gem "pagy" gem "pagy"
gem "possessive"
group :development, :test do group :development, :test do
# Check gems for known vulnerabilities # Check gems for known vulnerabilities

2
Gemfile.lock

@ -253,6 +253,7 @@ GEM
parser (3.1.2.0) parser (3.1.2.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (1.3.5) pg (1.3.5)
possessive (1.0.1)
postcodes_io (0.4.0) postcodes_io (0.4.0)
excon (~> 0.39) excon (~> 0.39)
propshaft (0.6.4) propshaft (0.6.4)
@ -452,6 +453,7 @@ DEPENDENCIES
paper_trail paper_trail
paper_trail-globalid paper_trail-globalid
pg (~> 1.1) pg (~> 1.1)
possessive
postcodes_io postcodes_io
propshaft propshaft
pry-byebug pry-byebug

4
app/controllers/users_controller.rb

@ -44,10 +44,10 @@ class UsersController < ApplicationController
case user_params[:active] case user_params[:active]
when "false" when "false"
@user.update!(confirmed_at: nil, sign_in_count: 0, encrypted_password: "") @user.update!(confirmed_at: nil, sign_in_count: 0, encrypted_password: "")
flash[:notice] = I18n.t("devise.activation.deactivated", user_name: @user.name) flash[:notice] = I18n.t("devise.activation.deactivated", user_name: @user.name.possessive)
when "true" when "true"
@user.send_confirmation_instructions @user.send_confirmation_instructions
flash[:notice] = I18n.t("devise.activation.reactivated", user_name: @user.name) flash[:notice] = I18n.t("devise.activation.reactivated", user_name: @user.name.possessive)
end end
redirect_to user_path(@user) redirect_to user_path(@user)
end end

6
config/locales/devise.en.yml

@ -28,7 +28,7 @@ en:
password_change: password_change:
subject: "Password successfully changed" subject: "Password successfully changed"
omniauth_callbacks: omniauth_callbacks:
failure: "We could not authenticate you from %{kind} because \"%{reason}\"" failure: 'We could not authenticate you from %{kind} because "%{reason}"'
success: "Successfully authenticated from %{kind} account" success: "Successfully authenticated from %{kind} account"
passwords: passwords:
no_token: "You can’t access this page unless you’re trying to reset your password. Check you’re using the correct URL in the email we sent you." no_token: "You can’t access this page unless you’re trying to reset your password. Check you’re using the correct URL in the email we sent you."
@ -55,8 +55,8 @@ en:
send_paranoid_instructions: "If your account exists, you will receive an email in a few minutes with instructions for how to unlock it" send_paranoid_instructions: "If your account exists, you will receive an email in a few minutes with instructions for how to unlock it"
unlocked: "Your account has been successfully unlocked. Sign in to continue." unlocked: "Your account has been successfully unlocked. Sign in to continue."
activation: activation:
deactivated: "%{user_name}’s account has been deactivated." deactivated: "%{user_name} account has been deactivated."
reactivated: "%{user_name}’s account has been reactivated." reactivated: "%{user_name} account has been reactivated."
errors: errors:
messages: messages:

Loading…
Cancel
Save