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; 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;
}
} }

View file

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

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) public function configureOptions(OptionsResolver $resolver)

View file

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

View file

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

View file

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