From 65a3d738ca62d65e104ec8e0ca813ffd67dfbbfe Mon Sep 17 00:00:00 2001 From: Phablulo Date: Mon, 27 Dec 2021 15:38:47 -0300 Subject: [PATCH] [PLUGIN][AttachmentCollections] Make it look good --- .../AttachmentCollections.php | 6 ++--- .../AttachmentCollections/widget.html.twig | 24 ++++++++++++------- .../assets/css/widget.css | 5 ++++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/plugins/AttachmentCollections/AttachmentCollections.php b/plugins/AttachmentCollections/AttachmentCollections.php index 2969f7b3f5..4da2a08e95 100644 --- a/plugins/AttachmentCollections/AttachmentCollections.php +++ b/plugins/AttachmentCollections/AttachmentCollections.php @@ -212,9 +212,9 @@ class AttachmentCollections extends Plugin $res[] = Formatting::twigRenderFile( 'AttachmentCollections/widget.html.twig', [ - 'colls' => $colls, - 'add_form' => $add_form->createView(), - 'create_form' => $create_form->createView(), + 'has_collections' => $colls, + 'add_form' => $add_form->createView(), + 'create_form' => $create_form->createView(), ], ); return Event::next; diff --git a/plugins/AttachmentCollections/templates/AttachmentCollections/widget.html.twig b/plugins/AttachmentCollections/templates/AttachmentCollections/widget.html.twig index cbd3f1c93d..ae32110f9d 100644 --- a/plugins/AttachmentCollections/templates/AttachmentCollections/widget.html.twig +++ b/plugins/AttachmentCollections/templates/AttachmentCollections/widget.html.twig @@ -4,19 +4,25 @@

{% trans %}Add to collection{% endtrans %}

{{ icon('arrow-down', 'icon icon-details-open') | raw }} -
- {{ form(add_form) }} -
+ {% if has_collections %} +
+ {{ form(add_form) }} +
-
- - {% trans %}Other options{% endtrans %} - {{ icon('arrow-down', 'icon icon-details-close') | raw }} - +
+ + {% trans %}Other options{% endtrans %} + {{ icon('arrow-down', 'icon icon-details-close') | raw }} + +
+ {{ form(create_form) }} +
+
+ {% else %}
{{ form(create_form) }}
-
+ {% endif %} diff --git a/public/plugins/AttachmentCollections/assets/css/widget.css b/public/plugins/AttachmentCollections/assets/css/widget.css index 2cdf2c2ecb..d8f3fdd670 100644 --- a/public/plugins/AttachmentCollections/assets/css/widget.css +++ b/public/plugins/AttachmentCollections/assets/css/widget.css @@ -10,3 +10,8 @@ .attachment-collections .attachment-collections-selections-options button { margin: 0 !important; } +#add_collections { + height: auto !important; + max-height: 20rem !important; + overflow-y: auto !important; +}