From 949bc29189f11cf7bd5c8eb4d1741277e7ee811c Mon Sep 17 00:00:00 2001 From: Mats Mikkel Rummelhoff Date: Thu, 9 May 2024 20:20:34 +0200 Subject: [PATCH] Fix bug w/ missing New child button. Bump to 2.1.0 --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- src/ChildMe.php | 2 +- src/templates/childme-button.twig | 20 ++++++++++++-------- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68aa5b0..4cfb23b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 2.1.0 - 2024-05-09 +### Fixed +- Fixed a bug that prevented the "New child" button from appearing in certain situations +### Changed +- Replaced the "New child" tooltip for the "New child" buttons with a "New child" `title` attribute. + ## 2.0.0 - 2024-03-27 ### Added - Added Craft 5 compatibility diff --git a/composer.json b/composer.json index d354bd1..1730f4d 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mmikkel/child-me", "description": "Easily create child elements", "type": "craft-plugin", - "version": "2.0.0", + "version": "2.1.0", "keywords": [ "craft", "cms", diff --git a/src/ChildMe.php b/src/ChildMe.php index 3a187dc..5af3639 100644 --- a/src/ChildMe.php +++ b/src/ChildMe.php @@ -80,7 +80,7 @@ static function (RegisterElementTableAttributesEvent $event) { Event::on( $elementClass, Element::EVENT_DEFINE_ATTRIBUTE_HTML, - function (DefineAttributeHtmlEvent $event) use ($elementClass) { + function (DefineAttributeHtmlEvent $event) { if ($event->attribute !== '_childme_addChild') { return; } diff --git a/src/templates/childme-button.twig b/src/templates/childme-button.twig index d873fec..ca68df6 100644 --- a/src/templates/childme-button.twig +++ b/src/templates/childme-button.twig @@ -8,9 +8,8 @@ class="childme-button{{ hidden ? ' hidden' }}" data-icon="plus" aria-label="{{ 'New child'|t('app') }}" - > - {{ 'New child'|t('app') }} - + title="{{ 'New child'|t('app') }}" + > {% else %} {# Create a disclosure menu, but neglect to add the [data-disclosure-trigger] attribute to, essentially, lazy-load the menu; otherwise Craft would create a 100 of these on pageload #} + title="{{ 'New child'|t('app') }}" + >