Skip to content

Commit

Permalink
fixed title for page show Chapter, Exercise, Solution v.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolalexx committed Apr 3, 2024
1 parent 903af7d commit 8c14593
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/Helpers/TemplateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/chapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'chapter' => 'Chapter',
'chapter' => 'Chapter :chapter',
'index' => [
'description' => 'Contents of the book Structure and Interpretation of Computer Programs',
],
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/exercise.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'exercise' => 'Exercise',
'exercise' => 'Exercise :exercise',
'index' => [
'description' => 'List of exercises in the book Structure and Interpretation of Computer Programs',
],
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/solution.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
'exercise' => 'Exercise',
'code_review' => 'Code Review',
'sub_title' => 'Compare your solutions',
'solution_for_title' => 'Solution for Exercise :exercise',
];
2 changes: 1 addition & 1 deletion resources/lang/ru/chapter.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'chapter' => 'Глава',
'chapter' => 'Глава :chapter',
'index' => [
'description' => 'Оглавление книги Структура и интерпретация компьютерных программ',
],
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/ru/exercise.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'exercise' => 'Упражнение',
'exercise' => 'Упражнение :exercise',
'index' => [
'description' => 'Cписок упражнений книги Структура и интерпретация компьютерных программ',
],
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/ru/solution.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
'exercise' => 'Упражнение',
'code_review' => 'Код Ревью',
'sub_title' => 'Сравни свои решения',
'solution_for_title' => 'Решение для упражнения',
'solution_for_title' => 'Решение для упражнения :exercise',
];
2 changes: 1 addition & 1 deletion resources/views/chapter/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion resources/views/exercise/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/solution/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8c14593

Please sign in to comment.