Skip to content

Commit

Permalink
add components for bs input
Browse files Browse the repository at this point in the history
  • Loading branch information
fey committed Mar 13, 2024
1 parent f819951 commit 128caf5
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Settings/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public function update(Request $request): RedirectResponse
flash()->error(__('layout.flash.error'));
}

return redirect()->route('settings.profile.index', $user);
return redirect()->route('settings.profile.index');
}
}
1 change: 1 addition & 0 deletions resources/lang/en/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@
'guest' => 'Guest',
'network_error' => 'Network error',
],
'submit' => 'Submit',
];
9 changes: 9 additions & 0 deletions resources/lang/en/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
'profile' => [
'name' => 'Name',
'github_name' => 'GitHub nickname',
'hexlet_nickname' => 'Hexlet nickname'
],
];
1 change: 1 addition & 0 deletions resources/lang/ru/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@
'guest' => 'Гость',
'network_error' => 'Ошибка сети',
],
'submit' => 'Отправить',
];
13 changes: 13 additions & 0 deletions resources/lang/ru/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'profile' => [
'name' => 'Имя',
'github_name' => 'Ник в GitHub',
'hexlet_nickname' => 'Ник в Hexlet',
],
'account' => [
'password' => 'Пароль',
'reset_password' => 'Сбросить пароль'
],
];
1 change: 1 addition & 0 deletions resources/views/components/bs/form/submit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ html()->submit(__($text ?? 'layout.submit'))->class('btn btn-primary btn-block') }}
7 changes: 7 additions & 0 deletions resources/views/components/bs/form/text.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div class="mb-3">
{{ html()->label(__($label))->for($name)->class('form-label') }}
{{ html()->text($name)->class(['form-control', 'is-invalid' => $errors->has($name)]) }}
@error($name)
<span class="invalid-feedback">{{ $message }}</span>
@enderror
</div>
4 changes: 2 additions & 2 deletions resources/views/settings/account/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
</div>
<div class="card mb-2">
<div class="card-body">
<h3 class="card-title">{{ __('layout.login.password') }}</h3>
<h3 class="card-title">{{ __('settings.account.password') }}</h3>
<p class="card-text">
<a class="" href="{{ route('password.request') }}">
{{ __('layout.login.reset_password') }}
{{ __('settings.account.reset_password') }}
</a>
</p>
</div>
Expand Down
14 changes: 6 additions & 8 deletions resources/views/settings/profile/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
<div class="card mb-2">
<div class="card-body">
<h1 class="card-title h3">{{ __('account.profile') }} {{ $user->email }}</h1>
{{ BsForm::patch(route('settings.profile.update', [$user])) }}
{{ BsForm::text('name', $user->name)->label(__('register.namePlaceholder')) }}
{{ BsForm::text('github_name', $user->github_name)->label(__('account.github_name')) }}
{{ BsForm::text('hexlet_nickname', $user->hexlet_nickname)->label(__('account.hexlet_nickname')) }}
<div class="form-group mt-2">
{{ BsForm::submit(__('layout.common.save'))->primary() }}
</div>
{{ BsForm::close() }}
{{ html()->modelForm($user, 'PATCH', route('settings.profile.update', [$user]))->open() }}
<x-bs.form.text name="name" label="settings.profile.name" />
<x-bs.form.text name="github_name" label="settings.profile.github_name" />
<x-bs.form.text name="hexlet_nickname" label="settings.profile.hexlet_nickname" />
<x-bs.form.submit />
{{ html()->form()->close() }}
</div>
</div>
</div>
Expand Down

0 comments on commit 128caf5

Please sign in to comment.