front-end/design single tasks

This commit is contained in:
nobohan 2018-04-30 14:53:57 +02:00
parent 5d8b764057
commit f5b09cf42e
6 changed files with 151 additions and 42 deletions

View File

@ -33,26 +33,29 @@ class SingleTaskController extends Controller
public function newAction(Request $request)
{
$personId = $request->query->getInt('person_id', null);
$task = (new SingleTask())
->setAssignee($this->getUser())
->setType('task_default')
;
if ($personId === null) {
return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST);
if ($request->query->has('person_id')) {
$personId = $request->query->getInt('person_id', null);
if ($personId === null) {
return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST);
}
$person = $this->getDoctrine()->getManager()
->getRepository(Person::class)
->find($personId);
if ($person === null) {
$this->createNotFoundException("Invalid person id");
}
$task->setPerson($person);
}
$person = $this->getDoctrine()->getManager()
->getRepository(Person::class)
->find($personId);
if ($person === null) {
$this->createNotFoundException("Invalid person id");
}
$task = (new SingleTask())
->setAssignee($this->getUser())
->setPerson($person)
->setType('task_default')
;
$this->denyAccessUnlessGranted(TaskVoter::CREATE, $task, 'You are not '
. 'allowed to create this task');
@ -69,7 +72,7 @@ class SingleTaskController extends Controller
$this->addFlash('success', "The task is created");
return $this->redirectToRoute('chill_task_task_list_by_person', [
return $this->redirectToRoute('chill_task_singletask_list', [
'person_id' => $task->getPerson()->getId()
]);

View File

@ -1,12 +1,72 @@
.bt-task-start::before {
content: url(../svg/play.svg);
div#single_task_warningInterval {
display: flex;
flex-direction: row;
justify-content: flex-end;
div.container {
display: flex;
flex-direction: row;
justify-content: flex-end;
& > div:first-child {
display:none; /* Hide the label container */
}
& > div {
padding-right: 0;
width: 7em;
}
input[type="text"] {
height: 35px;
}
}
}
.bt-task {
display: block;
height: 12px;
width: 12px;
font-size: 0.8em;
}
.bt-task-exchange {
@extend .bt-task;
&::before {
content: url(../svg/exchange-alt.svg);
}
}
.bt-task-start {
@extend .bt-task;
&::before {
content: url(../svg/play.svg);
}
}
.bt-task-cancel::before {
@extend .bt-task;
content: url(../svg/times.svg);
}
.bt-task-close::before {
content: url(../svg/stop.svg);
@extend .bt-task;
content: url(../svg/check.svg);
}
.bt-dropdown {
position: relative;
display: inline-block;
}
.bt-dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 1;
}
.bt-dropdown:hover .bt-dropdown-content {
display: block;
}

View File

@ -26,9 +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: '
'Start': 'Début: '
'Warning': 'Avertissement: '
'End': 'Échéance: '
'Task type': 'Type'
'Task status': 'Statut'
'Edit the task': 'Éditer la tâche'
@ -39,8 +39,17 @@ User: Utilisateur
'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
'Associated tasks': 'Tâches associées'
'My tasks': 'Mes tâches'
'No description': 'Pas de description'
'No dates specified': 'Dates non spécifiées'
'No one assignee': 'Aucune personne assignée'
Days: Jour(s)
Weeks: Semaine(s)
Months: Mois
Year: Année(s)
# transitions
'new': 'nouvelle'

View File

@ -1 +1,2 @@
The start date must be before the end date: La date de début doit être avant la date de fin
The start date must be before the end date: La date de début doit être avant la date de fin
This form contains errors: Le formulaire contient des erreurs

View File

@ -33,22 +33,22 @@
</td>
<td>
{% if task.startDate is null and task.warningDate is null and task.endDate is null %}
{{'Unknown dates'|trans}}
{{'No dates specified'|trans}}
{% else %}
<ul class="record_actions_column">
<li>
{% if task.startDate is not null %}
{{'Start: '|trans}}{{ task.startDate|localizeddate('medium', 'none') }}
{{'Start'|trans}}&nbsp;:{{ task.startDate|localizeddate('medium', 'none') }}
{% endif %}
</li>
<li>
{% if task.warningDate is not null %}
{{'Warning: '|trans}}{{ task.warningDate|localizeddate('medium', 'none') }}
{{'Warning'|trans}}&nbsp;:{{ task.warningDate|localizeddate('medium', 'none') }}
{% endif %}
</li>
<li>
{% if task.endDate is not null %}
{{'End: '|trans}}{{ task.endDate|localizeddate('medium', 'none') }}
{{'End'|trans}}&nbsp;:{{ task.endDate|localizeddate('medium', 'none') }}
{% endif %}
</li>
</ul>
@ -56,6 +56,16 @@
</td>
<td>
<ul class="record_actions">
<li>
<div class="bt-dropdown">
<a href="" class="sc-button bt-task-exchange">&nbsp;</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) }}</a>
{% endfor %}
</div>
</div>
</li>
<li>
<a href="{{ path('chill_task_single_task_show', { 'id': task.id }) }}" class="sc-button bt-show "></a>
</li>

