mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
front-end dev of tasks lists
This commit is contained in:
parent
3719ce0896
commit
2d57757682
@ -171,9 +171,9 @@ class SingleTaskController extends Controller
|
||||
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', "Success : task updated!");
|
||||
$this->addFlash('success', "The task has been updated");
|
||||
|
||||
return $this->redirectToRoute('chill_task_task_list_by_person', [
|
||||
return $this->redirectToRoute('chill_task_singletask_list', [
|
||||
'person_id' => $task->getPerson()->getId()
|
||||
]);
|
||||
|
||||
@ -283,9 +283,9 @@ class SingleTaskController extends Controller
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return Response
|
||||
* @Route(
|
||||
* "/{_locale}/task/single-task/list/my",
|
||||
|
@ -8,6 +8,7 @@ Scope: Cercle
|
||||
'End date': "Date d'échéance"
|
||||
'Warning date': "Date d'avertissement"
|
||||
'Warning interval': "Délai d'avertissement de la date d'échéance"
|
||||
'Unknown dates': 'Dates non spécifiées'
|
||||
'N': ''
|
||||
'Unit': ''
|
||||
Task: Tâche
|
||||
@ -15,6 +16,7 @@ Details: Détails
|
||||
Person: Personne
|
||||
Scope: Cercle
|
||||
Date: Date
|
||||
Dates: Dates
|
||||
User: Utilisateur
|
||||
'Task list': 'Liste de tâches'
|
||||
'Tasks with expired deadline': "Tâches avec une date d'échéance dépassée"
|
||||
@ -24,6 +26,9 @@ User: Utilisateur
|
||||
'Task start date': 'Date de début'
|
||||
'Task warning date': "Date d'avertissement"
|
||||
'Task end date': "Date d'échéance"
|
||||
'Start: ': 'Début: '
|
||||
'Warning: ': 'Avertissement: '
|
||||
'End: ': 'Échéance: '
|
||||
'Task type': 'Type'
|
||||
'Task status': 'Statut'
|
||||
'Edit the task': 'Éditer la tâche'
|
||||
@ -33,14 +38,20 @@ User: Utilisateur
|
||||
'Update the task': 'Mettre à jour la tâche'
|
||||
'Remove task': 'Supprimer la tâche'
|
||||
'Are you sure you want to remove the task about "%name%" ?': 'Êtes-vous sûr·e de vouloir supprimer la tâche de "%name%"?'
|
||||
|
||||
'See more': 'Voir plus'
|
||||
Associated tasks: Tâches associées
|
||||
My tasks: Mes tâches
|
||||
|
||||
# transitions
|
||||
'new': 'nouvelle'
|
||||
'in_progress': 'en cours'
|
||||
'closed': 'fermée'
|
||||
'canceled': 'supprimée'
|
||||
|
||||
#Flash messages
|
||||
'The task is created': 'La tâche a été créée'
|
||||
'The task has been successfully removed.': 'La tâche a bien été supprimée'
|
||||
'This form contains errors': 'Ce formulaire contient des erreurs'
|
||||
'Success : task updated!': 'Succès: la tâche a été mise à jour'
|
||||
'The task has been updated': 'La tâche a été mise à jour'
|
||||
'The transition is sucessfully applyed': 'La transition a bien été effectuée'
|
||||
'The transition could not be applyed': "La transition n'a pas pu être appliquée"
|
||||
|
@ -7,10 +7,11 @@
|
||||
<tr>
|
||||
<th class="chill-red">{{ 'Title'|trans }}</th>
|
||||
<th class="chill-green">{{ 'Task type'|trans }}</th>
|
||||
{% if person is null %}
|
||||
<th>{{ 'Person'|trans }}</th>
|
||||
{% endif %}
|
||||
<th class="chill-orange">{{ 'Task status'|trans }}</th>
|
||||
<th>{{ 'Task start date'|trans }}</th>
|
||||
<th>{{ 'Task warning date'|trans }}</th>
|
||||
<th>{{ 'Task end date'|trans }}</th>
|
||||
<th>{{ 'Dates'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -18,18 +19,41 @@
|
||||
<tr>
|
||||
<td>{{ task.title }}</td>
|
||||
<td>{{ task.type }}</td>
|
||||
{% if person is null %}
|
||||
<td>{{ task.person }}</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% for place in workflow_marked_places(task) %}
|
||||
<span class="">{{ place }}</span>
|
||||
<span class="">{{ place|trans }}</span>
|
||||
{% endfor %}
|
||||
|
||||
{% for transition in workflow_transitions(task) %}
|
||||
<a href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'return_path': app.request.uri }) }}" style="background-color: {{ task_workflow_metadata(task, 'transition.background-color', transition)|e('html_attr') }}; color: {{ task_workflow_metadata(task, 'transition.text-color', transition)|e('html_attr') }}">{{ task_workflow_metadata(task, 'transition.verb', transition) }}</a>
|
||||
<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) }}</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>{% if task.startDate is not null %}{{ task.startDate|localizeddate('medium', 'none') }}{% endif %}</td>
|
||||
<td>{% if task.warningDate is not null %}{{ task.warningDate|localizeddate('medium', 'none') }}{% endif %}</td>
|
||||
<td>{% if task.endDate is not null %}{{ task.endDate|localizeddate('medium', 'none') }}{% endif %}</td>
|
||||
<td>
|
||||
{% if task.startDate is null and task.warningDate is null and task.endDate is null %}
|
||||
{{'Unknown dates'|trans}}
|
||||
{% else %}
|
||||
<ul class="record_actions_column">
|
||||
<li>
|
||||
{% if task.startDate is not null %}
|
||||
{{'Start: '|trans}}{{ task.startDate|localizeddate('medium', 'none') }}
|
||||
{% endif %}
|
||||
</li>
|
||||
<li>
|
||||
{% if task.warningDate is not null %}
|
||||
{{'Warning: '|trans}}{{ task.warningDate|localizeddate('medium', 'none') }}
|
||||
{% endif %}
|
||||
</li>
|
||||
<li>
|
||||
{% if task.endDate is not null %}
|
||||
{{'End: '|trans}}{{ task.endDate|localizeddate('medium', 'none') }}
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
@ -54,7 +78,7 @@
|
||||
|
||||
|
||||
{% if isSingleStatus %}
|
||||
{% if tasks|length > paginator.getTotalItems %}
|
||||
{% if tasks|length < paginator.getTotalItems %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
|
||||
@ -89,12 +113,12 @@
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id, 'status' : [ status ] }) }}" class="sc-button bt-cancel">
|
||||
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id, 'status' : [ status ] }) }}" class="sc-button">
|
||||
{{ 'See more' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user is not null %}
|
||||
<a href="{{ path('chill_task_singletask_list', {'status' : [ status ] }) }}" class="sc-button bt-cancel">
|
||||
<a href="{{ path('chill_task_singletask_list', {'status' : [ status ] }) }}" class="sc-button">
|
||||
{{ 'See more' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@ -38,6 +38,8 @@
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% block content %}
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
<div class="grid-8 push-1 grid-mobile-9 grid-tablet-9 push-mobile-0 push-tablet-0">
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
@ -22,7 +22,7 @@ use Chill\TaskBundle\Entity\SingleTask;
|
||||
use Symfony\Component\Workflow\Transition;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
@ -31,66 +31,63 @@ class DefaultTaskDefinition implements \Chill\TaskBundle\Workflow\TaskWorkflowDe
|
||||
const TRANSITION_METADATA = [
|
||||
'close' => [
|
||||
'verb' => 'close',
|
||||
'background-color' => 'var(--yellow)', // css variable, see https://developer.mozilla.org/fr/docs/Web/CSS/Les_variables_CSS
|
||||
'text-color' => 'black'
|
||||
'class' => 'sc-button task-close'
|
||||
],
|
||||
'cancel' => [
|
||||
'verb' => 'cancel',
|
||||
'background-color' => 'var(--red)', // css variable, see https://developer.mozilla.org/fr/docs/Web/CSS/Les_variables_CSS
|
||||
'text-color' => 'black'
|
||||
'class' => 'sc-button bt-delete task-cancel'
|
||||
],
|
||||
'start' => [
|
||||
'verb' => 'start',
|
||||
'background-color' => 'var(--green)', // css variable, see https://developer.mozilla.org/fr/docs/Web/CSS/Les_variables_CSS
|
||||
'text-color' => 'black'
|
||||
'class' => 'sc-button bt-update task-start'
|
||||
]
|
||||
];
|
||||
|
||||
public function supports(AbstractTask $task)
|
||||
|
||||
public function supports(AbstractTask $task)
|
||||
{
|
||||
|
||||
|
||||
return $task instanceof SingleTask
|
||||
&& $task->getType() === 'task_default';
|
||||
}
|
||||
|
||||
|
||||
public static function getAssociatedWorkflowName()
|
||||
{
|
||||
return 'task_default';
|
||||
}
|
||||
|
||||
|
||||
public function getWorkflowMetadata(
|
||||
string $key,
|
||||
string $key,
|
||||
$metadataSubject = null
|
||||
) {
|
||||
$keys = \explode('.', $key);
|
||||
|
||||
|
||||
switch($keys[0]) {
|
||||
case 'transition':
|
||||
if (!$metadataSubject instanceof Transition) {
|
||||
throw new \LogicException("You must give a transition as metadatasubject");
|
||||
}
|
||||
|
||||
|
||||
return $this->getTransitionMetadata(\implode('.', \array_slice($keys, 1)), $metadataSubject);
|
||||
default:
|
||||
throw new \LogicException("this key '$key' is not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
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 self::TRANSITION_METADATA[$transition->getName()][$key];
|
||||
}
|
||||
|
||||
public function isClosed(AbstractTask $task)
|
||||
|
||||
public function isClosed(AbstractTask $task)
|
||||
{
|
||||
return \array_key_exists('closed', $task->getCurrentStates())
|
||||
|| \array_key_exists('canceled', $task->getCurrentStates());
|
||||
|
Loading…
x
Reference in New Issue
Block a user