mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
record single task states transition and add them in timeline
This commit is contained in:
7
Resources/config/services/event.yml
Normal file
7
Resources/config/services/event.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
services:
|
||||
Chill\TaskBundle\Event\Lifecycle\TaskLifecycleEvent:
|
||||
arguments:
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
|
||||
tags:
|
||||
- { name: kernel.event_subscriber }
|
8
Resources/config/services/timeline.yml
Normal file
8
Resources/config/services/timeline.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
services:
|
||||
Chill\TaskBundle\Timeline\TaskLifeCycleEventTimelineProvider:
|
||||
arguments:
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
$registry: '@Symfony\Component\Workflow\Registry'
|
||||
tags:
|
||||
- { name: 'chill.timeline', context: 'person' }
|
||||
|
34
Resources/migrations/Version20180502194119.php
Normal file
34
Resources/migrations/Version20180502194119.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Create task place events table.
|
||||
*/
|
||||
class Version20180502194119 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('CREATE SEQUENCE chill_task.single_task_place_event_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||
$this->addSql('CREATE TABLE chill_task.single_task_place_event (id INT NOT NULL, author_id INT DEFAULT NULL, task_id INT DEFAULT NULL, datetime TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, transition VARCHAR(255) NOT NULL, data JSONB NOT NULL, PRIMARY KEY(id))');
|
||||
$this->addSql('CREATE INDEX IDX_D459EBEEF675F31B ON chill_task.single_task_place_event (author_id)');
|
||||
$this->addSql('CREATE INDEX IDX_D459EBEE8DB60186 ON chill_task.single_task_place_event (task_id)');
|
||||
$this->addSql('COMMENT ON COLUMN chill_task.single_task_place_event.datetime IS \'(DC2Type:datetime_immutable)\'');
|
||||
$this->addSql('ALTER TABLE chill_task.single_task_place_event ADD CONSTRAINT FK_D459EBEEF675F31B FOREIGN KEY (author_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE chill_task.single_task_place_event ADD CONSTRAINT FK_D459EBEE8DB60186 FOREIGN KEY (task_id) REFERENCES chill_task.single_task (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('DROP SEQUENCE chill_task.single_task_place_event_id_seq CASCADE');
|
||||
$this->addSql('DROP TABLE chill_task.single_task_place_event');
|
||||
|
||||
}
|
||||
}
|
@@ -59,6 +59,10 @@ Year: Année(s)
|
||||
start: démarrer
|
||||
close: clotûrer
|
||||
cancel: annuler
|
||||
'%user% has closed the task': %user% a fermé la tâche
|
||||
'%user% has canceled the task': %user% a annulé la tâche
|
||||
'%user% has started the task': %user% a débuté la tâche
|
||||
'%user% has created the task': %user% a introduit la tâche
|
||||
|
||||
#Flash messages
|
||||
'The task is created': 'La tâche a été créée'
|
||||
|
@@ -57,7 +57,7 @@
|
||||
<a href="" class="sc-button bt-task-exchange"> </a>
|
||||
<div class="bt-dropdown-content">
|
||||
{% for transition in workflow_transitions(task) %}
|
||||
<a href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name|trans, 'kind': 'single-task', 'return_path': app.request.uri }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}</a>
|
||||
<a href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -0,0 +1,33 @@
|
||||
<div>
|
||||
<h3 class="single-line">
|
||||
{{ event.datetime|localizeddate('long', 'none') }}
|
||||
<span class="task"> / {{ 'Task'|trans }}</span> /
|
||||
{% if transition is not null %}
|
||||
<span class="statement">{{ task_workflow_metadata(event.task, 'transition.sentence', transition)|trans({ '%user%': event.author.username }) }}</span>
|
||||
{% else %}
|
||||
<span class="statement">{{ '%user% has created the task'|trans({ '%user%': event.author.username }) }}</span>
|
||||
{% endif %}
|
||||
</h3>
|
||||
|
||||
<div class="statement">
|
||||
<dl class="chill_view_data">
|
||||
<dt class="inline">{{ 'title'|trans }}</dt>
|
||||
<dd>{{ event.task.title }}</dd>
|
||||
|
||||
{% if event.task.description is not empty %}
|
||||
<dt class="inline">{{ 'Description'|trans }}</dt>
|
||||
<dd>
|
||||
<blockquote class="chill-user-quote">
|
||||
{{ event.task.description }}
|
||||
</blockquote>
|
||||
</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if event.task.endDate is not empty %}
|
||||
<dt class="inline">{{ 'Task end date'|trans }}</dt>
|
||||
<dd>{{ event.task.endDate|localizeddate('medium', 'none') }}</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user