improvements based on draft review of MR 153

This commit is contained in:
Julie Lenaerts 2021-10-01 19:05:03 +02:00
parent 6301c4c10b
commit e35f002f2b
17 changed files with 154 additions and 191 deletions

View File

@ -57,6 +57,9 @@ final class AsideActivityController extends CRUDController
$asideActivity->setDuration($duration);
$categoryId = $request->query->get('type', 7);
if($categoryId === null){
return $this->createNotFoundException('You must give a valid category id');
}
$category = $this->categoryRepository->find($categoryId);
$asideActivity->setType($category);

View File

@ -87,7 +87,7 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
'controller' => \Chill\AsideActivityBundle\Controller\AsideActivityController::class,
'actions' => [
'index' => [
'template' => '@ChillAsideActivity/asideActivity/list.html.twig',
'template' => '@ChillAsideActivity/asideActivity/index.html.twig',
'role' => 'ROLE_USER'
],
'new' => [

View File

@ -3,6 +3,7 @@
namespace Chill\AsideActivityBundle\Form;
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
@ -15,9 +16,10 @@ final class AsideActivityCategoryType extends AbstractType
protected $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper)
public function __construct(TranslatableStringHelper $translatableStringHelper, CategoryRender $categoryRender)
{
$this->translatableStringHelper = $translatableStringHelper;
$this->categoryRender = $categoryRender;
}
public function buildForm(FormBuilderInterface $builder, array $options)
@ -29,8 +31,10 @@ final class AsideActivityCategoryType extends AbstractType
->add('parent', EntityType::class, [
'class' => AsideActivityCategory::class,
'required' => false,
'label' => 'Type',
'choice_label' => function (AsideActivityCategory $category){
return $this->translatableStringHelper->localize($category->getTitle());
$options = [];
return $this->categoryRender->renderString($category, $options);
}
])
->add('isActive', ChoiceType::class,

View File

@ -40,7 +40,6 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
'routeParameters' => [
'type' => 1,
'duration' => 900,
'note' => 'Pas des remarques'
]
])
->setExtras([

View File

@ -9,6 +9,6 @@
{% block layout_wvm_content %}
{% block admin_content %}
<!-- block personcontent empty -->
<h1>{{ 'Aside activity configuration' |trans }}</h1>
<h1>{{ 'Aside activity configuration'|trans }}</h1>
{% endblock %}
{% endblock %}

View File

@ -3,7 +3,7 @@
<dl class="chill_view_data">
<dt class="inline">{{ 'Type'|trans }}</dt>
<dd>{{ entity.type.title | localize_translatable_string }}</dd>
<dd>{{ entity.type.title|localize_translatable_string }}</dd>
<dt class="inline">{{ 'Created by'|trans }}</dt>
<dd>{{ entity.createdBy }}</dd>
@ -37,7 +37,7 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="btn btn-cancel" href="{{ path('chill_crud_'~crud_name~'_index', { 'id': entity.id }) }}">
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index', { 'id': entity.id }) }}">
{{ 'Back to the list'|trans }}

View File

@ -1,8 +1,91 @@
{% extends '@ChillMain/layout.html.twig' %}
{% extends "@ChillMain/layout.html.twig" %}
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block title %}
{{ 'Aside activity list'|trans }}
{% endblock title %}
{% block content %}
{% embed '@ChillAsideActivity/AsideActivity/_index.html.twig' %}
{% endembed %}
{% endblock content %}
<div class="col-md-10 asideactivity-list">
<h2>{{ 'My aside activities'|trans }}</h2>
{% if entities|length == 0 %}
<p class="chill-no-data-statement">
{{ "There aren't any aside activities."|trans }}
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
</p>
{% else %}
<div class="flex-table">
{% for entity in entities %}
<div class="item-bloc">
<div class="item-row wrap-header">
<div class="item-col">
<h3>
<b>{{ entity.type.title|localize_translatable_string }}</b>
</h3>
<div>
{% if entity.date %}
<span>{{ entity.date|format_date('long') }}</span>
{% endif %}
{% if entity.date %}
<span class="duration">
<i class="fa fa-fw fa-hourglass-end"></i>
{{ entity.duration|date('H:i') }}
</span>
{% endif %}
</div>
</div>
<div class="item-col">
<div class="box">
<ul class="list-content fa-ul">
<li>
<span>
<abbr class="referrer" title={{ 'Created by'|trans }}>{{ 'By'|trans }}:</abbr>
<b>{{ entity.createdBy.usernameCanonical }}</b>
</span>
</li>
<li>
<span>
<abbr class="referrer" title={{ 'Created for'|trans }}>{{ 'For'|trans }}:</abbr>
<b>{{ entity.agent.usernameCanonical }}</b>
</span>
</li>
</ul>
<div class="action">
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_view', { 'id': entity.id } ) }}" class="btn btn-show btn-mini"></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update btn-mini "></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete btn-mini"></a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{{ chill_pagination(paginator) }}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
{{ 'Create'|trans }}
</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@ -1,101 +0,0 @@
{% extends "@ChillMain/layout.html.twig" %}
{% block title %}
{{ 'Aside activity list' |trans }}
{% endblock title %}
{% block content %}
<div class="col-md-10 asideactivity-list">
<h2>{{ 'My aside activities' |trans }}</h2>
{% if entities|length == 0 %}
<p class="chill-no-data-statement">
{{ "There aren't any aside activities."|trans }}
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
</p>
{% else %}
<div class="flex-table">
{% for entity in entities %}
<div class="item-bloc">
<div class="item-row wrap-header">
<div class="item-col">
<h3>
<b>{{ entity.type.title | localize_translatable_string }}</b>
</h3>
<div>
{% if entity.date %}
<span>{{ entity.date|format_date('long') }}</span>
{% endif %}
{% if entity.date %}
<span class="duration">
<i class="fa fa-fw fa-hourglass-end"></i>
{{ entity.duration|date('H:i') }}
</span>
{% endif %}
</div>
</div>
<div class="item-col">
<div class="float-button bottom">
<div class="box">
<ul class="list-content fa-ul">
<li>
<span>
<abbr class="referrer" title={{ 'Created by'|trans }}>{{ 'By'|trans }}:</abbr>
<b>{{ entity.createdBy.usernameCanonical }}</b>
</span>
</li>
<li>
<span>
<abbr class="referrer" title={{ 'Created for'|trans }}>{{ 'For'|trans }}:</abbr>
<b>{{ entity.agent.usernameCanonical }}</b>
</span>
</li>
</ul>
<div class="action">
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_view', { 'id': entity.id } ) }}" class="btn btn-show btn-mini"></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update btn-mini "></a>
</li>
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete btn-mini"></a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="item-row comment separator">
<section class="chill-entity entity-comment-embeddable">
<blockquote class="chill-user-quote">
<p>{{ entity.note }}</p>
</blockquote>
</section>
</div>
</div>
{% endfor %}
</div>
{{ chill_pagination(paginator) }}
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
{{ 'Create' | trans }}
</a>
</li>
</ul>
{% endif %}
{% endblock %}

View File

@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210706124644 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'Aside activity category entity created';
}
public function up(Schema $schema): void

