Compare commits

...

2 commits

Author SHA1 Message Date
Simon Vieille b716f4a2a7 add notebook 2021-04-09 08:50:33 +02:00
Simon Vieille b8eb2b52b7 remove image in comments 2021-04-08 21:18:56 +02:00
6 changed files with 54 additions and 1 deletions

View file

@ -112,6 +112,11 @@ class Post implements EntityInterface
*/
private $comments;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $notebook;
public function __construct()
{
$this->categories = new ArrayCollection();
@ -400,4 +405,16 @@ class Post implements EntityInterface
return $this;
}
public function getNotebook(): ?string
{
return $this->notebook;
}
public function setNotebook(?string $notebook): self
{
$this->notebook = $notebook;
return $this;
}
}

View file

@ -71,6 +71,7 @@ class CommentType extends AbstractType
'label' => 'Commentaire',
'required' => true,
'attr' => [
'rows' => 20,
],
'constraints' => [
new NotBlank(),

View file

@ -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)

View file

@ -26,7 +26,7 @@ class Comment extends MarkdownParser
'inline_link' => true, // [link text](url "optional title")
'reference_link' => false, // [link text] [id]
'shortcut_link' => false, // [link text]
'images' => true,
'images' => false,
'html_block' => false,
'block_quote' => true,
'code_block' => true,

View file

@ -48,6 +48,9 @@
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#form-post-quick">{{ 'Quick'|trans }}</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#form-post-notebook">{{ 'Carnet de notes'|trans }}</a>
</li>
</ul>
<div class="col-12 tab-content">
@ -75,6 +78,15 @@
{% endfor %}
</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>

View file

@ -99,6 +99,14 @@
{% else %}
{{ entity.content|markdown('post') }}
{% endif %}
{% if entity.notebook %}
<hr>
<div class="font-weight-bold pb-2">Carnet de notes</div>
{{ entity.notebook|markdown('post') }}
{% endif %}
</div>
<div class="col-3 p-3">
<ul class="list-group">