add quick show video

This commit is contained in:
Simon Vieille 2022-02-22 11:06:02 +01:00
parent 136803d5aa
commit 35a9a8aad1
5 changed files with 38 additions and 2 deletions

View file

@ -65,7 +65,7 @@
"symfony/browser-kit": "^5.2",
"symfony/css-selector": "^5.2",
"symfony/debug-bundle": "^5.2",
"symfony/maker-bundle": "^1.0",
"symfony/maker-bundle": "^1.37",
"symfony/phpunit-bridge": "^5.2",
"symfony/stopwatch": "^5.2",
"symfony/var-dumper": "^5.2",

View file

@ -108,6 +108,11 @@ class Post implements EntityInterface
*/
private $quickVideoHeight;
/**
* @ORM\Column(type="boolean", options={"default"=0})
*/
private $quickShowVideo = false;
/**
* @ORM\OneToMany(targetEntity=Comment::class, mappedBy="post", orphanRemoval=true)
*/
@ -446,4 +451,16 @@ class Post implements EntityInterface
return $this;
}
public function getQuickShowVideo(): ?bool
{
return $this->quickShowVideo;
}
public function setQuickShowVideo(bool $quickShowVideo): self
{
$this->quickShowVideo = $quickShowVideo;
return $this;
}
}

View file

@ -223,6 +223,19 @@ class PostType extends AbstractType
]
);
$builder->add(
'quickShowVideo',
CheckboxType::class,
[
'label' => 'Afficher la vidéo',
'required' => false,
'attr' => [
],
'constraints' => [
],
]
);
$builder->add(
'quickVideoWidth',
NumberType::class,

View file

@ -76,6 +76,12 @@
{{ form_row(form[item]) }}
</div>
{% endfor %}
{% for item in ['quickShowVideo'] %}
<div class="col-md-12">
{{ form_row(form[item]) }}
</div>
{% endfor %}
</div>
</div>
<div class="tab-pane p-3" id="form-post-notebook">

View file

@ -16,7 +16,7 @@
{% set title = post.title %}
{% set content = post.content|murph_url %}
{% if false and post.quickVideo and post.quickVideoHeight and post.quickVideoWidth %}
{% if post.quickVideo and post.quickShowVideo and post.quickVideoHeight and post.quickVideoWidth %}
<div class="quick-video">
<div class="video-ratio" data-ratio="{{ post.quickVideoHeight * 100 / post.quickVideoWidth }}%">
<iframe src="{{ post.quickVideo }}" allowfullscreen></iframe>