Commit 9852430b authored by Julien Fastré's avatar Julien Fastré

add task type in list

parent bae3904b
......@@ -57,6 +57,7 @@ Filter: Filtrer
Any user: Tous les utilisateurs
Unassigned: Non assigné
Associated person: Personne associée
Default task: Tâche par défaut
# transitions
......
......@@ -6,7 +6,7 @@
<thead>
<tr>
<th class="chill-red">{{ 'Title'|trans }}</th>
{# <th class="chill-green">{{ 'Task type'|trans }}</th> #}
<th class="chill-green">{{ 'Task type'|trans }}</th>
{% if person is null %}
<th>{{ 'Person'|trans }}</th>
{% endif %}
......@@ -18,7 +18,7 @@
{% for task in tasks %}
<tr>
<td>{{ task.title }}</td>
{# <td>{{ task.type }}</td> #}
<td>{{ task_workflow_metadata(task, 'definition.name') }}</td>
{% if person is null %}
<td><a href="{{ path('chill_person_view', {person_id : task.person.Id}) }}">{{ task.person}}</a></td>
{% endif %}
......
......@@ -45,6 +45,10 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
'sentence' => '%user% has started the task'
]
];
const DEFINITION_METADATA = [
'name' => 'Default task'
];
public function supports(AbstractTask $task)
{
......@@ -71,20 +75,21 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
}
return $this->getTransitionMetadata(\implode('.', \array_slice($keys, 1)), $metadataSubject);
case 'definition':
return self::DEFINITION_METADATA[$keys[1]] ?? $key;
default:
throw new \LogicException("this key '$key' is not implemented");
return $key;
}
}
protected function getTransitionMetadata($key, Transition $transition)
{
if (!\array_key_exists($transition->getName(), self::TRANSITION_METADATA)) {
throw new \LogicException("the metadata for this transition are not defined");
return $key;
}
if (!\array_key_exists($key, self::TRANSITION_METADATA[$transition->getName()])) {
throw new \LogicException("The metadata ".$key." is not "
. "defined for the transition ".$transition.getName());
return $key;
}
return self::TRANSITION_METADATA[$transition->getName()][$key];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment