[COMPONENTS][Conversation] Note being replied to now appears before Posting's own form, RightPanel is also open by default on smaller screens when the current route is 'conversation_reply_to'

This commit is contained in:
Eliseu Amaro 2022-01-25 19:17:40 +00:00
parent c7c5fe7979
commit 14bb1b2876
Signed by: eliseuamaro
GPG Key ID: 96DA09D4B97BC2D5
4 changed files with 28 additions and 5 deletions

View File

@ -34,6 +34,8 @@ use App\Entity\Activity;
use App\Entity\Actor; use App\Entity\Actor;
use App\Entity\Note; use App\Entity\Note;
use App\Util\Common; use App\Util\Common;
use App\Util\Exception\RedirectException;
use App\Util\Formatting;
use Component\Conversation\Entity\Conversation as ConversationEntity; use Component\Conversation\Entity\Conversation as ConversationEntity;
use Component\Conversation\Entity\ConversationMute; use Component\Conversation\Entity\ConversationMute;
use Functional as F; use Functional as F;
@ -194,6 +196,17 @@ class Conversation extends Component
return Event::next; return Event::next;
} }
/**
* Add minimal Note card to RightPanel template
*
* @throws RedirectException
*/
public function onPrependPostingForm(Request $request, array &$elements)
{
$elements[] = Formatting::twigRenderFile('cards/note/macro_note_minimal_wrapper.html.twig', ['note' => Note::getById((int) $request->query->get('reply_to_id'))]);
return Event::next;
}
/** /**
* Event launched when deleting given Note, it's deletion implies further changes to object related to this Note. * Event launched when deleting given Note, it's deletion implies further changes to object related to this Note.
* Please note, **replies are NOT deleted**, their reply_to is only set to null since this Note no longer exists. * Please note, **replies are NOT deleted**, their reply_to is only set to null since this Note no longer exists.

View File

@ -1,7 +1,8 @@
{% block rightpanel %} {% block rightpanel %}
{% set current_path = app.request.get('_route') %}
<label class="panel-right-icon" for="toggle-panel-right" tabindex="-1">{{ icon('chevron-left', 'icon icon-right') | raw }}</label> <label class="panel-right-icon" for="toggle-panel-right" tabindex="-1">{{ icon('chevron-left', 'icon icon-right') | raw }}</label>
<a id="anchor-right-panel" class="anchor-hidden" tabindex="0" title="{{ 'Press tab followed by a space to access right panel' | trans }}"></a> <a id="anchor-right-panel" class="anchor-hidden" tabindex="0" title="{{ 'Press tab followed by a space to access right panel' | trans }}"></a>
<input type="checkbox" id="toggle-panel-right" tabindex="0" title="{{ 'Open right panel' | trans }}"> <input type="checkbox" id="toggle-panel-right" tabindex="0" title="{{ 'Open right panel' | trans }}" {% if current_path == 'conversation_reply_to' %}checked{% endif %}>
<aside class="section-panel section-panel-right"> <aside class="section-panel section-panel-right">
<section class="panel-content accessibility-target"> <section class="panel-content accessibility-target">
@ -10,12 +11,10 @@
{{ widget | raw }} {{ widget | raw }}
{% endfor %} {% endfor %}
{% set current_path = app.request.get('_route') %}
{% set blocks = handle_event('AppendRightPostingBlock', request) %} {% set blocks = handle_event('AppendRightPostingBlock', request) %}
{% if blocks['post_form'] is defined %} {% if blocks['post_form'] is defined %}
<section class="frame-section" title="{{ 'Create a new note.' | trans }}"> <section class="frame-section" title="{{ 'Create a new note.' | trans }}">
<details class="section-details-title" open="open" <details class="section-details-title" open="open" title="{{ 'Expand if you want to access more options.' | trans }}">
title="{{ 'Expand if you want to access more options.' | trans }}">
<summary class="details-summary-title"> <summary class="details-summary-title">
<span> <span>
{% set current_path = app.request.get('_route') %} {% set current_path = app.request.get('_route') %}
@ -27,6 +26,15 @@
</span> </span>
</summary> </summary>
{% if current_path == 'conversation_reply_to' %}
<section class="frame-section-padding">
{% set prepend_posting_form = handle_event('PrependPostingForm', request) %}
{% for widget in prepend_posting_form %}
{{ widget | raw }}
{% endfor %}
</section>
{% endif %}
<section class="section-form"> <section class="section-form">
{{ form_start(blocks['post_form']) }} {{ form_start(blocks['post_form']) }}
{{ form_errors(blocks['post_form']) }} {{ form_errors(blocks['post_form']) }}

View File

@ -240,7 +240,7 @@ embed header {
} }
.note-info-start { .note-info-start {
flex: 1; flex: 1;
width: 150px; width: 15px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;

View File

@ -0,0 +1,2 @@
{% from 'cards/note/view.html.twig' import macro_note_minimal %}
{{ macro_note_minimal(note) }}