From f82aa2d4279891283c090263b1dccbe066a03f75 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Wed, 13 Mar 2024 00:26:34 +0500 Subject: [PATCH] use spatie/html for register form --- resources/lang/en/layout.php | 8 --- resources/lang/en/login.php | 11 ++++ resources/lang/en/register.php | 14 ++--- resources/lang/ru/layout.php | 8 --- resources/lang/ru/login.php | 11 ++++ resources/lang/ru/register.php | 14 ++--- resources/views/auth/login.blade.php | 17 +++--- resources/views/auth/register.blade.php | 56 +++++++++++++------ .../views/components/social_login.blade.php | 4 -- 9 files changed, 81 insertions(+), 62 deletions(-) create mode 100644 resources/lang/en/login.php create mode 100644 resources/lang/ru/login.php delete mode 100644 resources/views/components/social_login.blade.php diff --git a/resources/lang/en/layout.php b/resources/lang/en/layout.php index 81852742c..4898b557b 100644 --- a/resources/lang/en/layout.php +++ b/resources/lang/en/layout.php @@ -23,14 +23,6 @@ 'sicp_book' => 'The book', 'logo_alt' => 'Hexlet SICP', ], - 'login' => [ - 'form_header' => 'Login', - 'remember_me' => 'Remember Me', - 'password' => 'Password', - 'button' => 'Login', - 'email' => 'E-mail', - 'reset_password' => 'Forgot Your Password?', - ], 'welcome' => [ 'start_learning' => 'Start learning', ], diff --git a/resources/lang/en/login.php b/resources/lang/en/login.php new file mode 100644 index 000000000..9ce10b8df --- /dev/null +++ b/resources/lang/en/login.php @@ -0,0 +1,11 @@ + 'Login', + 'remember_me' => 'Remember Me', + 'password' => 'Password', + 'submit' => 'Login', + 'email' => 'E-mail', + 'reset_password' => 'Forgot Your Password?', + 'register' => 'Sign up' +]; diff --git a/resources/lang/en/register.php b/resources/lang/en/register.php index 9d395ec55..74b474476 100644 --- a/resources/lang/en/register.php +++ b/resources/lang/en/register.php @@ -2,12 +2,10 @@ return [ 'title' => 'Registration', - 'emailPlaceholder' => 'Email', - 'namePlaceholder' => 'Name', - 'passwordPlaceholder' => 'Password', - 'passwordConfirmationPlaceholder' => 'Confirm password', - 'registerButton' => 'Sign up', - 'accountExists' => 'Already have an account?', - 'logIn' => 'Log in', - 'or' => 'or', + 'email' => 'Email', + 'name' => 'Name', + 'password' => 'Password', + 'password_confirmation' => 'Confirm password', + 'submit' => 'Sign up', + 'login' => 'Log in', ]; diff --git a/resources/lang/ru/layout.php b/resources/lang/ru/layout.php index a8ba5b72d..e8a45fa7f 100644 --- a/resources/lang/ru/layout.php +++ b/resources/lang/ru/layout.php @@ -23,14 +23,6 @@ 'sicp_book' => 'Книга', 'logo_alt' => 'Хекслет СИКП', ], - 'login' => [ - 'form_header' => 'Войти', - 'remember_me' => 'Запомнить меня', - 'email' => 'Электронная почта', - 'password' => 'Пароль', - 'reset_password' => 'Забыли пароль?', - 'button' => 'Войти', - ], 'welcome' => [ 'start_learning' => 'Начать учиться', ], diff --git a/resources/lang/ru/login.php b/resources/lang/ru/login.php new file mode 100644 index 000000000..c4def16ec --- /dev/null +++ b/resources/lang/ru/login.php @@ -0,0 +1,11 @@ + 'Войти', + 'remember_me' => 'Запомнить меня', + 'email' => 'Электронная почта', + 'password' => 'Пароль', + 'reset_password' => 'Забыли пароль?', + 'submit' => 'Войти', + 'register' => 'Зарегистрироваться' +]; diff --git a/resources/lang/ru/register.php b/resources/lang/ru/register.php index 61fc25f61..f260e5641 100644 --- a/resources/lang/ru/register.php +++ b/resources/lang/ru/register.php @@ -2,12 +2,10 @@ return [ 'title' => 'Регистрация', - 'namePlaceholder' => 'Имя', - 'emailPlaceholder' => 'Электронная почта', - 'passwordPlaceholder' => 'Пароль', - 'passwordConfirmationPlaceholder' => 'Подтверждение пароля', - 'registerButton' => 'Зарегистрироваться', - 'accountExists' => 'Уже есть аккаунт?', - 'logIn' => 'Войти', - 'or' => 'или', + 'name' => 'Имя', + 'email' => 'Электронная почта', + 'password' => 'Пароль', + 'password_confirmation' => 'Подтверждение пароля', + 'submit' => 'Зарегистрироваться', + 'login' => 'Войти', ]; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index b685bbd00..3795d896e 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -4,19 +4,19 @@

- {{ __('layout.login.form_header') }} + {{ __('login.title') }}

{{ html()->form('POST', route('login'))->open() }}
- {{ html()->label(__('layout.login.email'))->for('email')->class('form-label') }} + {{ html()->label(__('login.email'))->for('email')->class('form-label') }} {{ html()->email('email')->class(['form-control', 'is-invalid' => $errors->has('email')]) }} @error('email') {{ $errors->first('email') }} @enderror
- {{ html()->label(__('layout.login.password'))->for('password')->class('form-label') }} + {{ html()->label(__('login.password'))->for('password')->class('form-label') }} {{ html()->password('password')->class(['form-control', 'is-invalid' => $errors->has('password')]) }} @error('password') {{ $errors->first('password') }} @@ -24,15 +24,14 @@
{{ html()->checkbox('remember')->class('form-check-input') }} - {{ html()->label(__('layout.login.remember_me'))->for('remember')->class('form-label') }} + {{ html()->label(__('login.remember_me'))->for('remember')->class('form-label') }}
- {{ html()->submit(__('layout.login.button'))->class('btn btn-primary btn-block') }} - {{ __('layout.login.reset_password') }} + {{ html()->submit(__('login.submit'))->class('btn btn-primary btn-block') }} + {{ __('login.register') }} + {{ __('login.reset_password') }} + {{ __('auth.with_github') }} {{ html()->form()->close() }}
-
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 26da63cd0..e349a1c79 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -8,24 +8,46 @@ {{ __('register.title') }}
- {{ BsForm::open(route('register')) }} - {{ BsForm::email('email')->label(__('register.emailPlaceholder')) }} - {{ BsForm::text('name')->label(__('register.namePlaceholder')) }} - {{ BsForm::password('password')->label(__('register.passwordPlaceholder')) }} - {{ BsForm::password('password_confirmation')->label(__('register.passwordConfirmationPlaceholder')) }} -
- {{ BsForm::submit(__('register.registerButton'))->attribute('class', 'btn btn-primary btn-block') }} - +
+ {{ html()->form('POST', route('register'))->open() }} + {{ html()->label(__('register.email'))->for('email')->class('form-label') }} + {{ html()->email('email')->class(['form-control', 'is-invalid' => $errors->has('email')]) }} + @error('email') + {{ $errors->first('email') }} + @enderror
- {{ BsForm::close() }} -
-
diff --git a/resources/views/components/social_login.blade.php b/resources/views/components/social_login.blade.php deleted file mode 100644 index 9a8fd5bbc..000000000 --- a/resources/views/components/social_login.blade.php +++ /dev/null @@ -1,4 +0,0 @@ - - {{ __('auth.with_github') }} - {{ __('auth.with_github') }} -