add posst card image
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/deployment/woodpecker Pipeline failed

This commit is contained in:
Simon Vieille 2023-01-06 13:14:42 +01:00
parent 6b459d4f46
commit d3a38a1b03
Signed by: deblan
GPG key ID: 579388D585F70417
6 changed files with 49 additions and 2 deletions

View file

@ -51,3 +51,7 @@
background-size: cover;
}
}
.choices__list--dropdown {
z-index: 3;
}

View file

@ -84,6 +84,9 @@ class Post implements EntityInterface
#[ORM\OneToMany(targetEntity: PostFollow::class, mappedBy: 'post', orphanRemoval: true)]
private $postFollows;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $image2;
public function __construct()
{
$this->categories = new ArrayCollection();
@ -423,4 +426,16 @@ class Post implements EntityInterface
return $this;
}
public function getImage2(): ?string
{
return $this->image2;
}
public function setImage2(?string $image2): self
{
$this->image2 = $image2;
return $this;
}
}

View file

@ -23,6 +23,7 @@ use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Constraints\Url;
use App\Form\Type\SimpleMdTextareaType;
use App\Core\Form\Type\EditorJsTextareaType;
use App\Core\Form\FileManager\FilePickerType;
class PostType extends AbstractType
{
@ -160,6 +161,20 @@ class PostType extends AbstractType
]
);
$builder->add(
'image2',
FilePickerType::class,
[
'label' => 'Image (carte)',
'required' => false,
'data_class' => null,
'attr' => [
],
'constraints' => [
],
]
);
$builder->add(
'tags',
CollectionType::class,

View file

@ -38,7 +38,7 @@
</span>
</div>
{% for item in ['image', 'status', 'contentFormat', 'publishedAt'] %}
{% for item in ['image', 'image2', 'status', 'contentFormat', 'publishedAt'] %}
<div class="col-md-12">
{{ form_row(form[item]) }}
</div>

View file

@ -99,6 +99,17 @@
-
{% endif %}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-3 d-block">Image (carte)</span>
{% if entity.image2 %}
<figure>
<img src="{{ asset(entity.image2) }}" class="img-fluid">
</figure>
{% else %}
-
{% endif %}
</li>
<li class="list-group-item">
<span class="font-weight-bold pb-2 d-block">Statut</span>

View file

@ -2,7 +2,9 @@
{% set color = generate_color_by_string(post.title) %}
{%- set image -%}
{%- if post.image -%}
{%- if post.image2 -%}
{{ asset(post.image2)|imagine_filter('post_preview_filter') }}
{%- elseif post.image -%}
{{ asset(post.image)|imagine_filter('post_preview_filter') }}
{%- elseif post.quickImage -%}
{{ post.quickImage }}