[UI][CORE][COMPONENT][Search] Refactor templates

Just DRY
This commit is contained in:
Phablulo Joel 2021-12-21 11:39:39 -03:00
parent dd5d46c556
commit fb64444325
2 changed files with 4 additions and 48 deletions

View File

@ -1,12 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% extends 'feeds/feed.html.twig' %}
{% block title %}{% if page_title is defined %}{{ page_title | trans }}{% endif %}{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('assets/default_theme/css/pages/feeds.css') }}" type="text/css">
{% endblock stylesheets %}
{% block body %}
{% if error is defined %}
@ -87,21 +80,7 @@
</div>
{# Backwards compatibility with hAtom 0.1 #}
<main class="feed" tabindex="0" role="feed">
<div class="h-feed hfeed notes">
{% if notes is defined and notes is not empty %}
{% for note in notes %}
{% block current_note %}
<div class="section-widget">
{{ noteView.macro_note(note['note'], []) }}
</div>
{% endblock current_note %}
{% endfor %}
{% else %}
<div id="empty-notes"><h1>{% trans %}No notes here.{% endtrans %}</h1></div>
{% endif %}
</div>
</main>
{{ parent() }}
{% for actor in actors %}
{% include 'cards/profile/view.html.twig' with {'actor': actor} %}

View File

@ -1,36 +1,13 @@
{% extends 'stdgrid.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% extends 'feeds/feed.html.twig' %}
{% set nickname = nickname|escape %}
{% block title %}{% trans %}%nickname%'s profile{% endtrans %}{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="{{ asset('assets/default_theme/css/pages/feeds.css') }}" type="text/css">
{% endblock stylesheets %}
{% block body %}
{% block profile_view %}
{% include 'cards/profile/view.html.twig' %}
{% endblock profile_view %}
<main class="feed" tabindex="0" role="feed">
<div class="h-feed hfeed notes">
{% if notes is defined and notes is not empty %}
{% for conversation in notes %}
{% block current_note %}
{% if conversation is instanceof('array') %}
{{ noteView.macro_note(conversation['note'], conversation['replies']) }}
{% else %}
{{ noteView.macro_note(conversation) }}
{% endif %}
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
{% endblock current_note %}
{% endfor %}
{% else %}
<div id="empty-notes"><h1>{% trans %}No notes here.{% endtrans %}</h1></div>
{% endif %}
</div>
</main>
{{ parent() }}
{% endblock body %}