View File

@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210804082249 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'Aside activity entity created';
}
public function up(Schema $schema): void

View File

@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210806140343 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'Duration changed to type integer';
}
public function up(Schema $schema): void

View File

@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210806140710 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'Duration changed back to timestamp';
}
public function up(Schema $schema): void

View File

@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210810084456 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'createdat, updatedat and date given a type timestamp';
}
public function up(Schema $schema): void

View File

@ -7,14 +7,11 @@ namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210922182907 extends AbstractMigration
{
public function getDescription(): string
{
return '';
return 'Parent and children added to aside activity category entity';
}
public function up(Schema $schema): void

View File

@ -14,7 +14,6 @@ present: présent
not present: absent
Delete: Supprimer
Update: Mettre à jour
Update activity: Modifier l'activité
Aside activity data: Données de l'activité annexe
There aren't any aside activities.: Aucune activité annexe enregistrée.
Type: Type
@ -41,14 +40,8 @@ crud:
title_edit: Edition d'une catégorie de type d'activité
#forms
Activity creation: Nouvelle activité annexe
Create a new aside activity type: Nouvelle categorie d'activité annexe
Create: Créer
Back to the list: Retour à la liste
Save activity: Sauver l'activité
Reset form: Remise à zéro du formulaire
Choose the agent for whom this activity is created: Choissisez l'utilisateur pour qui l'activité est creéé.
Choose the activity category: Choissisez le type d'activité
Choose the duration: Choisir la durée
Choose a category: Choisir un categorie
Is active: Actif
@ -154,12 +147,6 @@ days: jours
#list
My aside activities: Mes activités annexes
Date: Date
By: Par
For: Pour
Created by: Créé par
Created for: Créé pour
#Aside activity delete
Delete aside activity: Supprimer une activité annexe
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?

View File

@ -1,7 +1,7 @@
"This program is free software: you can redistribute it and/or modify it under the terms of the <strong>GNU Affero General Public License</strong>": "Ce programme est un logiciel libre: vous pouvez le redistribuer et/ou le modifier selon les termes de la licence <strong>GNU Affero GPL</strong>"
User manual: Manuel d'utilisation
Search: Rechercher
'Search persons, ...': 'Recherche des personnes, ...'
"Search persons, ...": "Recherche des personnes, ..."
Person name: Nom / Prénom de la personne
Login: Connexion
Logout: Se déconnecter
@ -33,7 +33,7 @@ Cancel: Annuler
Save: Enregistrer
This form contains errors: Ce formulaire contient des erreurs
Choose an user: Choisir un utilisateur
'You are going to leave a page with unsubmitted data. Are you sure you want to leave ?': "Vous allez quitter la page alors que des données n'ont pas été enregistrées. Êtes vous sûr de vouloir partir ?"
"You are going to leave a page with unsubmitted data. Are you sure you want to leave ?": "Vous allez quitter la page alors que des données n'ont pas été enregistrées. Êtes vous sûr de vouloir partir ?"
No value: Aucune information
Last updated by: Dernière mise à jour par
Last updated on: Dernière mise à jour le
@ -71,24 +71,24 @@ Postal code: Code postal
Valid from: Valide à partir du
Choose a postal code: Choisir un code postal
address:
address_homeless: L'adresse est-elle celle d'un domicile fixe ?
real address: Adresse d'un domicile
consider homeless: N'est pas l'adresse d'un domicile (SDF)
address_homeless: L'adresse est-elle celle d'un domicile fixe ?
real address: Adresse d'un domicile
consider homeless: N'est pas l'adresse d'un domicile (SDF)
address more:
floor: ét
corridor: coul
steps: esc
flat: appart
buildingName: résidence
extra: ''
distribution: cedex
floor: ét
corridor: coul
steps: esc
flat: appart
buildingName: résidence
extra: ""
distribution: cedex
Create a new address: Créer une nouvelle adresse
#serach
Your search is empty. Please provide search terms.: La recherche est vide. Merci de fournir des termes de recherche.
The domain %domain% is unknow. Please check your search.: Le domaine de recherche "%domain%" est inconnu. Merci de vérifier votre recherche.
Invalid terms : Recherche invalide
You should not have more than one domain. : Vous ne devriez pas avoir plus d'un domaine de recherche.
Invalid terms: Recherche invalide
You should not have more than one domain.: Vous ne devriez pas avoir plus d'un domaine de recherche.
#used for page title
Search %pattern%: Recherche de "%pattern%"
Results %start%-%end% of %total%: Résultats %start%-%end% sur %total%
@ -113,9 +113,9 @@ Permissions Menu: Gestion des droits
Permissions management of your chill installation: Gestion des permissions de votre instance
#admin section
'Administration interface': Interface d'administration
"Administration interface": Interface d'administration
Welcome to the admin section !: >
Bienvenue dans l'interface d'administration !
Bienvenue dans l'interface d'administration !
#admin section for center's administration
Create a new center: Créer un nouveau centre
@ -212,7 +212,6 @@ Problem during download: Problème durant le téléchargement
# sans valeur
without data: sans valeur
#CSV List Formatter
Add a number on first column: La première colonne est un numéro
Number: Numéro
@ -230,9 +229,9 @@ Comma separated values (CSV): Valeurs séparées par des virgules (CSV - tableur
Choose the format: Choisir le format
# select2
'select2.no_results': Aucun résultat
'select2.error_loading': Erreur de chargement des résultats
'select2.searching': Recherche en cours...
"select2.no_results": Aucun résultat
"select2.error_loading": Erreur de chargement des résultats
"select2.searching": Recherche en cours...
# change password
Change my password: Modification du mot de passe
@ -260,28 +259,35 @@ Impersonate: Incarner l'utilisateur
Impersonate mode: Mode fantôme
crud:
# general items
new:
button_action_form: Créer
link_edit: Modifier
save_and_close: Créer & fermer
save_and_show: Créer & voir
save_and_new: Créer & nouveau
success: Les données ont été créées
edit:
button_action_form: Enregistrer
back_to_view: Voir
save_and_close: Enregistrer & fermer
save_and_show: Enregistrer & voir
success: Les données ont été modifiées
delete:
success: Les données ont été supprimées
link_to_form: Supprimer
default:
success: Les données ont été enregistrées
view:
link_duplicate: Dupliquer
# general items
new:
button_action_form: Créer
link_edit: Modifier
save_and_close: Créer & fermer
save_and_show: Créer & voir
save_and_new: Créer & nouveau
success: Les données ont été créées
edit:
button_action_form: Enregistrer
back_to_view: Voir
save_and_close: Enregistrer & fermer
save_and_show: Enregistrer & voir
success: Les données ont été modifiées
delete:
success: Les données ont été supprimées
link_to_form: Supprimer
default:
success: Les données ont été enregistrées
view:
link_duplicate: Dupliquer
No entities: Aucun élément
CHILL_FOO_SEE: Voir un élément
CHILL_FOO_EDIT: Modifier un élément
#Show templates
Date: Date
By: Par
For: Pour
Created for: Créé pour
Created by: Créé par