[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:
2022-02-06 21:37:04 +00:00
parent 2b9f70f89f
commit b3d582f665
43 changed files with 285 additions and 230 deletions

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>