Skip to content

Commit

Permalink
chore: translations of account invites
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellberg committed Apr 11, 2024
1 parent 808087a commit 7fbb2c3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 32 deletions.
30 changes: 0 additions & 30 deletions config/locales/kiqr.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,6 @@ en:
button: "Remove team member"
form:
submit: "Save changes"
invitations:
new:
title: "Invite a user"
description: "Invite a user to your team"
box_title: "Invite a user to your team"
instructions: "Enter the email address of the user you want to invite to your team. Anyone with the link can join your team, so be careful who you share it with."
back_to_members: "Back to team members"
form:
email:
placeholder: "Enter the email address"
submit: "Send invitation"
errors:
email:
taken: "has already been invited."
index:
title: "Pending invitations"
description: "Manage invitations to your team"
box_title: "Pending invitations to %{team_name}"
no_invitations: "No invitations have been sent yet."
confirm_delete: "Are you sure you want to cancel the invitation to %{email}?"
table:
email: "Email"
sent_at: "Sent at"
buttons:
invite: "Invite a new user"
back: "Back to team members"
create:
invitation_sent: "Invitation has been sent to %{email}."
destroy:
deleted: "Invitation has been successfully deleted."
account_users:
destroy:
success: "Member has successfully been removed from the team."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def create
def destroy
@invitation = current_account.account_invitations.find_puid!(params[:id])
Kiqr::Services::Invitations::Destroy.call!(invitation: @invitation, user: current_user)
redirect_to account_invitations_path, notice: t(".deleted")
kiqr_flash_message(:notice, :invitation_destroyed)
redirect_to account_invitations_path
end

private
Expand Down
2 changes: 1 addition & 1 deletion gems/kiqr/app/models/account_invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AccountInvitation < ApplicationRecord
belongs_to :account, inverse_of: :account_invitations, counter_cache: true

validates :email, presence: true, format: {with: URI::MailTo::EMAIL_REGEXP}
validates :email, uniqueness: {scope: :account_id, message: I18n.t("accounts.invitations.new.form.errors.email.taken")}
validates :email, uniqueness: {scope: :account_id, message: I18n.t("kiqr.accounts.invitations.errors.email_taken")}

scope :pending, -> { where(accepted_at: nil) }
end
32 changes: 32 additions & 0 deletions gems/kiqr/config/locales/kiqr/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ en:
account_created: "Your account has been created successfully."
account_updated: "Your account has been updated successfully."
invitation_sent: "An invitation email has been sent to %{email}."
invitation_destroyed: "The invitation has been destroyed."
invitation_accepted: "You have accepted the invitation to join %{team}."
invitation_rejected: "You have rejected the invitation to join %{team}."
accounts:
new:
title: "Create a new team account"
Expand All @@ -23,3 +26,32 @@ en:
button:
save: "Save changes"
create: "Create new account"
invitations:
errors:
email_taken: "has already been invited."
new:
title: "Invite a user"
description: "Invite a user to your team"
box_title: "Invite a user to your team"
instructions: "Enter the email address of the user you want to invite to your team. Anyone with the link can join your team, so be careful who you share it with."
back_to_members: "Back to team members"
form:
email:
placeholder: "Enter the email address"
submit: "Send invitation"
index:
title: "Pending invitations"
description: "Manage invitations to your team"
box_title: "Pending invitations to %{team_name}"
no_invitations: "No invitations have been sent yet."
confirm_delete: "Are you sure you want to cancel the invitation to %{email}?"
table:
email: "Email"
sent_at: "Sent at"
buttons:
invite: "Invite a new user"
back: "Back to team members"
create:
invitation_sent: "Invitation has been sent to %{email}."
destroy:
deleted: "Invitation has been successfully deleted."

0 comments on commit 7fbb2c3

Please sign in to comment.