add notebook
This commit is contained in:
parent
b8eb2b52b7
commit
b716f4a2a7
|
@ -112,6 +112,11 @@ class Post implements EntityInterface
|
||||||
*/
|
*/
|
||||||
private $comments;
|
private $comments;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="text", nullable=true)
|
||||||
|
*/
|
||||||
|
private $notebook;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->categories = new ArrayCollection();
|
$this->categories = new ArrayCollection();
|
||||||
|
@ -400,4 +405,16 @@ class Post implements EntityInterface
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNotebook(): ?string
|
||||||
|
{
|
||||||
|
return $this->notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNotebook(?string $notebook): self
|
||||||
|
{
|
||||||
|
$this->notebook = $notebook;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ class CommentType extends AbstractType
|
||||||
'label' => 'Commentaire',
|
'label' => 'Commentaire',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'attr' => [
|
'attr' => [
|
||||||
|
'rows' => 20,
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
|
|
@ -250,6 +250,21 @@ class PostType extends AbstractType
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$builder->add(
|
||||||
|
'notebook',
|
||||||
|
TextareaType::class,
|
||||||
|
[
|
||||||
|
'label' => 'Carnet de notes',
|
||||||
|
'required' => false,
|
||||||
|
'attr' => [
|
||||||
|
'data-simplemde' => '',
|
||||||
|
'rows' => 20,
|
||||||
|
],
|
||||||
|
'constraints' => [
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#form-post-quick">{{ 'Quick'|trans }}</a>
|
<a class="nav-link" data-toggle="tab" href="#form-post-quick">{{ 'Quick'|trans }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-toggle="tab" href="#form-post-notebook">{{ 'Carnet de notes'|trans }}</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="col-12 tab-content">
|
<div class="col-12 tab-content">
|
||||||
|
@ -75,6 +78,15 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane p-3" id="form-post-notebook">
|
||||||
|
<div class="row">
|
||||||
|
{% for item in ['notebook'] %}
|
||||||
|
<div class="col-12">
|
||||||
|
{{ form_row(form[item]) }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -99,6 +99,14 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ entity.content|markdown('post') }}
|
{{ entity.content|markdown('post') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if entity.notebook %}
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="font-weight-bold pb-2">Carnet de notes</div>
|
||||||
|
|
||||||
|
{{ entity.notebook|markdown('post') }}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3 p-3">
|
<div class="col-3 p-3">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
|
|
Loading…
Reference in a new issue