added no link post theme part

pull/49/head
A1Gard 5 months ago
parent 73fc73dd6b
commit a05298b15c

@ -74,7 +74,7 @@ class Post extends Model implements HasMedia
public function orgUrl()
{
if ($this->getMedia()->count() > 0) {
return $this->getMedia()[$this->image_index]->getUrl();
return $this->getMedia()->first()->getUrl();
} else {
return asset('assets/upload/logo.svg');

@ -0,0 +1,21 @@
<section class='NoLinkImage @if(getSetting($data->area->name.'_'.$data->part.'_dark')) dark-mode @endif'>
<div class="{{gfx()['container']}}">
<div class="row">
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',5) as $post )
<div class="col-lg-3 col-md-6">
<div class=" no-link-item mb-4">
<img src="{{$post->orgUrl()}}" class="float-start me-2" alt=" {{$post->title}}">
<h3>
{{$post->title}}
</h3>
<p>
{{$post->subtitle}}
</p>
</div>
</div>
@endforeach
</div>
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "NoLinkImage",
"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,42 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Group;
use App\Models\Part;
use App\Models\Setting;
class NoLinkImage
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_group';
$setting->value = Group::first()->id;
$setting->size = 6;
$setting->type = 'GROUP';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' group';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_dark';
$setting->value = Group::first()->id;
$setting->size = 6;
$setting->type = 'CHECKBOX';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' dark mode';
$setting->save();
}
public static function onRemove(Part $part = null)
{
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,30 @@
.NoLinkImage {
padding: 1rem 0;
// scss
.no-link-item{
transition: .4s;
background: #ffffff;
padding: 5px;
border-radius: var(--xshop-border-radius);
h3{
font-size: 20px;
margin-top: .4rem;
}
p{
color: gray;
}
img{
height: 64px;
}
&:hover{
filter: grayscale(1);
}
}
&.dark-mode{
.no-link-item{
background: #21252b;
color: whitesmoke;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Loading…
Cancel
Save