View File

@ -25,32 +25,58 @@
{% block personcontent %}
<h1 class="chill-red">{{ 'Task'|trans }}</h1>
<h2>{{ task.title }}</h2>
<dl class="chill_view_data">
<dt class="inline">{{ 'Title'|trans }}</dt>
<dd>{{ task.title }}</dd>
<dt class="inline">{{ 'Description'|trans }}</dt>
<dd>{{ task.description }}</dd>
<dd>
{% if task.description is empty %}
<span class="chill-no-data-statement">{{"No description"|trans}}</span>
{% else %}
{{ task.description }}
{% endif %}
</dd>
<dt class="inline">{{ 'Assignee'|trans }}</dt>
<dd>{{ task.assignee }}</dd>
<dd>
{% if task.assignee is null %}
<span class="chill-no-data-statement">{{"No one assignee"|trans}}</span>
{% else %}
{{ task.assignee }}
{% endif %}
</dd>
<dt class="inline">{{ 'Scope'|trans }}</dt>
<dd><span class="scope">{{ task.scope.name|localize_translatable_string }}</span></dd>
<dt class="inline">{{ 'Start date'|trans }}</dt>
<dd>{{ task.startDate|localizeddate('long', 'none') }}</dd>
<h3>{{"Dates"|trans}}</h3>
{% if task.startDate is null and task.endDate is null and task.warningDate is null %}
<dt>
<dd><span class="chill-no-data-statement">{{"No dates specified"|trans}}</span></dd>
</dt>
{% else %}
{% if task.startDate is not null %}
<dt class="inline">{{ 'Start'|trans }}</dt>
<dd>{{ task.startDate|localizeddate('long', 'none') }}</dd>
{% endif %}
<dt class="inline">{{ 'End date'|trans }}</dt>
<dd>{{ task.endDate|localizeddate('long', 'none') }}</dd>
{% if task.endDate is not null %}
<dt class="inline">{{ 'End'|trans }}</dt>
<dd>{{ task.endDate|localizeddate('long', 'none') }}</dd>
{% endif %}
<dt class="inline">{{ 'Warning date'|trans }}</dt>
<dd>{{ task.warningDate|localizeddate('long', 'none') }}</dd>
{% if task.warningDate is not null %}
<dt class="inline">{{ 'Warning'|trans }}</dt>
<dd>{{ task.warningDate|localizeddate('long', 'none') }}</dd>
{% endif %}
{% endif %}
</dl>
<ul class="record_actions">
<li class="cancel">
<a class="sc-button bt-cancel" href="{{ path('chill_task_task_list_by_person', { 'personId': person.id } ) }}">
<a class="sc-button bt-cancel" href="{{ path('chill_task_singletask_list', { 'person_id': person.id } ) }}">
{{ 'Back to the list'|trans }}
</a>
</li>