mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-29 13:36:13 +00:00
Add CommentEmbeddable to Activity (Ref #21)
This commit is contained in:
parent
f4a76f659e
commit
c1c3839c62
@ -20,6 +20,7 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Entity;
|
||||
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
@ -110,15 +111,20 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
*/
|
||||
private $person;
|
||||
|
||||
/**
|
||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
|
||||
*/
|
||||
private $comment;
|
||||
|
||||
/**
|
||||
* Activity constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->reasons = new ArrayCollection();
|
||||
$this->comment = new CommentEmbeddable();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
@ -354,5 +360,21 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
return $this->person->getCenter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable
|
||||
*/
|
||||
public function getComment()
|
||||
{
|
||||
return $this->comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Chill\MainBundle\Entity\Embeddalbe\CommentEmbeddable $comment
|
||||
*/
|
||||
public function setComment($comment)
|
||||
{
|
||||
$this->comment = $comment;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Chill\ActivityBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
@ -120,6 +121,9 @@ class ActivityType extends AbstractType
|
||||
'placeholder' => 'Choose a type',
|
||||
'active_only' => true
|
||||
))
|
||||
->add('comment', CommentType::class, [
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
|
||||
$builder->get('durationTime')
|
||||
|
@ -35,7 +35,7 @@
|
||||
{{ form_row(edit_form.remark) }}
|
||||
{{ form_row(edit_form.attendee) }}
|
||||
{{ form_row(edit_form.reasons) }}
|
||||
|
||||
{{ form_row(form.comment) }}
|
||||
|
||||
{{ form_widget(edit_form) }}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
|
@ -36,6 +36,7 @@
|
||||
{{ form_row(form.remark) }}
|
||||
{{ form_row(form.attendee) }}
|
||||
{{ form_row(form.reasons) }}
|
||||
{{ form_row(form.comment) }}
|
||||
|
||||
<div class="grid-12 centered sticky-form-buttons">
|
||||
<button class="sc-button green margin-10" type="submit"><i class="fa fa-save"></i> {{ 'Add a new activity'|trans }}</button>
|
||||
|
@ -38,6 +38,13 @@
|
||||
<dd>{% for r in entity.reasons %}{{ r|chill_entity_render_box }} {% endfor %}</dd>
|
||||
{%- endif -%}
|
||||
|
||||
<dt class="inline">{{ 'Comment'|trans }}</dt>
|
||||
{%- if entity.comment is empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
||||
{%- endif -%}
|
||||
|
||||
</dl>
|
||||
|
||||
<ul class="record_actions">
|
||||
|
Loading…
x
Reference in New Issue
Block a user