added post sidebar theme part

pull/49/head
A1Gard 5 months ago
parent 37ed92edfb
commit 3989d68775

@ -72,4 +72,8 @@ class ClientController extends Controller
return redirect()->back()->with(['message' => __('Your comment has been submitted')]);
}
public function search(Request $request){
}
}

@ -0,0 +1,58 @@
<section class='PostSidebar content'>
<div class="{{gfx()['container']}}">
<dov class="row">
@if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-md-3 p-0">
@include('segments.post.PostSidebar.inc.sidebar')
</div>
@endif
<div class="col-md-9 p-0">
<div class="py-2 px-4">
<h1>
{{$post->title}}
<span class="float-end text-muted">
Time spend: {{$post->spendTime()}}
</span>
</h1>
<img src="{{$post->orgUrl()}}" alt="" class="img-fluid">
<p class="text-muted my-3">
{{$post->subtitle}}
</p>
<div class="row text-center">
<div class="col-md">
<i class="ri-calendar-line"></i>
{{$post->created_at->ldate('Y/m/d H:i')}}
</div>
<div class="col-md">
<i class="ri-message-line"></i>
{{number_format($post->approvedComments()->count())}}
</div>
<div class="col-md">
<i class="ri-eye-line"></i>
{{number_format($post->view)}}
</div>
@if($post->tags()->count() > 0)
<div class="col-md-6">
{{__("Tags")}}:
@foreach($post->tags as $tag)
<a href="{{route('client.tag',$tag->slug)}}" class="tag me-2">
<i class="ri-price-tag-line"></i>
{{$tag->name}}
</a>
@endforeach
</div>
@endif
</div>
<hr>
{!! $post->body !!}
</div>
</div>
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-md-3 p-0">
@include('segments.post.PostSidebar.inc.sidebar')
</div>
@endif
</dov>
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "PostSidebar",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -0,0 +1,30 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
class PostSidebar
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_invert';
$setting->value = 0;
$setting->size = 12;
$setting->type = 'CHECKBOX';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' invert sidebar position';
$setting->save();
}
public static function onRemove(Part $part = null)
{
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,68 @@
.PostSidebar {
h1 {
font-size: 27px;
padding: 1rem;
color: var(--xshop-primary);
span {
font-size: 16px;
margin-top: 5px;
display: inline-block;
}
}
img {
max-height: 40vh;
width: 100%;
object-fit: cover;
}
.tag {
background: var(--xshop-primary);
padding: 3px .7rem;
color: var(--xshop-diff);
border-radius: var(--xshop-border-radius);
}
aside{
h4{
padding: .5rem;
position: relative;
text-align: center;
font-weight: 300;
font-size: 20px;
&:after{
position: absolute;
content: ' ';
height: 1px;
width: 70%;
bottom: 0;
left: 15%;
right: 15%;
background: linear-gradient(90deg,#ffffff00 0%, var(--xshop-primary) 50%, #ffffff00 100%);
}
}
}
.recent{
padding: 0;
list-style: none;
margin-top: 1rem;
li{
min-height: 60px;
margin-bottom: 1rem;
}
img{
width: 48px;
height: 48px;
object-fit: cover;
}
p{
height: 1.2em;
overflow: hidden;
}
}
}

@ -0,0 +1,44 @@
<aside class="p-4">
<h4>
{{__("Search")}}
</h4>
<form action="">
<div class="input-group mb-3">
<input type="search" class="form-control" placeholder="{{__('Search')}}...">
<button class="btn btn-outline-secondary" type="submit" id="button-addon2">
<i class="ri-search-2-line"></i>
</button>
</div>
</form>
<h4>
{{__("Recent posts")}}
</h4>
<ul class="recent">
@foreach(\App\Models\Post::where('status',1)->orderByDesc('id')->limit(5)->get() as $pst)
<li>
<a href="{{$pst->webUrl()}}">
<img src="{{$pst->imgUrl()}}" alt="{{$pst->title}}" class="float-start me-2">
<h6>
{{$pst->title}}
</h6>
<p class="text-muted">
{{$pst->subtitle}}
</p>
</a>
</li>
@endforeach
</ul>
<h4>
{{__("Groups")}}
</h4>
<ul class="list-group">
@foreach(\App\Models\Group::whereNull('parent_id')->get() as $grp)
<li class="list-group-item">
<a href="{{$grp->webUrl()}}">
{{$grp->name}}
</a>
</li>
@endforeach
</ul>
</aside>

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

@ -359,6 +359,7 @@ Route::name('client.')->group(function (){
Route::get('/', [\App\Http\Controllers\ClientController::class,'welcome'])->name('welcome');
Route::get('/{post}', [\App\Http\Controllers\ClientController::class,'post'])->name('post');
Route::get('/tag/{post}', [\App\Http\Controllers\ClientController::class,'tag'])->name('tag');
Route::get('/search', [\App\Http\Controllers\ClientController::class,'search'])->name('search');
Route::post('/comment/submit', [\App\Http\Controllers\ClientController::class,'submitComment'])->name('comment.submit');

Loading…
Cancel
Save