From 8c1459307ddb8d2e808753b664a3dcfd4071fa8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=9A=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=D1=81=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= Date: Wed, 3 Apr 2024 06:05:51 +0300 Subject: [PATCH] fixed title for page show Chapter, Exercise, Solution v.4 --- app/Helpers/TemplateHelper.php | 4 ++-- app/Helpers/helpers.php | 4 ++-- resources/lang/en/chapter.php | 2 +- resources/lang/en/exercise.php | 2 +- resources/lang/en/solution.php | 1 + resources/lang/ru/chapter.php | 2 +- resources/lang/ru/exercise.php | 2 +- resources/lang/ru/solution.php | 2 +- resources/views/chapter/show.blade.php | 2 +- resources/views/exercise/show.blade.php | 2 +- resources/views/solution/show.blade.php | 2 +- 11 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/Helpers/TemplateHelper.php b/app/Helpers/TemplateHelper.php index b2e19d765..101d3e03d 100644 --- a/app/Helpers/TemplateHelper.php +++ b/app/Helpers/TemplateHelper.php @@ -4,10 +4,10 @@ class TemplateHelper { - public static function getTitleContent(string $header, string $title): string + public static function getTitleContent(string $header): string { $nameProject = __('layout.title.name_SICP'); - return "{$title} {$header} - {$nameProject}"; + return "{$header} - {$nameProject}"; } public static function getBookLink(string $locale): string diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index b6e660c96..610d1b515 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -9,9 +9,9 @@ use Illuminate\Support\Collection; if (!function_exists('getTitleContent')) { - function getTitleContent(string $header, string $title = ''): string + function getTitleContent(string $header): string { - return TemplateHelper::getTitleContent($header, $title); + return TemplateHelper::getTitleContent($header); } } diff --git a/resources/lang/en/chapter.php b/resources/lang/en/chapter.php index 2215be1ca..9ca8d3dc1 100644 --- a/resources/lang/en/chapter.php +++ b/resources/lang/en/chapter.php @@ -1,7 +1,7 @@ 'Chapter', + 'chapter' => 'Chapter :chapter', 'index' => [ 'description' => 'Contents of the book Structure and Interpretation of Computer Programs', ], diff --git a/resources/lang/en/exercise.php b/resources/lang/en/exercise.php index a768a5b34..d73b88de9 100644 --- a/resources/lang/en/exercise.php +++ b/resources/lang/en/exercise.php @@ -1,7 +1,7 @@ 'Exercise', + 'exercise' => 'Exercise :exercise', 'index' => [ 'description' => 'List of exercises in the book Structure and Interpretation of Computer Programs', ], diff --git a/resources/lang/en/solution.php b/resources/lang/en/solution.php index f1a511fcb..7e2aacbed 100644 --- a/resources/lang/en/solution.php +++ b/resources/lang/en/solution.php @@ -10,4 +10,5 @@ 'exercise' => 'Exercise', 'code_review' => 'Code Review', 'sub_title' => 'Compare your solutions', + 'solution_for_title' => 'Solution for Exercise :exercise', ]; diff --git a/resources/lang/ru/chapter.php b/resources/lang/ru/chapter.php index 6ca09b6ca..861b81bc3 100644 --- a/resources/lang/ru/chapter.php +++ b/resources/lang/ru/chapter.php @@ -1,7 +1,7 @@ 'Глава', + 'chapter' => 'Глава :chapter', 'index' => [ 'description' => 'Оглавление книги Структура и интерпретация компьютерных программ', ], diff --git a/resources/lang/ru/exercise.php b/resources/lang/ru/exercise.php index 70ab60a76..8e74190aa 100644 --- a/resources/lang/ru/exercise.php +++ b/resources/lang/ru/exercise.php @@ -1,7 +1,7 @@ 'Упражнение', + 'exercise' => 'Упражнение :exercise', 'index' => [ 'description' => 'Cписок упражнений книги Структура и интерпретация компьютерных программ', ], diff --git a/resources/lang/ru/solution.php b/resources/lang/ru/solution.php index e5a4bec51..738a1a75b 100644 --- a/resources/lang/ru/solution.php +++ b/resources/lang/ru/solution.php @@ -10,5 +10,5 @@ 'exercise' => 'Упражнение', 'code_review' => 'Код Ревью', 'sub_title' => 'Сравни свои решения', - 'solution_for_title' => 'Решение для упражнения', + 'solution_for_title' => 'Решение для упражнения :exercise', ]; diff --git a/resources/views/chapter/show.blade.php b/resources/views/chapter/show.blade.php index f31a14201..8bfd7112f 100644 --- a/resources/views/chapter/show.blade.php +++ b/resources/views/chapter/show.blade.php @@ -10,7 +10,7 @@ */ @endphp @section('title') - {{ getTitleContent($chapter->getFullTitle(), __('chapter.chapter')) }} + {{ getTitleContent(__('chapter.chapter', ['chapter' => $chapter->getFullTitle()])) }} @endsection @section('description') @foreach (Breadcrumbs::generate('chapter', $chapter) as $breadcrumb) diff --git a/resources/views/exercise/show.blade.php b/resources/views/exercise/show.blade.php index 8f9043841..a34fa30ba 100644 --- a/resources/views/exercise/show.blade.php +++ b/resources/views/exercise/show.blade.php @@ -7,7 +7,7 @@ */ @endphp @section('title') - {{ getTitleContent($exercise->getFullTitle(), __('exercise.exercise')) }} + {{ getTitleContent(__('exercise.exercise', ['exercise' => $exercise->getFullTitle()])) }} @endsection @section('description') {{ __('exercise.exercise') }} {{ $exercise->path }} {{ $exercise->getTitle() }} {{ __('exercise.show.description') }} diff --git a/resources/views/solution/show.blade.php b/resources/views/solution/show.blade.php index 553b0b2a7..825278434 100644 --- a/resources/views/solution/show.blade.php +++ b/resources/views/solution/show.blade.php @@ -2,7 +2,7 @@ @section('meta-robots', 'nofollow, noindex') @section('title') - {{ getTitleContent($currentExercise->getFullTitle(), __('solution.solution_for_title')) }} + {{ getTitleContent(__('solution.solution_for_title', ['exercise' => $currentExercise->getFullTitle()])) }} @endsection @section('description'){{ $user->id }} - {{ __('solution.code_review') }} - {{ $user->name }} - {{ __('solution.exercise') }} {{ $currentExercise->getFullTitle() }}@endsection