diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index f0fa07181e9..eef3e26c769 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -20,10 +20,10 @@ use Illuminate\Http\RedirectResponse; use App\Notifications\InvitationMail; use App\Http\Requests\SettingsRequest; +use App\Services\Contact\Tag\UpdateTag; use LaravelWebauthn\Models\WebauthnKey; use App\Http\Requests\InvitationRequest; use App\Services\Contact\Tag\DestroyTag; -use Illuminate\Support\Facades\Validator; use App\Services\Account\Settings\ResetAccount; use App\Services\Account\Settings\DestroyAccount; use PragmaRX\Google2FALaravel\Facade as Google2FA; @@ -370,7 +370,7 @@ public function deleteTag($tagId) } /** - * Method editTag + * Edit a tag name. * * @param Tag $tag * @param Request $request @@ -379,22 +379,13 @@ public function deleteTag($tagId) */ public function editTag(Tag $tag, Request $request): RedirectResponse { - $validator = Validator::make($request->all(), [ - 'tag_name' => 'required|string|max:255', + app(UpdateTag::class)->execute([ + 'tag_id' => $tag->id, + 'account_id' => auth()->user()->account_id, + 'name' => $request->input('name'), ]); - if ($validator->fails()) { - return redirect()->route('settings.tags.index') - ->with('error', $validator->errors()); - } - - $newName = $request->input('tag_name'); - - $tag->name = $newName; - $tag->save(); - - - return redirect()->route('settings.tags.index') + return back() ->with('success', trans('settings.tags_list_edit_success')); } diff --git a/resources/sass/settings.scss b/resources/sass/settings.scss index 09f743ef8ee..5320cbfb8f1 100644 --- a/resources/sass/settings.scss +++ b/resources/sass/settings.scss @@ -99,6 +99,20 @@ } } + .tags-list { + h3.with-actions { + padding-bottom: 13px; + } + + .table-cell.actions { + @if $htmldir == ltr { + text-align: right; + } @else { + text-align: left; + } + } + } + .blank-screen { text-align: center; diff --git a/resources/views/settings/export.blade.php b/resources/views/settings/export.blade.php index 353bbb74223..14aa39c1e0f 100644 --- a/resources/views/settings/export.blade.php +++ b/resources/views/settings/export.blade.php @@ -87,16 +87,16 @@ @foreach ($exports as $export)