Skip to content
Snippets Groups Projects
Commit 6344ff82 authored by Pierre Fleutot's avatar Pierre Fleutot
Browse files

Entrée : Fix onglet Wiktionnaire : affichage de l'action vers autre lexique.

Affichage des sous-définitions et sous-exemples avec pour chacun toutes les actions associées add/edit/delete/comment
parent 5ab5f2f0
No related branches found
No related tags found
No related merge requests found
...@@ -543,4 +543,4 @@ li.nav-item { ...@@ -543,4 +543,4 @@ li.nav-item {
} }
.text-toggle[aria-expanded=true] .show-collapsed { .text-toggle[aria-expanded=true] .show-collapsed {
display: none; display: none;
} }
\ No newline at end of file
...@@ -278,6 +278,7 @@ class EntryController extends AppBaseController ...@@ -278,6 +278,7 @@ class EntryController extends AppBaseController
case Entry::ATTR_COMMENT: return CommentType::class; case Entry::ATTR_COMMENT: return CommentType::class;
case Entry::ATTR_EXAMPLE: return ExampleType::class; case Entry::ATTR_EXAMPLE: return ExampleType::class;
case Entry::ATTR_DEFINITION: return DefinitionType::class; case Entry::ATTR_DEFINITION: return DefinitionType::class;
case Entry::ATTR_SUBDEFINITION: return DefinitionType::class;
case Entry::ATTR_PRONUNCIATION: return PronunciationType::class; case Entry::ATTR_PRONUNCIATION: return PronunciationType::class;
default: return BlockType::class; default: return BlockType::class;
} }
......
...@@ -23,6 +23,7 @@ class Entry ...@@ -23,6 +23,7 @@ class Entry
{ {
const ATTR_PRONUNCIATION = 'Pronunciations'; const ATTR_PRONUNCIATION = 'Pronunciations';
const ATTR_DEFINITION = 'Definitions'; const ATTR_DEFINITION = 'Definitions';
const ATTR_SUBDEFINITION = 'Subdefinitions';
const ATTR_COMMENT = 'Comments'; const ATTR_COMMENT = 'Comments';
const ATTR_EXAMPLE = 'Examples'; const ATTR_EXAMPLE = 'Examples';
const ATTR_PART_OF_SPEECH = 'PartOfSpeech'; const ATTR_PART_OF_SPEECH = 'PartOfSpeech';
......
...@@ -43,13 +43,15 @@ ...@@ -43,13 +43,15 @@
{% if pronunciation.accent is defined %}{{ pronunciation.accent }} :{% endif %} {% if pronunciation.accent is defined %}{{ pronunciation.accent }} :{% endif %}
{{ pronunciation.api }} {{ pronunciation.api }}
{% for sound in pronunciation.sounds|default([]) %} {% for sound in pronunciation.sounds|default([]) %}
<audio controls> <div>
<source src="{{ sound.url }}" type="audio/ogg"> <audio controls style="scale: 75%">
{# <source src="horse.mp3" type="audio/mpeg">#} <source src="{{ sound.url }}" type="audio/ogg">
Your browser does not support the audio element. {# <source src="horse.mp3" type="audio/mpeg">#}
</audio> Your browser does not support the audio element.
{% endfor %} </audio>
</div>
{% endfor %}
{{ _self.actions(entry, pronunciationKey, ['comment'], "", 'Comments') }} {{ _self.actions(entry, pronunciationKey, ['comment'], "", 'Comments') }}
{{ _self.actions(entry, pronunciationKey, ['edit', 'delete'], '', 'Pronunciations') }} {{ _self.actions(entry, pronunciationKey, ['edit', 'delete'], '', 'Pronunciations') }}
<br> <br>
...@@ -88,14 +90,22 @@ ...@@ -88,14 +90,22 @@
<div> <div>
<p class="fw-bold"> <p class="fw-bold">
{{ loop.index }}. {{ definition.Def }} {{ loop.index }}. {{ definition.Def }}
{{ _self.actions(entry, definitionKey, ['add'], "Ajouter un exemple à cette définition", 'Examples') }}
<div class="dropdown d-inline-block">
<a href="#" class="dropdown-toggle" id="{{ definitionKey }}Btn" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa fa-plus-circle fa-fixed-sized text-light-green"></i>
</a>
<ul class="dropdown-menu dropdown-inner" aria-labelledby="{{ definitionKey }}Btn">
<li><a href="#" data-url="{{ path('app_entry_add_block', {id: entry.id, blockId: definitionKey, blockCategory: 'Examples'}) }}" class="modal-form dropdown-item">{{ "Ajouter un exemple"|trans }}</a></li>
<li><a href="#" data-url="{{ path('app_entry_add_block', {id: entry.id, blockId: definitionKey, blockCategory: 'Subdefinitions'}) }}" class="modal-form dropdown-item">{{ "Ajouter une sous-définition"|trans }}</a></li>
</ul>
</div>
{{ _self.actions(entry, definitionKey, ['comment'], "", 'Comments') }} {{ _self.actions(entry, definitionKey, ['comment'], "", 'Comments') }}
{{ _self.actions(entry, definitionKey, ['edit', 'delete'], '', 'Definitions') }} {{ _self.actions(entry, definitionKey, ['edit', 'delete'], '', 'Definitions') }}
</p> </p>
{{ _self.comments(entry, definition, definitionKey) }} {{ _self.comments(entry, definition, definitionKey) }}
</div> </div>
<ol class="ms-3"> <ol class="ms-3">
{% for key, example in definition.Examples|default([]) %} {% for key, example in definition.Examples|default([]) %}
{### EXEMPLES ######### SET KEY ##########} {### EXEMPLES ######### SET KEY ##########}
...@@ -114,6 +124,43 @@ ...@@ -114,6 +124,43 @@
{% endfor %} {% endfor %}
</ol> </ol>
<ul class="ms-3">
{% for key, subdefinition in definition.Subdefinitions|default([]) %}
{### SOUS-DÉFINITIONS ######### SET KEY ##########}
{% set subdefinitionKey = definitionKey~'[Subdefinitions]['~key~']' %}
<li id="{{ subdefinition.id }}">
<div>
<p class="fw-bold">
{{ subdefinition.Def }}
{{ _self.actions(entry, subdefinitionKey, ['add'], "Ajouter un exemple à cette définition", 'Examples') }}
{{ _self.actions(entry, subdefinitionKey, ['comment'], "", 'Comments') }}
{{ _self.actions(entry, subdefinitionKey, ['edit', 'delete'], "", 'Definitions') }}
</p>
{{ _self.comments(entry, subdefinition, subdefinitionKey) }}
</div>
<ol class="ms-3">
{% for key, subexample in subdefinition.Examples|default([]) %}
{### SOUS-EXEMPLES ######### SET KEY ##########}
{% set subexampleKey = subdefinitionKey~'[Examples]['~key~']' %}
<li id="{{ subexample.id }}">
<div>
<p class="fst-italic">
{{ subexample.example }}
{{ _self.actions(entry, subexampleKey, ['comment'], "", 'Comments') }}
{{ _self.actions(entry, subexampleKey, ['edit', 'delete'], "", 'Examples') }}
</p>
{{ _self.comments(entry, subexample, subexampleKey) }}
</div>
</li>
{% endfor %}
</ol>
</li>
{% endfor %}
</ul>
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>
...@@ -214,20 +261,20 @@ ...@@ -214,20 +261,20 @@
{% if not entry.lexicon.zero %} {% if not entry.lexicon.zero %}
{% if 'add' in operations %} {% if 'add' in operations %}
<a href="#" data-url="{{ path('app_entry_add_block', {id: entry.id, blockId: key, blockCategory: category}) }}" class="modal-form"><i class="fa fa-plus-circle fa-fixed-sized text-light-green" title="{{ title ? title|trans : category|trans }} {{ key }}"></i></a> <a href="#" data-url="{{ path('app_entry_add_block', {id: entry.id, blockId: key, blockCategory: category}) }}" class="modal-form"><i class="fa fa-plus-circle fa-fixed-sized text-light-green" title="{{ title ? title|trans : category|trans }} "></i></a>
{% endif %} {% endif %}
{% if 'edit' in operations %} {% if 'edit' in operations %}
<a href="#" data-url="{{ path('app_entry_edit_block', {id: entry.id, blockId: key, blockCategory: category}) }}" class="modal-form"><i class="fa fa-pencil-square fa-fixed-sized text-grey" title="{{ key }}"></i></a> <a href="#" data-url="{{ path('app_entry_edit_block', {id: entry.id, blockId: key, blockCategory: category}) }}" class="modal-form"><i class="fa fa-pencil-square fa-fixed-sized text-grey" title=""></i></a>
{% endif %} {% endif %}
{% if 'delete' in operations %} {% if 'delete' in operations %}
<a href="#" data-href="{{ path('app_entry_delete_block', {id: entry.id, blockId: key, blockCategory: category}) }}" <a href="#" data-href="{{ path('app_entry_delete_block', {id: entry.id, blockId: key, blockCategory: category}) }}"
data-confirm="{{ "Confirmer la suppression ?"|trans }}" data-bs-toggle="modal" data-bs-target="#confirm-dialog"><i class="fa fa-trash fa-fixed-sized text-grey" title="{{ key }}"></i></a> data-confirm="{{ "Confirmer la suppression ?"|trans }}" data-bs-toggle="modal" data-bs-target="#confirm-dialog"><i class="fa fa-trash fa-fixed-sized text-grey" title=""></i></a>
{% endif %} {% endif %}
{% if 'comment' in operations %} {% if 'comment' in operations %}
<a href="#" data-url="{{ path('app_entry_add_block', {id: entry.id, blockId: key, blockCategory: category}) }}" class="modal-form"><i class="fa fa-comment fa-fixed-sized text-light-green" title="{{ "Ajouter un commentaire"|trans }} {{ key }}"></i></a> <a href="#" data-url="{{ path('app_entry_add_block', {id: entry.id, blockId: key, blockCategory: category}) }}" class="modal-form"><i class="fa fa-comment fa-fixed-sized text-light-green" title="{{ "Ajouter un commentaire"|trans }} "></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
......
<ul class="nav nav-tabs justify-content-end"> <ul class="nav nav-tabs justify-content-end">
{% for lexicon in lexicon_manager.myLexicons(app.user) %}
{% set zeroLexicon = lexicon_manager.zeroLexicon(entry.language) %}
{% set lexicons = lexicon_manager.myLexicons(app.user)|merge([zeroLexicon]) %}
{% for lexicon in lexicons %}
{% if lexicon == entry.lexicon %} {% if lexicon == entry.lexicon %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link active tab-pink dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">{{ lexicon }}</a> <a class="nav-link active {{ lexicon == zeroLexicon ? 'tab-dark-pink' : 'tab-pink' }} dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">{{ lexicon == zeroLexicon ? 'Wiktionnaire'|trans : lexicon }}</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% set backUrl = (lexicon == entry.lexicon ? path('app_lexicon_show', {id: entry.lexicon.id}) : path('app_entry_show', {id: entry.id})) %} {% if lexicon != zeroLexicon %}
<li><a class="dropdown-item" href="#" {% set backUrl = (lexicon == entry.lexicon ? path('app_lexicon_show', {id: entry.lexicon.id}) : path('app_entry_show', {id: entry.id})) %}
data-href="{{ path('app_entry_delete', {id: entry.id, backUrl: backUrl}) }}" <li><a class="dropdown-item" href="#"
data-confirm="{{ "Confirmer la suppression ?"|trans }}" data-bs-toggle="modal" data-bs-target="#confirm-dialog"> data-href="{{ path('app_entry_delete', {id: entry.id, backUrl: backUrl}) }}"
{{ "Supprimer l'entrée dans ce lexique"|trans }} data-confirm="{{ "Confirmer la suppression ?"|trans }}" data-bs-toggle="modal" data-bs-target="#confirm-dialog">
</a></li> {{ "Supprimer l'entrée dans ce lexique"|trans }}
</a></li>
{% endif %}
{% for otherLexicon in lexicon_manager.myLexicons(app.user) %} {% for otherLexicon in lexicon_manager.myLexicons(app.user) %}
{% set entryWithSameHeadwordInThisLexicon = otherLexicon.getEntryForHeadword(entry.headword) %} {% set entryWithSameHeadwordInThisLexicon = otherLexicon.getEntryForHeadword(entry.headword) %}
...@@ -36,19 +42,12 @@ ...@@ -36,19 +42,12 @@
{% set entryWithSameHeadwordInThisLexicon = lexicon.getEntryForHeadword(entry.headword) %} {% set entryWithSameHeadwordInThisLexicon = lexicon.getEntryForHeadword(entry.headword) %}
{% if entryWithSameHeadwordInThisLexicon %} {% if entryWithSameHeadwordInThisLexicon %}
<a title="{{ "Voir l'entrée dans ce lexique"|trans }}" class="nav-link tab-pink" href="{{ path('app_entry_show', {id: entryWithSameHeadwordInThisLexicon.id}) }}">{{ lexicon }}</a> <a title="{{ "Voir l'entrée dans ce lexique"|trans }}" class="nav-link tab-pink" href="{{ path('app_entry_show', {id: entryWithSameHeadwordInThisLexicon.id}) }}">{{ lexicon == zeroLexicon ? 'Wiktionnaire'|trans : lexicon }}</a>
{% else %} {% else %}
<a title="{{ "L'entrée n'est pas présente dans ce lexique"|trans }}" class="nav-link tab-grey" href="#">{{ lexicon }}</a> <a title="{{ "L'entrée n'est pas présente dans ce lexique"|trans }}" class="nav-link tab-grey" href="#">{{ lexicon == zeroLexicon ? 'Wiktionnaire'|trans : lexicon }}</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if not entry.lexicon.isNewWords %}
{% set zeroLexicon = lexicon_manager.zeroLexicon(entry.language) %}
{% set entryZero = zeroLexicon.getEntryForHeadword(entry.headword) %}
<li class="nav-item">
<a class="nav-link {{ zeroLexicon == entry.lexicon ? 'active' }} tab-dark-pink" href="{{ path('app_entry_show', {id: entryZero.id}) }}">{{ "Wiktionnaire"|trans }}</a>
</li>
{% endif %}
</ul> </ul>
\ No newline at end of file
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"milestone": "échéance" "milestone": "échéance"
"Definitions": "Définition" "Definitions": "Définition"
"Subdefinitions": "Sous-Définition"
"Pronunciations": "Prononciation" "Pronunciations": "Prononciation"
"Examples": "Exemple" "Examples": "Exemple"
"PartOfSpeech": "Nature" "PartOfSpeech": "Nature"
......
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