Skip to content
Snippets Groups Projects
Commit a40ee2a4 authored by pfleu's avatar pfleu
Browse files

Début ajout label depuis popup gestion label

parent 4c4ec5c4
No related branches found
No related tags found
No related merge requests found
......@@ -91,7 +91,8 @@ class LabelController extends AppBaseController
'action' => $this->generateUrl('app_label_new', [
'masterType' => $masterType,
'category' => $category,
'groupId' => $request->get('groupId')
'groupId' => $request->get('groupId'),
'entryId' => $request->get('entryId'),
])
]);
$form->handleRequest($request);
......@@ -126,6 +127,16 @@ class LabelController extends AppBaseController
]);
$this->em->flush();
if ($entry ?? null) {
$labelManager->addHeadword($label, $entry->getHeadword());
$this->em->flush();
return $this->redirectToRoute('app_label_choose', [
'category' => $label->getCategory(),
'entryId' => $entryId,
'lexiconId' => $entry->getLexicon()->getId(),
]);
}
return $this->render('closeModalAndReload.html.twig');
}
}
......
......@@ -48,21 +48,33 @@
</div>
{% endif %}
{# BArre de recherche #}
{# Barre de recherche #}
<div class="d-flex justify-content-between align-items-center">
<input class="form-control" id="searchInput" type="text" placeholder="{{ 'Rechercher des labels à ajouter'|trans }}" name="search">
<div class="dropdown dropstart ms-2"> {# Création de label #}
<a class="dropdown-toggle caret-off" data-bs-toggle="dropdown" title="{{ 'Ajouter un label'|trans }}"><i class="fa fa-plus-circle fa-lg text-blue"></i></a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
{% if category == constant("App\\Entity\\Label::LABEL_CATEGORY_GENERAL") %}
<li><a title="{{ 'Ajouter un label'|trans }}" href="#" data-url="{{ path('app_label_new', {category: category, masterType: constant("App\\Entity\\Label::MASTER_PERSONAL")}) }}" class="modal-form dropdown-item">
{{ "Personnel"|trans }}</a></li>
{% elseif category == constant("App\\Entity\\Label::LABEL_CATEGORY_MILESTONE") %}
{% endif %}
</ul>
</div>
{% if entry|default(null) %}
<div class="dropdown dropstart ms-2"> {# Création de label #}
<a class="dropdown-toggle caret-off" data-bs-toggle="dropdown" title="{{ 'Ajouter un label'|trans }}"><i class="fa fa-plus-circle fa-lg text-blue"></i></a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
{% if category == constant("App\\Entity\\Label::LABEL_CATEGORY_GENERAL") %}
<li><a title="{{ 'Ajouter un label'|trans }}" href="#" data-url="{{ path('app_label_new', {category: category, entryId: entry.id, masterType: constant("App\\Entity\\Label::MASTER_PERSONAL")}) }}" class="modal-form dropdown-item">
{{ "Personnel"|trans }}</a></li>
{% for group in app.user.myGroups(app.session.get('studied_language')) %}
<li><a title="{{ 'Ajouter un label'|trans }}" href="#" data-url="{{ path('app_label_new', {category: category, entryId: entry.id, groupId: group.id, masterType: constant("App\\Entity\\Label::MASTER_GROUP")}) }}" class="modal-form dropdown-item">
{{ group }}</a></li>
{% endfor %}
{% elseif category == constant("App\\Entity\\Label::LABEL_CATEGORY_MILESTONE") %}
<li><a title="{{ 'Ajouter un label'|trans }}" href="#" data-url="{{ path('app_label_new', {category: category, entryId: entry.id, masterType: constant("App\\Entity\\Label::MASTER_PERSONAL")}) }}" class="modal-form dropdown-item">
{{ "Personnel"|trans }}</a></li>
{% for group in app.user.myGroups(app.session.get('studied_language')) %}
<li><a title="{{ 'Ajouter un label'|trans }}" href="#" data-url="{{ path('app_label_new', {category: category, entryId: entry.id, groupId: group.id, masterType: constant("App\\Entity\\Label::MASTER_GROUP")}) }}" class="modal-form dropdown-item">
{{ group }}</a></li>
{% endfor %}
{% endif %}
</ul>
</div>
{% endif %}
</div>
......
......@@ -6,7 +6,7 @@
{{ label }}
{% if label.isMilestone %}<br>{{ label.getMilestone|date('d/m/Y') }}{% endif %}
{% if label.isMilestone %}<br>{{ label.getMilestone ? label.getMilestone|date('d/m/Y') : '-/-/-' }}{% endif %}
{% if showHeadwordsCounter|default(false) %}
<span class="position-absolute top-100 start-100 text-black">{{ label_manager.getHeadwordsNbWithLabel(label, app.user) }}/{{ label_manager.getHeadwordsNbWithLabel(label) }}</span>
......@@ -24,7 +24,7 @@
{{ label }}
{% if label.isMilestone %}<br>{{ label.getMilestone|date('d/m/Y') }}{% endif %}
{% if label.isMilestone %}<br>{{ label.getMilestone ? label.getMilestone|date('d/m/Y') : '-/-/-' }}{% endif %}
{% if showHeadwordsCounter|default(false) %}
<span class="position-absolute top-100 start-100 text-black">{{ label_manager.getHeadwordsNbWithLabel(label, app.user) }}/{{ label_manager.getHeadwordsNbWithLabel(label) }}</span>
......@@ -42,7 +42,7 @@
{{ label }}
{% if label.isMilestone %}<br>{{ label.getMilestone|date('d/m/Y') }}{% endif %}
{% if label.isMilestone %}<br>{{ label.getMilestone ? label.getMilestone|date('d/m/Y') : '-/-/-' }}{% endif %}
{% if showHeadwordsCounter|default(false) %}
<span class="position-absolute top-100 start-100 text-black">{{ label_manager.getHeadwordsNbWithLabel(label, app.user) }}/{{ label_manager.getHeadwordsNbWithLabel(label) }}</span>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment