[PLUGINS][AttachmentCollections] Fixed "Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got 'Plugin\AttachmentCollections\Entity\AttachmentCollection'"

[TWIG] Cards are now divided into blocks and macros, additional macros done, attachments page no longer inside cards directory
[CARDS][Navigation] Now using macros to create section, details, and nav elements
This commit is contained in:
Eliseu Amaro 2022-02-06 21:37:04 +00:00
parent 2b9f70f89f
commit b3d582f665
Signed by: eliseuamaro
GPG Key ID: 96DA09D4B97BC2D5
43 changed files with 285 additions and 230 deletions

View File

@ -89,7 +89,7 @@ class Attachment extends Controller
try {
return $this->attachment($attachment_id, $note_id, function ($res) use ($note_id, $attachment_id) {
return [
'_template' => '/cards/attachments/show.html.twig',
'_template' => 'attachment/view.html.twig',
'download' => $res['attachment']->getDownloadUrl(note: $note_id),
'title' => $res['title'],
'attachment' => $res['attachment'],

View File

@ -54,7 +54,7 @@
<h2>{% trans %}Results{% endtrans %}</h2>
{% if actors is defined and actors is not empty %}
{% for actor in actors %}
{% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %}
{% block profile_view %}{% include 'cards/blocks/profile.html.twig' %}{% endblock profile_view %}
<hr>
{% endfor %}
<span class="frame-section-button-like">{% trans %}Page: %page%{% endtrans %}</span>

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
{% block title %}{% if page_title is defined %}{{ page_title | trans }}{% endif %}{% endblock %}
@ -47,9 +47,9 @@
{% for conversation in notes %}
{% block current_note %}
{% if conversation is instanceof('array') %}
{{ noteView.macro_note(conversation['note'], conversation['replies']) }}
{{ noteView.note_vanilla(conversation['note'], conversation['replies']) }}
{% else %}
{{ noteView.macro_note(conversation) }}
{{ noteView.note_vanilla(conversation) }}
{% endif %}
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
{% endblock current_note %}

View File

@ -217,7 +217,7 @@ class Conversation extends Component
*/
public function onPrependPostingForm(Request $request, array &$elements): bool
{
$elements[] = Formatting::twigRenderFile('cards/note/macro_note_minimal_wrapper.html.twig', ['note' => Note::getById((int) $request->query->get('reply_to_id'))]);
$elements[] = Formatting::twigRenderFile('cards/blocks/note_compact_wrapper.html.twig', ['note' => Note::getById((int) $request->query->get('reply_to_id'))]);
return Event::next;
}

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
{% set nickname = nickname|escape %}
{% block title %}{{ nickname }}{% endblock %}
@ -13,7 +13,7 @@
{% if actor is defined and actor is not null %}
{% block profile_view %}
{% include 'cards/profile/view.html.twig' with { 'actor': actor } only %}
{% include 'cards/blocks/profile.html.twig' with { 'actor': actor } only %}
{% endblock profile_view %}
{% if notes is defined %}
@ -46,9 +46,9 @@
{% for conversation in notes %}
{% block current_note %}
{% if conversation is instanceof('array') %}
{{ noteView.macro_note(conversation['note'], conversation['replies']) }}
{{ noteView.note_vanilla(conversation['note'], conversation['replies']) }}
{% else %}
{{ noteView.macro_note(conversation) }}
{{ noteView.note_vanilla(conversation) }}
{% endif %}
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
{% endblock current_note %}

View File

@ -7,18 +7,18 @@
<section class="panel-content accessibility-target">
{% if app.user %}
<section class='frame-section frame-section-padding' title="{{ 'Your profile information.' | trans }}">
{% block profile_view %}{% include 'cards/profile/view.html.twig' with { actor: current_actor } %}{% endblock profile_view %}
{{ block("profile_current_actor", "cards/navigation/view.html.twig") }}
{% block profile_view %}{% include 'cards/blocks/profile.html.twig' with { actor: current_actor } %}{% endblock profile_view %}
{{ block("profile_current_actor", "cards/blocks/navigation.html.twig") }}
</section>
{% else %}
<section>
{{ block("profile_security", "cards/navigation/view.html.twig") }}
{{ block("profile_security", "cards/blocks/navigation.html.twig") }}
</section>
{% endif %}
{{ block("feeds", "cards/navigation/view.html.twig") }}
{{ block("feeds", "cards/blocks/navigation.html.twig") }}
{{ block("footer", "cards/navigation/view.html.twig") }}
{{ block("footer", "cards/blocks/navigation.html.twig") }}
</section>
</aside>
{% endblock leftpanel %}

View File

@ -1,8 +1,7 @@
{% 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>
<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 }}" {% if current_path == 'conversation_reply_to' %}checked{% endif %}>
<input type="checkbox" id="toggle-panel-right" tabindex="0" title="{{ 'Open right panel' | trans }}" {% if app.request.get('_route') == 'conversation_reply_to' %}checked{% endif %}>
<aside class="section-panel section-panel-right">
<section class="panel-content accessibility-target">
@ -17,8 +16,7 @@
<details class="section-details-title" open="open" title="{{ 'Expand if you want to access more options.' | trans }}">
<summary class="details-summary-title">
<span>
{% set current_path = app.request.get('_route') %}
{% if current_path == 'conversation_reply_to' %}
{% if app.request.get('_route') == 'conversation_reply_to' %}
{{ "Reply to note" | trans }}
{% else %}
{{ "Create a note" | trans }}
@ -26,7 +24,7 @@
</span>
</summary>
{% if current_path == 'conversation_reply_to' %}
{% if app.request.get('_route') == 'conversation_reply_to' %}
<section class="frame-section-padding">
{% set prepend_posting_form = handle_event('PrependPostingForm', request) %}
{% for widget in prepend_posting_form %}
@ -64,7 +62,7 @@
</section>
{% endif %}
{% set extra_blocks = get_right_panel_blocks({'path': current_path, 'request': app.request, 'vars': (right_panel_vars | default)}) %}
{% set extra_blocks = get_right_panel_blocks({'path': app.request.get('_route'), 'request': app.request, 'vars': right_panel_vars | default }) %}
{% for block in extra_blocks %}
{{ block | raw }}
{% endfor %}

View File

@ -110,7 +110,7 @@
<h3>{% trans %}Actors found{% endtrans %}</h3>
{% if actors is defined and actors is not empty %}
{% for actor in actors %}
{% include 'cards/profile/view.html.twig' with {'actor': actor} %}
{% include 'cards/blocks/profile.html.twig' with {'actor': actor} %}
{% endfor %}
{% else %}
<em>{% trans %}No Actors were found for the specified query...{% endtrans %}</em>

View File

@ -2,7 +2,7 @@
{% block body %}
{% block profile_view %}
{% include 'cards/profile/view.html.twig' with { actor: object } %}
{% include 'cards/blocks/profile.html.twig' with { actor: object } %}
{% endblock profile_view %}
{{ form(form) }}
{% endblock body %}

View File

@ -2,7 +2,7 @@
{% block body %}
{% block profile_view %}
{% include 'cards/profile/view.html.twig' with { actor: object } %}
{% include 'cards/blocks/profile.html.twig' with { actor: object } %}
{% endblock profile_view %}
{{ form(form) }}
{% endblock body %}

View File

@ -20,7 +20,7 @@
{% endfor %}
{% for actor in results %}
{% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %}
{% block profile_view %}{% include 'cards/blocks/profile.html.twig' %}{% endblock profile_view %}
{% endfor %}
<div class="frame-section-button-like">

View File

@ -1,5 +1,5 @@
{% extends 'base.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
{% block stylesheets %}
{{ parent() }}
@ -22,7 +22,7 @@
{% for note in results %}
{% block current_note %}
{{ noteView.macro_note(note) }}
{{ noteView.note_vanilla(note) }}
{% endblock current_note %}
{% endfor %}

View File

@ -108,17 +108,13 @@ class AttachmentCollections extends Plugin
$res = DB::findBy(AttachmentCollection::class, ['actor_id' => $owner->getId()]);
} else {
$res = DB::dql(
<<<'EOF'
SELECT entry.attachment_collection_id FROM \Plugin\AttachmentCollections\Entity\AttachmentCollectionEntry AS entry
INNER JOIN \Plugin\AttachmentCollections\Entity\AttachmentCollection AS attachment_collection
WITH attachment_collection.id = entry.attachment_collection_id
WHERE entry.attachment_id = :attach_id AND entry.note_id = :note_id AND attachment_collection.actor_id = :id
EOF,
[
'id' => $owner->getId(),
'note_id' => $vars['vars']['note_id'],
'attach_id' => $vars['vars']['attachment_id'],
],
'select e.attachment_collection_id from attachment_collection_entry e '
. 'inner join attachment_collection as a '
. 'with a.id = e.attachment_collection_id '
. 'where e.attachment_id = :attachment_id '
. 'and e.note_id = :note_id '
. 'and a.actor_id = :actor_id',
['actor_id' => $owner->getId(), 'note_id' => $vars['vars']['note_id'], 'attachment_id' => $vars['vars']['attachment_id']],
);
}
if (!$ids_only) {

View File

@ -3,7 +3,7 @@
{% block collection_items %}
{% for key, attachment in attachments %}
<section class="frame-section frame-section-padding">
{% include '/cards/attachments/view.html.twig' with {'attachment': attachment, 'note': bare_notes[key], 'title': attachment.getBestTitle(bare_notes[key])} only %}
{% include '/cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': bare_notes[key], 'title': attachment.getBestTitle(bare_notes[key])} only %}
<a class="frame-section-button-like"
href="{{ attachment.getDownloadUrl(bare_notes[key]) }}"> {{ 'Download link' | trans }}</a>
</section>

View File

@ -1,4 +1,4 @@
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
<section class="frame-section frame-section-padding">
<div class="section-title">
@ -8,6 +8,6 @@
</div>
{% for note in related_notes %}
{{ noteView.macro_note_minimal(note) }}
{{ noteView.note_compact(note) }}
{% endfor %}
</section>

View File

@ -80,7 +80,7 @@ class BlogCollections extends Plugin
protected function shouldAddToRightPanel(Actor $user, $vars, Request $request): bool
{
// TODO: Implement shouldAddToRightPanel() method.
return $vars['path'] === 'note_view';
return false;
}
protected function getCollectionsBy(Actor $owner, ?array $vars = null, bool $ids_only = false): array

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import "/cards/note/view.html.twig" as noteView %}
{% import "/cards/macros/note.html.twig" as noteView %}
{% block title %}{{ 'Delete ' | trans }}{{ 'note' | trans }}{% endblock %}
@ -12,7 +12,7 @@
{{ parent() }}
<div class="page">
<div class="main">
{{ noteView.macro_note_minimal(note) }}
{{ noteView.note_compact(note) }}
{{ form(delete) }}
</div>
</div>

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import "/cards/note/view.html.twig" as noteView %}
{% import "/cards/macros/note.html.twig" as noteView %}
{% block title %}{{ 'Favourite ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %}
@ -12,7 +12,7 @@
{{ parent() }}
<div class="page">
<div class="main">
{{ noteView.macro_note_minimal(note) }}
{{ noteView.note_vanilla(note) }}
{{ form(add_favourite) }}
</div>
</div>

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import "/cards/note/view.html.twig" as noteView %}
{% import "/cards/macros/note.html.twig" as noteView %}
{% block title %}{{ 'Remove favourite from ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %}
@ -12,7 +12,7 @@
{{ parent() }}
<div class="page">
<div class="main">
{{ noteView.macro_note_minimal(note) }}
{{ noteView.note_vanilla(note) }}
{{ form(remove_favourite) }}
</div>
</div>

View File

@ -1,4 +1,4 @@
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
{# Backwards compatibility with hAtom 0.1 #}
{% if pinnednotes is not empty %}
@ -8,9 +8,9 @@
{% for conversation in pinnednotes %}
{% block current_note %}
{% if conversation is instanceof('array') %}
{{ noteView.macro_note(conversation['note'], conversation['replies']) }}
{{ noteView.note_vanilla(conversation['note'], conversation['replies']) }}
{% else %}
{{ noteView.macro_note(conversation) }}
{{ noteView.note_vanilla(conversation) }}
{% endif %}
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
{% endblock current_note %}

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import "/cards/note/view.html.twig" as noteView %}
{% import "/cards/macros/note.html.twig" as noteView %}
{% block title %}{{ title }}{% endblock %}
@ -12,7 +12,7 @@
{{ parent() }}
<div class="page">
<div class="main">
{{ noteView.macro_note_minimal(note) }}
{{ noteView.note_compact(note) }}
{{ form(toggle_form) }}
</div>
</div>

View File

@ -2,7 +2,7 @@
<section class="frame-section frame-section-padding">
<span class="section-title">Related tags</span>
{% for at in actor_tags %}
{% include 'cards/tag/actor_tag.html.twig' with { 'tag': at, 'actor': null } %}
{% include 'cards/blocks/tag_actor.html.twig' with { 'tag': at, 'actor': null } %}
{% endfor %}
</section>
{% endif %}

View File

@ -3,7 +3,7 @@
<h1>Related tags</h1>
{% for nt in note_tags %}
{% include 'cards/tag/note_tag.html.twig' with { 'tag': nt } %}
{% include 'cards/blocks/tag_note.html.twig' with { 'tag': nt } %}
{% endfor %}
</div>
{% endif %}

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import "/cards/note/view.html.twig" as noteView %}
{% import "/cards/macros/note.html.twig" as noteView %}
{% block title %}{{ 'Repeat ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %}
@ -12,7 +12,7 @@
{{ parent() }}
<div class="page">
<div class="main">
{{ noteView.macro_note(note) }}
{{ noteView.note_vanilla(note) }}
{{ form(add_repeat) }}
</div>
</div>

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import "/cards/note/view.html.twig" as noteView %}
{% import "/cards/macros/note.html.twig" as noteView %}
{% block title %}{{ 'Remove repeat from ' | trans }}{{ note.getActorNickname() }}{{ '\'s note.' | trans }}{% endblock %}
@ -12,7 +12,7 @@
{{ parent() }}
<div class="page">
<div class="main">
{{ noteView.macro_note(note) }}
{{ noteView.note_vanilla(note) }}
{{ form(remove_repeat) }}
</div>
</div>

View File

@ -1,5 +1,5 @@
{% extends 'base.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
{% block stylesheets %}
{{ parent() }}
@ -10,9 +10,9 @@
{% if note is defined or actor is defined %}
<div class="frame-section-padding">
{% if note is defined and note is not null %}
{{ noteView.macro_note(note, {}) }}
{{ noteView.note_vanilla(note, {}) }}
{% elseif actor is defined and actor is not null %}
{% include 'cards/profile/view.html.twig' with {'actor': actor} only %}
{% include 'cards/blocks/profile.html.twig' with {'actor': actor} only %}
{% endif %}
</div>
{% endif %}

View File

@ -1,10 +1,10 @@
{% extends 'collection/notes.html.twig' %}
{% extends '/collection/notes.html.twig' %}
{% block title %}{% trans %}%nickname%'s profile{% endtrans %}{% endblock %}
{% block body %}
{% block profile_view %}
{% include 'cards/profile/view.html.twig' %}
{% include '/cards/blocks/profile.html.twig' %}
{% endblock profile_view %}
{{ parent() }}

View File

@ -3,7 +3,7 @@
{% block body %}
<section class="frame-section frame-section-padding">
<h1>{{ 'Attachment' | trans }} {{ title }}</h1>
{% include '/cards/attachments/view.html.twig' with {'attachment': attachment, 'note': note, 'title': title} only %}
{% include '/cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': note, 'title': title} only %}
<a class="frame-section-button-like" href="{{ download }}"> {{ 'Original attachment link' | trans }}</a>
</section>
{% endblock body %}

View File

@ -0,0 +1,106 @@
{% block feeds %}
{% from 'cards/macros/widgets.html.twig' import section, details %}
{% set prepend %}
<h2 class="section-title">Account</h2>
{% endset %}
{% set main %}
{% set classes = {'details': 'section-details-title', 'summary': 'details-summary-title'} %}
{% set summary %}
<span>{{ 'Feeds' | trans }}</span>
{% if app.user %}
{# User custom feeds #}
<a class="edit-feed-link" href="{{ path('edit_feeds') }}">{{ icon('edit', 'icon icon-edit-feed') | raw }}</a>
{% endif %}
{% endset %}
{% set expanded %}
<nav class="frame-section-padding" tabindex="0" title="{{ 'Navigate through each feed.' | trans }}">
{% if not app.user %} {# Default feeds #}
<ul>
<li>
<a href="{{ path('feed_public') }}" class='hover-effect {{ active('feed_public') }}'>
{{ 'Feed' | trans }}
</a>
</li>
</ul>
{% else %}
<ul>
{% for link in get_feeds(current_actor) %}
<li>
<a href="{{ link.getUrl() }}" class='{{ active(link.getRoute()) }}'>{{ link.getTitle() }}</a>
</li>
{% endfor %}
{% for link in handle_event('AddMainNavigationItem', {'nickname': current_actor.getNickname()}) %}
<li>
<a href="{{ link['path'] }}" class='{{ active(link['path_id']) }}'>
{{ link['title'] }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</nav>
{% endset %}
{% set blocks = {'summary': { summary }, 'main': { expanded }} %}
{{ details(blocks, classes) }}
{% endset %}
{% set classes = {'section': 'frame-section'} %}
{% set title = 'Navigate through feeds' %}
{% set blocks = {'prepend': {}, 'main': { main }, 'append': {}} %}
{{ section(title, blocks, classes) }}
{% endblock feeds %}
{% block profile_current_actor %}
<nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a title='{{ 'Access your account settings.' | trans }}' href="{{ path('settings') }}" class='{{ active('settings') }}'>
{% trans %}Settings{% endtrans %}
</a>
<a title='{{ 'Logout from your account.' | trans }}' href='{{ path('security_logout') }}'>
{% trans %}Logout{% endtrans %}
</a>
</nav>
{% endblock profile_current_actor %}
{% block profile_security %}
{% from 'cards/macros/widgets.html.twig' import section, nav_a %}
{% set prepend %}
<h2 class="section-title">Account</h2>
{% endset %}
{% set main %}
{% set nav = {'classes': 'profile-navigation', 'title': 'Navigate through account related pages', 'tabindex': '0'} %}
{% set items = [
{'route': 'security_login', 'classes': active('security_login'), 'title': 'Login with your existing account', 'name': 'Login' },
{'route': 'security_register', 'classes': active('security_register'), 'title': 'Register a new account!', 'name': 'Register' }
]%}
{{ nav_a(nav, items) }}
{% endset %}
{% set classes = {'section': 'frame-section frame-section-padding'} %}
{% set title = 'Profile information' %}
{% set blocks = {'prepend': { prepend }, 'main': { main }, 'append': {}} %}
{{ section(title, blocks, classes) }}
{% endblock profile_security %}
{% block footer %}
{% from 'cards/macros/widgets.html.twig' import nav_ul_li_a %}
{% set nav = {'classes': 'footer', 'title': 'Footer conatining instance FAQ, TOS, and additional info'} %}
{% set items = [
{'route': 'doc_faq', 'classes': active('doc_faq'), 'title': 'FAQ', 'name': 'FAQ'},
{'route': 'doc_tos', 'classes': active('doc_tos'), 'title': 'TOS', 'name': 'TOS'},
{'route': 'doc_privacy', 'classes': active('doc_privacy'), 'title': 'Privacy', 'name': 'Privacy'},
{'route': 'doc_source', 'classes': active('doc_source'), 'title': 'Source', 'name': 'Source'},
{'route': 'doc_version', 'classes': active('doc_version'), 'title': 'Version', 'name': 'Version'}
]%}
{{ nav_ul_li_a(nav, items) }}
{% endblock footer %}

View File

@ -10,7 +10,7 @@
<a href="{{ note.getUrl() }}">{{ 'Permalink' | trans }}</a>
<hr>
{% for current_action in get_extra_note_actions(note) %}
<a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
<a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
{% endfor %}
</menu>
</details>
@ -29,7 +29,7 @@
<span class="note-replies-start"
tabindex="0">{{ 'Replies to ' | trans }}{{ nickname }}{{ '\'s note' | trans }}</span>
{% for conversation in replies %}
{{ _self.macro_note(conversation['note'], conversation['replies']) }}
{{ _self.note_vanilla(conversation['note'], conversation['replies']) }}
<hr tabindex="0" title="{{ 'End of reply' | trans }}">
{% endfor %}
</div>
@ -42,7 +42,7 @@
<section class="note-attachments" tabindex="0"
title="{{ 'Note attachments.' | trans }}">
{% for attachment in note.getAttachments() %}
{% include '/cards/attachments/view.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %}
{% include 'cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %}
{% endfor %}
</section>
{% endif %}
@ -147,65 +147,4 @@
{% endif %}
</aside>
{% endfor %}
{% endblock note_complementary_info %}
{% macro macro_note(note, replies) %}
{% set actor = note.getActor() %}
{% set nickname = actor.getNickname() %}
{% set fullname = actor.getFullname() %}
{% set actor_uri = actor.getUri() %}
{% set actor_url = actor.getUrl() %}
{% set mention = mention(actor) %}
{% set note_language = note.getNoteLanguageShortDisplay() %}
<article id="{{ 'note-anchor-' ~ note.getId() }}"
class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar') }}
<div class="note-wrapper">
<header class="note-info">
{{ block('note_info') }}
{{ block('note_actions') }}
</header>
<section role="dialog" class="e-content entry-content note-content">
{{ block('note_text') }}
{{ block('note_attachments') }}
{{ block('note_links') }}
</section>
{{ block('note_replies') }}
{{ block('note_complementary_info') }}
</div>
</article>
{% endmacro macro_note %}
{% macro macro_note_minimal(note) %}
{% set actor = note.getActor() %}
{% set nickname = actor.getNickname() %}
{% set fullname = actor.getFullname() %}
{% set actor_uri = actor.getUri() %}
{% set actor_url = actor.getUrl() %}
{% set mention = mention(actor) %}
<article class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar') }}
<div class="note-wrapper">
<header class="note-info">
<div class="note-info-start">
{{ block('note_author') }}
</div>
</header>
<section role="dialog" class="e-content entry-content note-content">
<small class="note-conversation-info">
<a href="{{ note.getConversationUrl() }}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a>
<a href="{{ note.getUrl() }}"
class="note-url">{{ note.getModified() | ago }}</a>
</small>
<hr>
{{ block('note_text') }}
</section>
</div>
</article>
{% endmacro macro_note_minimal %}
{% endblock note_complementary_info %}

View File

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

View File

@ -63,7 +63,7 @@
<nav class="profile-tags" title="{% trans %} %actor_nickname%'s actor tags{% endtrans %}">
{% for tag in actor_tags %}
{% include 'cards/tag/actor_tag.html.twig' with { 'tag': tag, 'actor': actor } %}
{% include 'cards/blocks/tag_actor.html.twig' with { 'tag': tag, 'actor': actor } %}
{% endfor %}
</nav>
</div>

View File

@ -0,0 +1,60 @@
{% macro note_vanilla(note, replies) %}
{% set actor = note.getActor() %}
{% set nickname = actor.getNickname() %}
{% set fullname = actor.getFullname() %}
{% set actor_uri = actor.getUri() %}
{% set actor_url = actor.getUrl() %}
{% set mention = mention(actor) %}
{% set note_language = note.getNoteLanguageShortDisplay() %}
<article id="{{ 'note-anchor-' ~ note.getId() }}"
class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
<div class="note-wrapper">
<header class="note-info">
{{ block('note_info', 'cards/blocks/note.html.twig') }}
{{ block('note_actions', 'cards/blocks/note.html.twig') }}
</header>
<section role="dialog" class="e-content entry-content note-content">
{{ block('note_text', 'cards/blocks/note.html.twig') }}
{{ block('note_attachments', 'cards/blocks/note.html.twig') }}
{{ block('note_links', 'cards/blocks/note.html.twig') }}
</section>
{{ block('note_replies', 'cards/blocks/note.html.twig') }}
{{ block('note_complementary_info', 'cards/blocks/note.html.twig') }}
</div>
</article>
{% endmacro note_vanilla %}
{% macro note_compact(note) %}
{% set actor = note.getActor() %}
{% set nickname = actor.getNickname() %}
{% set fullname = actor.getFullname() %}
{% set actor_uri = actor.getUri() %}
{% set actor_url = actor.getUrl() %}
{% set mention = mention(actor) %}
<article class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
<div class="note-wrapper">
<header class="note-info">
<div class="note-info-start">
{{ block('note_author', 'cards/blocks/note.html.twig') }}
</div>
</header>
<section role="dialog" class="e-content entry-content note-content">
<small class="note-conversation-info">
<a href="{{ note.getConversationUrl() }}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a>
<a href="{{ note.getUrl() }}"
class="note-url">{{ note.getModified() | ago }}</a>
</small>
<hr>
{{ block('note_text', 'cards/blocks/note.html.twig') }}
</section>
</div>
</article>
{% endmacro note_compact %}

View File

@ -0,0 +1,49 @@
{% macro nav_ul_li_a(nav, items) %}
<nav class="navigation {{ nav['classes'] | default }}" title="{{ nav['title'] | trans }}">
<ul class="navigation-ul {{ ul['classes'] | default }}">
{% for item in items %}
<li class="navigation-ul-li">
<a href="{{ path(item['route']) }}" class='{{ item['classes'] | default }}'>{{ item['name'] | trans }}</a>
</li>
{% endfor %}
</ul>
</nav>
{% endmacro nav_ul_li_a %}
{% macro nav_a(nav, items) %}
<nav class="navigation {{ nav['classes'] | default }}" title="{{ nav['title'] | trans }}" {% if nav['tabindex'] is defined %}tabindex={{ nav['tabindex'] }}{% endif %}>
{% for item in items %}
<a class='{{ item['classes'] | default }}' href='{{ path(item['route']) }}'>{{ item['name'] | trans }}</a>
{% endfor %}
</nav>
{% endmacro nav_a %}
{% macro section(title, blocks, classes) %}
<section class="{{ classes['section'] | default }}" title="{{ title | trans }}">
{% for widget in blocks['prepend'] %}
{{ widget | raw }}
{% endfor %}
{% for widget in blocks['main'] %}
{{ widget | raw }}
{% endfor %}
{% for widget in blocks['append'] %}
{{ widget | raw }}
{% endfor %}
</section>
{% endmacro section %}
{% macro details(blocks, classes, is_open = true) %}
<details class="section-details {{ classes['details'] | default }}" {% if is_open %}open="open"{% endif %} title="{{ 'Expand if you want to access more options.' | trans }}">
<summary class="details-summary {{ classes['summary'] | default }}">
{% for widget in blocks['summary'] %}
{{ widget | raw }}
{% endfor %}
</summary>
{% for widget in blocks['main'] %}
{{ widget | raw }}
{% endfor %}
</details>
{% endmacro details %}

View File

@ -1,93 +0,0 @@
{% block feeds %}
<section class="frame-section" title="{{ 'Feed navigation.' | trans }}">
<details class="section-details-title" open="open"
title="{{ 'Expand if you want to access more options.' | trans }}">
<summary class="details-summary-title">
<span>{{ 'Feeds' | trans }}</span>
{% if app.user %}
{# User custom feeds #}
<a class="edit-feed-link" href="{{ path('edit_feeds') }}">{{ icon('edit', 'icon icon-edit-feed') | raw }}</a>
{% endif %}
</summary>
<nav class="frame-section-padding" tabindex="0" title="{{ 'Navigate through each feed.' | trans }}">
{% if not app.user %} {# Default feeds #}
<ul>
<li>
<a href="{{ path('feed_public') }}" class='hover-effect {{ active('feed_public') }}'>
{{ 'Feed' | trans }}
</a>
</li>
</ul>
{% else %}
<ul>
{% for link in get_feeds(current_actor) %}
<li>
<a href="{{ link.getUrl() }}" class='{{ active(link.getRoute()) }}'>{{ link.getTitle() }}</a>
</li>
{% endfor %}
{% for link in handle_event('AddMainNavigationItem', {'nickname': current_actor.getNickname()}) %}
<li>
<a href="{{ link['path'] }}" class='{{ active(link['path_id']) }}'>
{{ link['title'] }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</nav>
</details>
</section>
{% endblock feeds %}
{% block profile_current_actor %}
<nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a title='{{ 'Access your account settings.' | trans }}' href="{{ path('settings') }}" class='{{ active('settings') }}'>
{% trans %}Settings{% endtrans %}
</a>
<a title='{{ 'Logout from your account.' | trans }}' href='{{ path('security_logout') }}'>
{% trans %}Logout{% endtrans %}
</a>
</nav>
{% endblock profile_current_actor %}
{% block profile_security %}
<section class='frame-section frame-section-padding' title="{{ 'Your profile information.' | trans }}">
<h2 class="section-title">Account</h2>
<nav tabindex="0" class="profile-navigation" title="{{ 'Navigate through account related pages.' | trans }}">
<a title='{{ 'Login with your existing account.' | trans }}' href="{{ path('security_login') }}" class='hover-effect {{ active('login') }}'>
{% trans %}Login{% endtrans %}
</a>
<a title='{{ 'Register a new account!' | trans }}' href="{{ path('security_register') }}">
{% trans %}Register{% endtrans %}
</a>
</nav>
</section>
{% endblock profile_security %}
{% block footer %}
<nav class="footer">
<ul>
<li>
<a href="{{ path('doc_faq') }}" class='hover-effect {{ active('doc_faq') }}'>FAQ</a>
</li>
<li>
<a href="{{ path('doc_tos') }}" class='hover-effect {{ active('doc_tos') }}'>TOS</a>
</li>
<li>
<a href="{{ path('doc_privacy') }}" class='hover-effect {{ active('doc_privacy') }}'>Privacy</a>
</li>
<li>
<a href="{{ path('doc_source') }}" class='hover-effect {{ active('doc_source') }}'>Source</a>
</li>
<li>
<a href="{{ path('doc_version') }}" class='hover-effect {{ active('doc_version') }}'>Version</a>
</li>
</ul>
</nav>
{% endblock footer %}

View File

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

View File

@ -1,5 +1,5 @@
{% extends 'stdgrid.html.twig' %}
{% import '/cards/note/view.html.twig' as noteView %}
{% import '/cards/macros/note.html.twig' as noteView %}
{% block title %}{{ note.getActorNickname() ~ '\'s note' | trans }}{% endblock %}
@ -13,7 +13,7 @@
<main class="feed" tabindex="0" role="feed">
<div class="h-feed hfeed notes">
{% if note is defined and note is not empty %}
{{ noteView.macro_note(note, null) }}
{{ noteView.note_vanilla(note, null) }}
{% else %}
<div id="empty-notes"><h1>{% trans %}No notes here.{% endtrans %}</h1></div>
{% endif %}

View File

@ -27,6 +27,7 @@
<input type="text" value="{{ last_login_id }}" name="_username" id="inputNicknameOrEmail" class="form-control" required autofocus>
<p class="help-text">{{ "Your nickname or email address." | trans }}</p>
</div>
<div class="form-row">
<label class="section-form-label" for="inputPassword">{{ "Password" | trans }}</label>
<input type="password" name="_password" id="inputPassword" class="form-control" required>
@ -42,7 +43,6 @@
<div>
<button id="signIn" class="btn btn-lg btn-primary" type="submit">Sign in</button>
</div>
{% endif %}
</fieldset>
</form>

View File

@ -1,6 +1,6 @@
{% extends '/stdgrid.html.twig' %}
{% import 'settings/macros.html.twig' as macros %}
{% import 'cards/macros/settings.html.twig' as macros %}
{% block title %}{{ 'Settings' | trans }}{% endblock %}