Skip to content

Commit

Permalink
Merge pull request #26 from lara-zeus/imporvments
Browse files Browse the repository at this point in the history
improvements
  • Loading branch information
atmonshi authored Jul 10, 2022
2 parents 42d655a + 14344a2 commit 4ed988d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"filament/spatie-laravel-media-library-plugin": "^2.0",
"filament/spatie-laravel-tags-plugin": "^2.0",
"filament/spatie-laravel-translatable-plugin": "^2.0",
"lara-zeus/core": "dev-main",
"lara-zeus/core": "^2.1",
"mohamedsabil83/filament-forms-tinyeditor": "^1.5",
"spatie/laravel-medialibrary": "^10.0.0",
"spatie/laravel-sluggable": "^3.3",
Expand Down
21 changes: 9 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion resources/lang/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@
"frequently asked questions": "الأسئلة الشائعة",
"FAQs": "الأسئلة الشائعة",
"Question": "السؤال",
"Answer": "الإجابة"
"Answer": "الإجابة",
"Clear": "مسح",
"Showing Search result of": "عرض نتائج البحث عن"
}
4 changes: 3 additions & 1 deletion resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@
"frequently asked questions": "frequently asked questions",
"FAQs": "FAQs",
"Question": "Question",
"Answer": "Answer"
"Answer": "Answer",
"Clear": "Clear",
"Showing Search result of": "Showing Search result of"
}
16 changes: 8 additions & 8 deletions resources/views/themes/zeus/home.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<div>
{{-- You can override the used class in config/zeus-sky.php 'search_result_highlight_css_class'' --}}
<style type="text/css">
span.highlight { background-color: yellow; }
</style>
@unless($stickies->isEmpty())
<div class="mt-10 grid @if($stickies->count() > 1) grid-cols-3 @endif gap-4">
@foreach($stickies as $post)
Expand All @@ -16,10 +12,14 @@
<div class="container flex justify-between mx-auto gap-6">
<div class="w-3/4">
@unless ($posts->isEmpty())
<div class="flex items-center justify-between">
<h1 class="text-xl font-bold text-gray-700 md:text-2xl">Posts</h1>
</div>
@each($theme.'.partial.post', $posts, 'post')
<div class="flex items-center justify-between">
<h1 class="text-xl font-bold text-gray-700 md:text-2xl">{{ __('Posts') }}</h1>
</div>
@if(request()->filled('search'))
{{ __('Showing Search result of') }}: <span class="highlight">{{ request('search') }}</span>
<a title="{{ __('clear') }}" href="{{ route('blogs') }}"><x-heroicon-o-backspace class="text-secondary-500 w-4 h-4 inline-flex align-middle"/></a>
@endif
@each($theme.'.partial.post', $posts, 'post')
@else
@include($theme.'.partial.empty')
@endunless
Expand Down
10 changes: 6 additions & 4 deletions resources/views/themes/zeus/partial/post.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
</div>
<div class="mt-2">
<a href="{{ route('post',$post->slug) }}" class="text-2xl md:text-3xl font-bold text-gray-700 hover:underline">
{{ $post->title ?? '' }}
{!! $post->title !!}
</a>
<p class="mt-2 text-gray-600">
{{ $post->description ?? '' }}
</p>
@if($post->description !== null)
<p class="mt-2 text-gray-600">
{!! $post->description !!}
</p>
@endif
</div>
<div class="flex items-center justify-between mt-4">
<a href="{{ route('post',$post->slug) }}" class="text-blue-500 hover:underline">Read more</a>
Expand Down
8 changes: 4 additions & 4 deletions resources/views/themes/zeus/partial/sidebar/search.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div class="px-8">
<h1 class="mb-4 text-xl font-bold text-gray-700">Search</h1>
<div class="flex flex-col max-w-sm px-6 py-4 mx-auto bg-white rounded-lg shadow-md">
<div class="my-4">
<h1 class="mb-4 text-xl font-bold text-gray-700">{{ __('Search') }}</h1>
<div class="flex flex-col max-w-sm px-2 py-4 mx-auto bg-white rounded-lg shadow-md bord">
<form method="GET">
<input type="text" name="search" value="{{ request()->get('search') }}">
<input class="w-full px-3 py-1.5 rounded" type="text" name="search" value="{{ request()->get('search') }}">
</form>
</div>
</div>
4 changes: 3 additions & 1 deletion src/Http/Livewire/Posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Posts extends Component
{
public function render()
{
$search = strtolower(request()->get('search'));
$search = strtolower(request('search'));

$posts = Post::NotSticky();
$posts = $this->applySearch($posts, $search);
Expand Down Expand Up @@ -69,7 +69,9 @@ private function highlightSearchResults(Collection $posts, ?string $search = nul
}

foreach ($posts as $i => $post) {
$posts[$i]->title = static::hl($post->title, [$search]);
$posts[$i]->content = static::hl($post->content, [$search]);
$posts[$i]->description = static::hl($post->description, [$search]);
}

return $posts;
Expand Down

0 comments on commit 4ed988d

Please sign in to comment.