chore(users): translate forms, fix colors

This commit is contained in:
Ivan R. 2024-07-22 21:12:29 +05:00
parent eadc784bc3
commit 66bb26380a
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
15 changed files with 82 additions and 77 deletions

View file

@ -128,7 +128,6 @@
.simple-form {
margin-top: 2rem;
background-color: #ffffff;
}
.simple-form-action {
@ -148,7 +147,6 @@
font-size: 0.875rem;
font-weight: 600;
line-height: 1.5rem;
color: #ffffff;
}
.input {

View file

@ -7,22 +7,22 @@ defmodule ComfycampWeb.UserConfirmationInstructionsLive do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">
No confirmation instructions received?
<:subtitle>We'll send a new confirmation link to your inbox</:subtitle>
Не получили инструкцию для подтверждения?
<:subtitle>Мы отправим новую ссылку на вашу почту.</:subtitle>
</.header>
<.simple_form for={@form} id="resend_confirmation_form" phx-submit="send_instructions">
<.input field={@form[:email]} type="email" placeholder="Email" required />
<:actions>
<.button phx-disable-with="Sending..." class="w-full">
Resend confirmation instructions
<.button phx-disable-with="Отправляю..." class="w-full">
Отправить инструкции повторно
</.button>
</:actions>
</.simple_form>
<p class="text-center mt-4">
<.link href={~p"/users/register"}>Register</.link>
| <.link href={~p"/users/log_in"}>Log in</.link>
<.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Войти</.link>
</p>
</div>
"""

View file

@ -6,18 +6,18 @@ defmodule ComfycampWeb.UserConfirmationLive do
def render(%{live_action: :edit} = assigns) do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">Confirm Account</.header>
<.header class="text-center">Подтвердить аккаунт</.header>
<.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account">
<input type="hidden" name={@form[:token].name} value={@form[:token].value} />
<:actions>
<.button phx-disable-with="Confirming..." class="w-full">Confirm my account</.button>
<.button phx-disable-with="Confirming..." class="w-full">Подтвердить мой аккаунт</.button>
</:actions>
</.simple_form>
<p class="text-center mt-4">
<.link href={~p"/users/register"}>Register</.link>
| <.link href={~p"/users/log_in"}>Log in</.link>
<.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Войти</.link>
</p>
</div>
"""

View file

@ -7,21 +7,21 @@ defmodule ComfycampWeb.UserForgotPasswordLive do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">
Forgot your password?
<:subtitle>We'll send a password reset link to your inbox</:subtitle>
Забыли пароль?
<:subtitle>Мы отправим ссылку для сброса пароля.</:subtitle>
</.header>
<.simple_form for={@form} id="reset_password_form" phx-submit="send_email">
<.input field={@form[:email]} type="email" placeholder="Email" required />
<:actions>
<.button phx-disable-with="Sending..." class="w-full">
Send password reset instructions
<.button phx-disable-with="Отправляю..." class="w-full">
Отправить инструкции
</.button>
</:actions>
</.simple_form>
<p class="text-center text-sm mt-4">
<.link href={~p"/users/register"}>Register</.link>
| <.link href={~p"/users/log_in"}>Log in</.link>
<.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Войти</.link>
</p>
</div>
"""

View file

@ -5,29 +5,29 @@ defmodule ComfycampWeb.UserLoginLive do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">
Log in to account
Войти в аккаунт
<:subtitle>
Don't have an account?
Нет аккаунта?
<.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline">
Sign up
Создайте
</.link>
for an account now.
новый.
</:subtitle>
</.header>
<.simple_form for={@form} id="login_form" action={~p"/users/log_in"} phx-update="ignore">
<.input field={@form[:email]} type="email" label="Email" required />
<.input field={@form[:password]} type="password" label="Password" required />
<.input field={@form[:password]} type="password" label="Пароль" required />
<:actions>
<.input field={@form[:remember_me]} type="checkbox" label="Keep me logged in" />
<.input field={@form[:remember_me]} type="checkbox" label="Запомнить" />
<.link href={~p"/users/reset_password"} class="text-sm font-semibold">
Forgot your password?
Забыли пароль?
</.link>
</:actions>
<:actions>
<.button phx-disable-with="Logging in..." class="w-full">
Log in <span aria-hidden="true"></span>
<.button phx-disable-with="Вхожу..." class="w-full">
Войти <span aria-hidden="true"></span>
</.button>
</:actions>
</.simple_form>

View file

@ -6,15 +6,15 @@ defmodule ComfycampWeb.UserRegistrationLive do
def render(assigns) do
~H"""
<div class="mx-auto max-w-sm">
<div class="">
<.header class="text-center">
Register for an account
Создайте аккаунт
<:subtitle>
Already registered?
Уже зарегистрированы?
<.link navigate={~p"/users/log_in"} class="font-semibold text-brand hover:underline">
Log in
Войти
</.link>
to your account now.
в аккаунт.
</:subtitle>
</.header>
@ -28,14 +28,16 @@ defmodule ComfycampWeb.UserRegistrationLive do
method="post"
>
<.error :if={@check_errors}>
Oops, something went wrong! Please check the errors below.
Что-то пошло не так. Проверьте ошибки ниже.
</.error>
<.input field={@form[:email]} type="email" label="Email" required />
<.input field={@form[:password]} type="password" label="Password" required />
<.input field={@form[:password]} type="password" label="Пароль" required />
<:actions>
<.button phx-disable-with="Creating account..." class="w-full">Create an account</.button>
<.button phx-disable-with="Создаю аккаунт..." class="w-full">
Создать аккаунт
</.button>
</:actions>
</.simple_form>
</div>

View file

@ -6,7 +6,7 @@ defmodule ComfycampWeb.UserResetPasswordLive do
def render(assigns) do
~H"""
<div class="mx-auto max-w-sm">
<.header class="text-center">Reset Password</.header>
<.header class="text-center">Сброс пароля</.header>
<.simple_form
for={@form}
@ -15,24 +15,24 @@ defmodule ComfycampWeb.UserResetPasswordLive do
phx-change="validate"
>
<.error :if={@form.errors != []}>
Oops, something went wrong! Please check the errors below.
Упс, что-то пошло не так. Проверьте ошибки ниже.
</.error>
<.input field={@form[:password]} type="password" label="New password" required />
<.input field={@form[:password]} type="password" label="Новый пароль" required />
<.input
field={@form[:password_confirmation]}
type="password"
label="Confirm new password"
label="Подтвердите новый пароль"
required
/>
<:actions>
<.button phx-disable-with="Resetting..." class="w-full">Reset Password</.button>
<.button phx-disable-with="Сбрасываю..." class="w-full">Сбросить пароль</.button>
</:actions>
</.simple_form>
<p class="text-center text-sm mt-4">
<.link href={~p"/users/register"}>Register</.link>
| <.link href={~p"/users/log_in"}>Log in</.link>
<.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Войти</.link>
</p>
</div>
"""

View file

@ -6,8 +6,8 @@ defmodule ComfycampWeb.UserSettingsLive do
def render(assigns) do
~H"""
<.header class="text-center">
Account Settings
<:subtitle>Manage your account email address and password settings</:subtitle>
Настройки аккаунта
<:subtitle>Настройки email адреса и пароля</:subtitle>
</.header>
<div class="space-y-12 divide-y">
@ -24,12 +24,12 @@ defmodule ComfycampWeb.UserSettingsLive do
name="current_password"
id="current_password_for_email"
type="password"
label="Current password"
label="Текущий пароль"
value={@email_form_current_password}
required
/>
<:actions>
<.button phx-disable-with="Changing...">Change Email</.button>
<.button phx-disable-with="Изменяю...">Изменить email</.button>
</:actions>
</.simple_form>
</div>
@ -49,23 +49,28 @@ defmodule ComfycampWeb.UserSettingsLive do
id="hidden_user_email"
value={@current_email}
/>
<.input field={@password_form[:password]} type="password" label="New password" required />
<.input
field={@password_form[:password]}
type="password"
label="Новый пароль"
required
/>
<.input
field={@password_form[:password_confirmation]}
type="password"
label="Confirm new password"
label="Подтвердите новый пароль"
/>
<.input
field={@password_form[:current_password]}
name="current_password"
type="password"
label="Current password"
label="Текущий пароль"
id="current_password_for_password"
value={@current_password}
required
/>
<:actions>
<.button phx-disable-with="Changing...">Change Password</.button>
<.button phx-disable-with="Изменяю...">Изменить пароль</.button>
</:actions>
</.simple_form>
</div>

View file

@ -14,7 +14,7 @@ defmodule ComfycampWeb.UserConfirmationInstructionsLiveTest do
describe "Resend confirmation" do
test "renders the resend confirmation page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/confirm")
assert html =~ "Resend confirmation instructions"
assert html =~ "Отправить инструкции повторно"
end
test "sends a new confirmation token", %{conn: conn, user: user} do

View file

@ -14,7 +14,7 @@ defmodule ComfycampWeb.UserConfirmationLiveTest do
describe "Confirm user" do
test "renders confirmation page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/confirm/some-token")
assert html =~ "Confirm Account"
assert html =~ "Подтвердить аккаунт"
end
test "confirms the given token once", %{conn: conn, user: user} do

View file

@ -11,9 +11,9 @@ defmodule ComfycampWeb.UserForgotPasswordLiveTest do
test "renders email page", %{conn: conn} do
{:ok, lv, html} = live(conn, ~p"/users/reset_password")
assert html =~ "Forgot your password?"
assert has_element?(lv, ~s|a[href="#{~p"/users/register"}"]|, "Register")
assert has_element?(lv, ~s|a[href="#{~p"/users/log_in"}"]|, "Log in")
assert html =~ "Забыли пароль?"
assert has_element?(lv, ~s|a[href="#{~p"/users/register"}"]|, "Зарегистрироваться")
assert has_element?(lv, ~s|a[href="#{~p"/users/log_in"}"]|, "Войти")
end
test "redirects if already logged in", %{conn: conn} do

View file

@ -10,7 +10,7 @@ defmodule ComfycampWeb.UserLoginLiveTest do
assert html =~ "Войти"
assert html =~ "Зарегистрироваться"
assert html =~ "Forgot your password?"
assert html =~ "Забыли пароль?"
end
test "redirects if already logged in", %{conn: conn} do
@ -63,11 +63,11 @@ defmodule ComfycampWeb.UserLoginLiveTest do
{:ok, _login_live, login_html} =
lv
|> element(~s|main a:fl-contains("Sign up")|)
|> element(~s|main a:fl-contains("Создайте")|)
|> render_click()
|> follow_redirect(conn, ~p"/users/register")
assert login_html =~ "Register"
assert login_html =~ "Зарегистрироваться"
end
test "redirects to forgot password page when the Forgot Password button is clicked", %{
@ -77,11 +77,11 @@ defmodule ComfycampWeb.UserLoginLiveTest do
{:ok, conn} =
lv
|> element(~s|main a:fl-contains("Forgot your password?")|)
|> element(~s|main a:fl-contains("Забыли пароль?")|)
|> render_click()
|> follow_redirect(conn, ~p"/users/reset_password")
assert conn.resp_body =~ "Forgot your password?"
assert conn.resp_body =~ "Забыли пароль?"
end
end
end

View file

@ -8,8 +8,8 @@ defmodule ComfycampWeb.UserRegistrationLiveTest do
test "renders registration page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/register")
assert html =~ "Register"
assert html =~ "Log in"
assert html =~ "Зарегистрироваться"
assert html =~ "Войти"
end
test "redirects if already logged in", %{conn: conn} do
@ -30,7 +30,7 @@ defmodule ComfycampWeb.UserRegistrationLiveTest do
|> element("#registration_form")
|> render_change(user: %{"email" => "with spaces", "password" => "too short"})
assert result =~ "Register"
assert result =~ "Зарегистрироваться"
assert result =~ "must have the @ sign and no spaces"
assert result =~ "should be at least 12 character"
end
@ -76,11 +76,11 @@ defmodule ComfycampWeb.UserRegistrationLiveTest do
{:ok, _login_live, login_html} =
lv
|> element(~s|main a:fl-contains("Log in")|)
|> element(~s|main a:fl-contains("Войти")|)
|> render_click()
|> follow_redirect(conn, ~p"/users/log_in")
assert login_html =~ "Log in"
assert login_html =~ "Войти"
end
end
end

View file

@ -21,7 +21,7 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
test "renders reset password with valid token", %{conn: conn, token: token} do
{:ok, _lv, html} = live(conn, ~p"/users/reset_password/#{token}")
assert html =~ "Reset Password"
assert html =~ "Сбросить пароль"
end
test "does not render reset password with invalid token", %{conn: conn} do
@ -81,7 +81,7 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
)
|> render_submit()
assert result =~ "Reset Password"
assert result =~ "Сбросить пароль"
assert result =~ "should be at least 12 character(s)"
assert result =~ "does not match password"
end
@ -93,11 +93,11 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
{:ok, conn} =
lv
|> element(~s|main a:fl-contains("Log in")|)
|> element(~s|main a:fl-contains("Войти")|)
|> render_click()
|> follow_redirect(conn, ~p"/users/log_in")
assert conn.resp_body =~ "Log in"
assert conn.resp_body =~ "Войти"
end
test "redirects to registration page when the Register button is clicked", %{
@ -108,11 +108,11 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
{:ok, conn} =
lv
|> element(~s|main a:fl-contains("Register")|)
|> element(~s|main a:fl-contains("Зарегистрироваться")|)
|> render_click()
|> follow_redirect(conn, ~p"/users/register")
assert conn.resp_body =~ "Register"
assert conn.resp_body =~ "Зарегистрироваться"
end
end
end

View file

@ -12,8 +12,8 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
|> log_in_user(user_fixture())
|> live(~p"/users/settings")
assert html =~ "Change Email"
assert html =~ "Change Password"
assert html =~ "Изменить email"
assert html =~ "Изменить пароль"
end
test "redirects if user is not logged in", %{conn: conn} do
@ -61,7 +61,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
"user" => %{"email" => "with spaces"}
})
assert result =~ "Change Email"
assert result =~ "Изменить email"
assert result =~ "must have the @ sign and no spaces"
end
@ -76,7 +76,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
})
|> render_submit()
assert result =~ "Change Email"
assert result =~ "Изменить email"
assert result =~ "did not change"
assert result =~ "is not valid"
end
@ -132,7 +132,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
}
})
assert result =~ "Change Password"
assert result =~ "Изменить пароль"
assert result =~ "should be at least 12 character(s)"
assert result =~ "does not match password"
end
@ -151,7 +151,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
})
|> render_submit()
assert result =~ "Change Password"
assert result =~ "Изменить пароль"
assert result =~ "should be at least 12 character(s)"
assert result =~ "does not match password"
assert result =~ "is not valid"