[PLUGINS][Repeat] Repeat template override WIP.

This commit is contained in:
2021-10-29 00:33:24 +01:00
parent 0f358a9c5d
commit 9a23e03330
5 changed files with 50 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ use App\Core\Modules\NoteHandlerPlugin;
use App\Entity\Note;
use App\Util\Common;
use App\Util\Exception\RedirectException;
use App\Util\Formatting;
use Symfony\Component\HttpFoundation\Request;
class Repeat extends NoteHandlerPlugin
@@ -77,6 +78,17 @@ class Repeat extends NoteHandlerPlugin
return Event::next;
}
public function onOverrideTemplateImport(string $current_template, string $default, string &$response)
{
switch ($current_template) {
case '/network/feed.html.twig':
$response = "plugins/repeat/cards/note/view.html.twig";
return Event::stop;
}
return Event::next;
}
public function onAddRoute(RouteLoader $r): bool
{
// Add/remove note to/from repeats

View File

@@ -0,0 +1,22 @@
{% extends '/cards/note/view.html.twig' %}
{% macro macro_note(note, replies) %}
{% set nickname = note.getActorNickname() %}
{% set fullname = note.getActorFullname() %}
{% set actor_url = note.getActor().getUrl() %}
{% set repeat_of = note.getRepeatOf() %}
<article class="h-entry hentry note">
{{ block('note_sidebar') }}
<div class="note-wrapper">
<div tabindex="0" title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}." class="note-info">
{{ block('note_author') }}
{{ block('note_actions') }}
</div>
<section tabindex="0" role="dialog" class="e-content entry-content note-content">
{{ _self.macro_note_minimal(note) }}
</section>
{{ block('note_replies') }}
</div>
</article>
{% endmacro macro_note %}