[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' %} {% extends 'feeds/feed.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% 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 %} {% block body %}
{% if error is defined %} {% if error is defined %}
@ -87,21 +80,7 @@
</div> </div>
{# Backwards compatibility with hAtom 0.1 #} {# Backwards compatibility with hAtom 0.1 #}
<main class="feed" tabindex="0" role="feed"> {{ parent() }}
<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>
{% for actor in actors %} {% for actor in actors %}
{% include 'cards/profile/view.html.twig' with {'actor': actor} %} {% include 'cards/profile/view.html.twig' with {'actor': actor} %}

View File

@ -1,36 +1,13 @@
{% extends 'stdgrid.html.twig' %} {% extends 'feeds/feed.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% set nickname = nickname|escape %} {% set nickname = nickname|escape %}
{% block title %}{% trans %}%nickname%'s profile{% endtrans %}{% endblock %} {% 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 body %}
{% block profile_view %} {% block profile_view %}
{% include 'cards/profile/view.html.twig' %} {% include 'cards/profile/view.html.twig' %}
{% endblock profile_view %} {% endblock profile_view %}
<main class="feed" tabindex="0" role="feed"> {{ parent() }}
<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>
{% endblock body %} {% endblock body %}