mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add CommentEmbeddable to Activity : remoke remark field (Ref #21)
This commit is contained in:
parent
cde3c900df
commit
f35cb679b7
@ -405,7 +405,7 @@ class ActivityController extends AbstractController
|
|||||||
'by_user' => $this->getUser()->getUsername(),
|
'by_user' => $this->getUser()->getUsername(),
|
||||||
'activity_id' => $activity->getId(),
|
'activity_id' => $activity->getId(),
|
||||||
'person_id' => $activity->getPerson()->getId(),
|
'person_id' => $activity->getPerson()->getId(),
|
||||||
'remark' => $activity->getRemark(),
|
'comment' => $activity->getComment()->getComment(),
|
||||||
'scope_id' => $activity->getScope()->getId(),
|
'scope_id' => $activity->getScope()->getId(),
|
||||||
'reasons_ids' => $activity->getReasons()
|
'reasons_ids' => $activity->getReasons()
|
||||||
->map(function ($ar) { return $ar->getId(); })
|
->map(function ($ar) { return $ar->getId(); })
|
||||||
|
@ -117,7 +117,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
|||||||
->setType($this->getRandomActivityType())
|
->setType($this->getRandomActivityType())
|
||||||
->setScope($this->getRandomScope())
|
->setScope($this->getRandomScope())
|
||||||
->setAttendee($this->faker->boolean())
|
->setAttendee($this->faker->boolean())
|
||||||
->setRemark('A remark');
|
;
|
||||||
|
|
||||||
$usedId = array();
|
$usedId = array();
|
||||||
for ($i = 0; $i < rand(0, 4); $i++) {
|
for ($i = 0; $i < rand(0, 4); $i++) {
|
||||||
|
@ -75,12 +75,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
*/
|
*/
|
||||||
private $durationTime;
|
private $durationTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
* @ORM\Column(type="text")
|
|
||||||
*/
|
|
||||||
private $remark;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
@ -204,29 +198,6 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
return $this->durationTime;
|
return $this->durationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set remark
|
|
||||||
*
|
|
||||||
* @param string $remark
|
|
||||||
* @return Activity
|
|
||||||
*/
|
|
||||||
public function setRemark($remark)
|
|
||||||
{
|
|
||||||
$this->remark = $remark;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get remark
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getRemark()
|
|
||||||
{
|
|
||||||
return $this->remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set attendee
|
* Set attendee
|
||||||
*
|
*
|
||||||
|
@ -93,10 +93,6 @@ class ActivityType extends AbstractType
|
|||||||
'required' => true
|
'required' => true
|
||||||
))
|
))
|
||||||
->add('durationTime', ChoiceType::class, $durationTimeOptions)
|
->add('durationTime', ChoiceType::class, $durationTimeOptions)
|
||||||
->add('remark', TextareaType::class, array(
|
|
||||||
'required' => false,
|
|
||||||
'empty_data' => ''
|
|
||||||
))
|
|
||||||
->add('attendee', ChoiceType::class, array(
|
->add('attendee', ChoiceType::class, array(
|
||||||
'expanded' => true,
|
'expanded' => true,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
@ -32,10 +32,9 @@
|
|||||||
{{ form_row(edit_form.date) }}
|
{{ form_row(edit_form.date) }}
|
||||||
{{ form_row(edit_form.durationTime) }}
|
{{ form_row(edit_form.durationTime) }}
|
||||||
{{ form_row(edit_form.type) }}
|
{{ form_row(edit_form.type) }}
|
||||||
{{ form_row(edit_form.remark) }}
|
|
||||||
{{ form_row(edit_form.attendee) }}
|
{{ form_row(edit_form.attendee) }}
|
||||||
{{ form_row(edit_form.reasons) }}
|
{{ form_row(edit_form.reasons) }}
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(edit_form.comment) }}
|
||||||
|
|
||||||
{{ form_widget(edit_form) }}
|
{{ form_widget(edit_form) }}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
<td>{% if activity.date %}{{ activity.date|format_date('long') }}{% endif %}</td>
|
<td>{% if activity.date %}{{ activity.date|format_date('long') }}{% endif %}</td>
|
||||||
<td>{{ activity.durationTime|date('H:i') }}</td>
|
<td>{{ activity.durationTime|date('H:i') }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if activity.remark is not empty %}
|
{% if activity.comment.comment is not empty %}
|
||||||
<blockquote class="chill-user-quote">
|
<blockquote class="chill-user-quote">
|
||||||
{{ activity.remark|slice(0, 250) }} {#
|
{{ activity.comment.comment|slice(0, 250) }} {#
|
||||||
sf4 check: if 'slice' could replace 'truncate' filter ?
|
sf4 check: if 'slice' could replace 'truncate' filter ?
|
||||||
truncate come with twig-extensions, in conflict with twig 3
|
truncate come with twig-extensions, in conflict with twig 3
|
||||||
#}
|
#}
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
{{ form_row(form.date) }}
|
{{ form_row(form.date) }}
|
||||||
{{ form_row(form.durationTime) }}
|
{{ form_row(form.durationTime) }}
|
||||||
{{ form_row(form.type) }}
|
{{ form_row(form.type) }}
|
||||||
{{ form_row(form.remark) }}
|
|
||||||
{{ form_row(form.attendee) }}
|
{{ form_row(form.attendee) }}
|
||||||
{{ form_row(form.reasons) }}
|
{{ form_row(form.reasons) }}
|
||||||
{{ form_row(form.comment) }}
|
{{ form_row(form.comment) }}
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
||||||
<dt class="inline">{{ 'Type'|trans }}</dt>
|
<dt class="inline">{{ 'Type'|trans }}</dt>
|
||||||
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
||||||
<dt class="inline">{{ 'Remark'|trans }}</dt>
|
|
||||||
<dd>{% if entity.remark is empty %}<span class="chill-no-data-statement">{{ 'No remarks'|trans }}</span>{% else %}<blockquote class="chill-user-quote">{{ entity.remark|nl2br }}</blockquote>{% endif %}</dd>
|
|
||||||
|
|
||||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||||
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
|
|
||||||
{% if is_granted(constant('Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter::SEE_DETAILS'), activity) %}
|
{% if is_granted(constant('Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter::SEE_DETAILS'), activity) %}
|
||||||
<dl class="chill_view_data">
|
<dl class="chill_view_data">
|
||||||
<dt class="inline">{{ 'Remark'|trans }}</dt>
|
<dd>{% if activity.comment.comment is empty %}{{ 'No comments'|trans }}{% else %}<blockquote class="chill-user-quote">{{ activity.comment.comment|nl2br }}</blockquote>{% endif %}</dd>
|
||||||
<dd>{% if activity.remark is empty %}{{ 'No remarks'|trans }}{% else %}<blockquote class="chill-user-quote">{{ activity.remark|nl2br }}</blockquote>{% endif %}</dd>
|
|
||||||
|
|
||||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||||
{%- if activity.reasons is empty -%}
|
{%- if activity.reasons is empty -%}
|
||||||
|
@ -115,7 +115,7 @@ class ActivityControllerTest extends WebTestCase
|
|||||||
'chill_activitybundle_activity'=> array(
|
'chill_activitybundle_activity'=> array(
|
||||||
'date' => '15-01-2015',
|
'date' => '15-01-2015',
|
||||||
'durationTime' => 600,
|
'durationTime' => 600,
|
||||||
'remark' => 'blabla',
|
// 'remark' => 'blabla',
|
||||||
'scope' => $this->getRandomScope('center a_social', 'Center A')->getId(),
|
'scope' => $this->getRandomScope('center a_social', 'Center A')->getId(),
|
||||||
'type' => $this->getRandomActivityType()->getId()
|
'type' => $this->getRandomActivityType()->getId()
|
||||||
)
|
)
|
||||||
@ -137,7 +137,7 @@ class ActivityControllerTest extends WebTestCase
|
|||||||
$form = $crawler->selectButton("Sauver l'activité")->form(array(
|
$form = $crawler->selectButton("Sauver l'activité")->form(array(
|
||||||
'chill_activitybundle_activity' => array(
|
'chill_activitybundle_activity' => array(
|
||||||
'date' => '25-01-2015',
|
'date' => '25-01-2015',
|
||||||
'remark' => 'Foo'
|
// 'remark' => 'Foo'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class ActivityTypeTest extends KernelTestCase
|
|||||||
$form->submit(array( 'activity' => array(
|
$form->submit(array( 'activity' => array(
|
||||||
'date' => '9-3-2015',
|
'date' => '9-3-2015',
|
||||||
'durationTime' => 300,
|
'durationTime' => 300,
|
||||||
'remark' => 'blabla',
|
// 'remark' => 'blabla',
|
||||||
'attendee' => true
|
'attendee' => true
|
||||||
)));
|
)));
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ class ActivityTypeTest extends KernelTestCase
|
|||||||
$this->assertEquals('00:05', $activity->getDurationTime()->format('H:i'),
|
$this->assertEquals('00:05', $activity->getDurationTime()->format('H:i'),
|
||||||
"Test the formatted hour is correct");
|
"Test the formatted hour is correct");
|
||||||
$this->assertEquals(true, $activity->getAttendee());
|
$this->assertEquals(true, $activity->getAttendee());
|
||||||
$this->assertEquals('blabla', $activity->getRemark());
|
// $this->assertEquals('blabla', $activity->getRemark());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class ActivityTypeTest extends KernelTestCase
|
|||||||
$form->submit(array( 'activity' => array(
|
$form->submit(array( 'activity' => array(
|
||||||
'date' => '9-3-2015',
|
'date' => '9-3-2015',
|
||||||
'durationTime' => 60,
|
'durationTime' => 60,
|
||||||
'remark' => 'blabla',
|
// 'remark' => 'blabla',
|
||||||
'attendee' => true
|
'attendee' => true
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
36
migrations/Version20210304154629.php
Normal file
36
migrations/Version20210304154629.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210304154629 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE activity ADD comment_comment TEXT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activity ADD comment_userId INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE activity ADD comment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE activity DROP comment_comment');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP comment_userId');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP comment_date');
|
||||||
|
}
|
||||||
|
}
|
32
migrations/Version20210311114250.php
Normal file
32
migrations/Version20210311114250.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Activity;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20210311114250 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('UPDATE activity SET comment_comment = remark');
|
||||||
|
$this->addSql('ALTER TABLE activity DROP remark');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -11,8 +11,8 @@ attendee: présence de la personne
|
|||||||
list_reasons: liste des sujets
|
list_reasons: liste des sujets
|
||||||
user_username: nom de l'utilisateur
|
user_username: nom de l'utilisateur
|
||||||
circle_name: nom du cercle
|
circle_name: nom du cercle
|
||||||
Remark: Notes
|
Remark: Commentaire
|
||||||
No remarks: Aucune note
|
No comments: Aucun commentaire
|
||||||
Add a new activity: Ajouter une nouvelle activité
|
Add a new activity: Ajouter une nouvelle activité
|
||||||
Activity list: Liste des activités
|
Activity list: Liste des activités
|
||||||
present: présent
|
present: présent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user