From 3f249e0e25da8f6e4d1c8297b5fd32cb4af8189d Mon Sep 17 00:00:00 2001 From: pfleu <fleutotp@gmail.com> Date: Mon, 5 Jun 2023 09:15:24 +0200 Subject: [PATCH] Ajout Espace de discussion sur page lexique --- public/assets/css/app.css | 7 ++- templates/entry/_entryAttributes.html.twig | 18 ++++---- templates/entry/show.html.twig | 50 +++++++++++----------- templates/lexicon/show.html.twig | 43 +++++++++++++++++++ 4 files changed, 82 insertions(+), 36 deletions(-) diff --git a/public/assets/css/app.css b/public/assets/css/app.css index 6972d8f..ccee2c2 100644 --- a/public/assets/css/app.css +++ b/public/assets/css/app.css @@ -20,6 +20,9 @@ .chat-message-own .chat-message-body { background-color: #05728F; } +.chat-message-footer { + color: dimgrey; +} /* AJAX LOADING */ #overlay { @@ -174,13 +177,13 @@ table.label-table > tbody > tr > td { .text-dark-grey { color: #9a9a9a; } -td:hover .fa.text-grey, p:hover .fa.text-grey, h4:hover .fa.text-grey, h1:hover .fa.text-grey { +.links-container:hover .fa.text-grey, td:hover .fa.text-grey, p:hover .fa.text-grey, h4:hover .fa.text-grey, h1:hover .fa.text-grey { color: dimgrey; } .text-light-green { color: #d2e8d2; } -td:hover .fa.text-light-green, p:hover .fa.text-light-green, h4:hover .fa.text-light-green, h1:hover .fa.text-light-green { +.links-container:hover .fa.text-light-green, td:hover .fa.text-light-green, p:hover .fa.text-light-green, h4:hover .fa.text-light-green, h1:hover .fa.text-light-green { color: limegreen; } .fa-fixed-sized { diff --git a/templates/entry/_entryAttributes.html.twig b/templates/entry/_entryAttributes.html.twig index 34af44a..6b3eabd 100644 --- a/templates/entry/_entryAttributes.html.twig +++ b/templates/entry/_entryAttributes.html.twig @@ -15,14 +15,16 @@ <div class="ms-1 ps-4 mb-2"> {% for key, pronunciation in entry_manager.pronunciations(entry) %} {### PRONUNCIATION ######### SET KEY ##########} - {% set pronunciationKey = '[Items][0][Sense][Pronunciations]['~key~']' %} - - {% if pronunciation.accent is defined %}{{ pronunciation.accent }} :{% endif %} - {{ pronunciation.api }} - {{ _self.actions(entry, pronunciationKey, ['comment'], "", 'Comments') }} - {{ _self.actions(entry, pronunciationKey, ['edit', 'delete'], '', 'Pronunciations') }} - <br> - {{ _self.comments(entry, pronunciation, pronunciationKey) }} + <span class="links-container"> + {% set pronunciationKey = '[Items][0][Sense][Pronunciations]['~key~']' %} + + {% if pronunciation.accent is defined %}{{ pronunciation.accent }} :{% endif %} + {{ pronunciation.api }} + {{ _self.actions(entry, pronunciationKey, ['comment'], "", 'Comments') }} + {{ _self.actions(entry, pronunciationKey, ['edit', 'delete'], '', 'Pronunciations') }} + <br> + {{ _self.comments(entry, pronunciation, pronunciationKey) }} + </span> {% endfor %} </div> diff --git a/templates/entry/show.html.twig b/templates/entry/show.html.twig index fcc67b7..764a7a4 100644 --- a/templates/entry/show.html.twig +++ b/templates/entry/show.html.twig @@ -60,43 +60,41 @@ <div class="col col-md-3 col-sm-12"> - <div id="history" class="grey-panel"> - <h5>{{ "Discussion"|trans }}</h5> - - <div id="chatMessages"> - {% for chatMessage in entry.chatMessages %} - <div class=" chat-message {{ chatMessage.createdBy == app.user ? 'chat-message-own' }}"> + <div id="chatMessages" class="grey-panel mb-3"> + <h5 class="mb-3">{{ "Espace de discussion"|trans }}</h5> - <div class="d-flex justify-content-start"> + {% for chatMessage in entry.chatMessages %} + <div class=" chat-message {{ chatMessage.createdBy == app.user ? 'chat-message-own' }}"> - <div class=" flex-shrink-0 mt-1 me-2">{% if app.user != chatMessage.createdBy %}{{ app.user|badge }}{% endif %}</div> + <div class="d-flex justify-content-start"> - <div class="chat-message-content"> - <div class="chat-message-body"> - {{ chatMessage.content|nl2br|raw }} - </div> + <div class=" flex-shrink-0 mt-1 me-2">{% if app.user != chatMessage.createdBy %}{{ app.user|badge }}{% endif %}</div> - <div class="chat-message-footer"> - {{ chatMessage.createdAt|date('d/m/Y à H:i') }} - {% if chatMessage.createdBy == app.user %} - <a title="{{ "Modifier"|trans }}" href="#" data-url="{{ path('app_chat_message_edit', {id: chatMessage.id}) }}" class="modal-form"> - <i class="fa fa-pencil"></i> - </a> - <div class="d-inline-block">{{ include('chat_message/_delete_form.html.twig') }}</div> - {% endif %} - </div> + <div class="chat-message-content"> + <div class="chat-message-body"> + {{ chatMessage.content|nl2br|raw }} + </div> + <div class="chat-message-footer"> + {{ chatMessage.createdAt|date('d/m/Y à H:i') }} + {% if chatMessage.createdBy == app.user %} + <a title="{{ "Modifier"|trans }}" href="#" data-url="{{ path('app_chat_message_edit', {id: chatMessage.id}) }}" class="modal-form"> + <i class="fa fa-pencil"></i> + </a> + <div class="d-inline-block">{{ include('chat_message/_delete_form.html.twig') }}</div> + {% endif %} </div> - </div> + </div> </div> - {% endfor %} - </div> + + </div> + {% endfor %} <div class="row"> <div class="col-md-12"> - <a title="{{ "Ajouter un message"|trans }}" href="#" data-url="{{ path('app_chat_message_new', {entryId: entry.id}) }}" class="modal-form"> - <i class="fa fa-plus-circle text-success"></i> {{ "Ajouter un message"|trans }} + <a title="{{ "Écrire un message"|trans }}" href="#" data-url="{{ path('app_chat_message_new', {entryId: entry.id}) }}" class="modal-form"> + <i class="fa fa-plus-circle text-success"></i> {{ "Écrire un message"|trans }} </a> </div> </div> diff --git a/templates/lexicon/show.html.twig b/templates/lexicon/show.html.twig index 34f2d95..135233c 100644 --- a/templates/lexicon/show.html.twig +++ b/templates/lexicon/show.html.twig @@ -124,12 +124,55 @@ </div> <div class="col col-md-3"> + + <div id="chatMessages" class="grey-panel mb-3"> + <h5 class="mb-3">{{ "Espace de discussion"|trans }}</h5> + + {% for chatMessage in lexicon.chatMessages %} + <div class=" chat-message {{ chatMessage.createdBy == app.user ? 'chat-message-own' }}"> + + <div class="d-flex justify-content-start"> + + <div class=" flex-shrink-0 mt-1 me-2">{% if app.user != chatMessage.createdBy %}{{ app.user|badge }}{% endif %}</div> + + <div class="chat-message-content"> + <div class="chat-message-body"> + {{ chatMessage.content|nl2br|raw }} + </div> + + <div class="chat-message-footer"> + {{ chatMessage.createdAt|date('d/m/Y à H:i') }} + {% if chatMessage.createdBy == app.user %} + <a title="{{ "Modifier"|trans }}" href="#" data-url="{{ path('app_chat_message_edit', {id: chatMessage.id}) }}" class="modal-form"> + <i class="fa fa-pencil"></i> + </a> + <div class="d-inline-block">{{ include('chat_message/_delete_form.html.twig') }}</div> + {% endif %} + </div> + + </div> + </div> + + </div> + {% endfor %} + + <div class="row"> + <div class="col-md-12"> + <a title="{{ "Écrire un message"|trans }}" href="#" data-url="{{ path('app_chat_message_new', {lexiconId: lexicon.id}) }}" class="modal-form"> + <i class="fa fa-plus-circle text-success"></i> {{ "Écrire un message"|trans }} + </a> + </div> + </div> + + </div> + <div id="history" class="grey-panel"> <h5 class="mb-3">{{ "Historique des modifications"|trans }}</h5> {% for log in log_manager.lastLogsForLexicon(lexicon, app.user) %} <p>{% include "log/_formattedLog.html.twig" %}</p> {% endfor %} </div> + </div> </div> -- GitLab