update projects tpl

This commit is contained in:
Simon Vieille 2022-09-06 14:19:29 +02:00
parent 630359fc1b
commit e41075c184
Signed by: deblan
GPG key ID: 579388D585F70417
4 changed files with 72 additions and 21 deletions

View file

@ -11,6 +11,10 @@ liip_imagine:
filters:
downscale:
max: [600, 600]
project_preview_filter:
filters:
downscale:
max: [600, 600]
site_avatar:
filters:
downscale:

View file

@ -50,6 +50,11 @@ class Project implements EntityInterface
*/
private $links = [];
/**
* @ORM\Column(type="string", length=255)
*/
private $image;
public function getId(): ?int
{
return $this->id;
@ -114,4 +119,16 @@ class Project implements EntityInterface
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
}

View file

@ -2,15 +2,16 @@
namespace App\Form;
use App\Core\Form\FileManager\FilePickerType;
use App\Core\Form\Type\CollectionType;
use App\Entity\Project;
use App\Form\Type\SimpleMdTextareaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
use App\Form\Type\SimpleMdTextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use App\Core\Form\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
class ProjectType extends AbstractType
{
@ -59,6 +60,20 @@ class ProjectType extends AbstractType
]
);
$builder->add(
'image',
FilePickerType::class,
[
'label' => 'Image',
'required' => false,
'data_class' => null,
'attr' => [
],
'constraints' => [
],
]
);
$builder->add(
'links',
CollectionType::class,

View file

@ -9,26 +9,41 @@
<div class="body">
<div class="body-content">
{{- _page.content.value|murph_url|markdown('post') -}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 meshes">
<div class="row">
{% for project in projects %}
<hr>
<div class="col-4 mesh-wrapper">
<div class="mesh">
{% if project.image %}
<div class="mesh-preview">
<img src="{{ asset(project.image)|imagine_filter('project_preview_filter') }}" alt="{{ project.label }}">
</div>
{% endif %}
<h2 class="mesh-title">{{- project.label -}}</h2>
<div class="mesh-description">
{{- project.description|murph_url|markdown('post') -}}
<h2>{{- project.label -}}</h2>
{{- project.description|murph_url|markdown('post') -}}
{% if project.links %}
<ul class="list--inline">
{% for link in project.links %}
<li>
<a class="button small" href="{{ link.url|murph_url }}" target="_blank">
{{- link.label -}}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if project.links %}
<div class="mesh-file">
<ul class="list--inline">
{% for link in project.links %}
<li>
<a class="button small" href="{{ link.url|murph_url }}" target="_blank">
{{- link.label -}}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>