forked from GNUsocial/gnu-social
[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:
@@ -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) {
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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 %}
|
||||
|
@@ -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>
|
||||
|
@@ -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 %}
|
||||
|
@@ -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 %}
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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 %}
|
||||
|
Reference in New Issue
Block a user