From debb587ed97904710e3c883d135d022e1fa77dc0 Mon Sep 17 00:00:00 2001 From: Brian Teeman Date: Sat, 30 Sep 2023 21:26:09 +0100 Subject: [PATCH] [5.0] Select Schedule Task css (#41871) * [5.0] Select Schedule Task css The select task view is the same as the select module view except it uses its own css file with invalid css. This PR changes that so that it uses an scss file in exactly the same way as com_modules. This removes the invalid css and makes it more maintainable. * section * Merge remote-tracking branch 'origin/5.0-dev' into 6_com_scheduler * Revert "Merge remote-tracking branch 'origin/5.0-dev' into 6_com_scheduler" This reverts commit 3bb1df214c0c936690702b44587f7964837a77b5. * Revert "Auxiliary commit to revert individual files from df98bc922e28d16cd50b7d8b527cd8e959bd55ac" This reverts commit a9e3bedc2cc97deb806be1138fe0402e30c2e932. * assets - thanks @wilsonge * sync with #41920 * js fix * js --------- Co-authored-by: Richard Fath Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 3 + .../com_scheduler/tmpl/select/default.php | 3 +- .../language/en-GB/plg_behaviour_compat.ini | 4 +- .../css/admin-view-select-task.css | 60 --------------- .../com_scheduler/joomla.asset.json | 5 -- .../js/admin-view-select-task-search.es6.js | 2 +- .../plg_behaviour_compat/removed.asset.json | 15 ++++ .../atum/scss/pages/_com_scheduler.scss | 75 +++++++++++++++++++ .../administrator/atum/scss/template.scss | 1 + plugins/behaviour/compat/compat.xml | 12 +++ .../behaviour/compat/src/Extension/Compat.php | 11 +++ 11 files changed, 122 insertions(+), 69 deletions(-) delete mode 100644 build/media_source/com_scheduler/css/admin-view-select-task.css create mode 100644 build/media_source/plg_behaviour_compat/removed.asset.json create mode 100644 build/media_source/templates/administrator/atum/scss/pages/_com_scheduler.scss diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index a120b6cdfaa3f..aa34bc08663a4 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -2173,6 +2173,9 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) '/libraries/vendor/fgrosse/phpasn1/LICENSE', '/libraries/vendor/stella-maris/clock/LICENSE.md', '/libraries/vendor/stella-maris/clock/src/ClockInterface.php', + '/media/com_scheduler/css/admin-view-select-task.css', + '/media/com_scheduler/css/admin-view-select-task.min.css', + '/media/com_scheduler/css/admin-view-select-task.min.css.gz', '/media/system/css/calendar-jos.css', '/media/system/css/calendar-jos.min.css', '/media/system/css/calendar-jos.min.css.gz', diff --git a/administrator/components/com_scheduler/tmpl/select/default.php b/administrator/components/com_scheduler/tmpl/select/default.php index 1ab6d113b99bc..4705b91a6c6a2 100644 --- a/administrator/components/com_scheduler/tmpl/select/default.php +++ b/administrator/components/com_scheduler/tmpl/select/default.php @@ -23,7 +23,6 @@ $app = $this->app; $wa = $this->document->getWebAssetManager(); -$wa->useStyle('com_scheduler.admin-view-select-task-css'); $wa->useScript('com_scheduler.admin-view-select-task-search'); ?> @@ -75,7 +74,7 @@ class="visually-hidden"> aria-label="">

-

+

diff --git a/administrator/language/en-GB/plg_behaviour_compat.ini b/administrator/language/en-GB/plg_behaviour_compat.ini index 04a5b91735be7..3dfab0d6abd68 100644 --- a/administrator/language/en-GB/plg_behaviour_compat.ini +++ b/administrator/language/en-GB/plg_behaviour_compat.ini @@ -6,6 +6,8 @@ PLG_BEHAVIOUR_COMPAT="Behaviour - Backward Compatibility" PLG_COMPAT_FIELD_CLASSES_ALIASES_LABEL="Classes Aliases" PLG_COMPAT_FIELD_CLASSES_ALIASES_DESCRIPTION="Add class aliases for classes which have been renamed or moved to a namespace." -PLG_COMPAT_FIELD_ES5_ASSETS_LABEL="ES5 Assets" PLG_COMPAT_FIELD_ES5_ASSETS_DESCRIPTION="Activate this option if your extension requires *.es5 assets which has resulted in an exception. The assets provided are empty but prevent the exception." +PLG_COMPAT_FIELD_ES5_ASSETS_LABEL="ES5 Assets" +PLG_COMPAT_FIELD_REMOVED_ASSETS_DESCRIPTION="Activate this option if your extension requires removed assets which has resulted in an exception. The assets provided are empty but prevent the exception." +PLG_COMPAT_FIELD_REMOVED_ASSETS_LABEL="Removed Assets" PLG_COMPAT_XML_DESCRIPTION="If you use extensions which are not using the current Joomla Coding standards then this plugin, when enabled, will provide backward compatibility to the prior major version." diff --git a/build/media_source/com_scheduler/css/admin-view-select-task.css b/build/media_source/com_scheduler/css/admin-view-select-task.css deleted file mode 100644 index 0a92aff93da32..0000000000000 --- a/build/media_source/com_scheduler/css/admin-view-select-task.css +++ /dev/null @@ -1,60 +0,0 @@ -.new-task { - display: flex; - overflow: hidden; - color: hsl(var(--hue), 30%, 40%); - background-color: hsl(var(--hue), 60%, 97%); - border: 1px solid hsl(var(--hue), 50%, 93%); - border-radius: .25rem; -} - -.new-task-title { - margin-bottom: .25rem; - font-size: 1rem; - font-weight: 700; -} - -.new-task-link { - display: flex; - align-items: flex-end; - justify-content: center; - width: 2.5rem; - font-size: 1.2rem; - background: hsl(var(--hue), 50%, 93%); -} - -.new-task-caption { - display: box; - margin: 0; - overflow: hidden; - font-size: .875rem; - /* stylelint-disable */ - box-orient: vertical; - /* stylelint-enable */ - -webkit-line-clamp: 3; -} - -.new-task-details { - flex: 1 0; - padding: 1rem; -} - -.new-task * { - transition: all .25s ease; -} - -.new-task:hover .new-task-link { - background: var(--template-bg-dark); -} - -.new-task-link span { - margin-bottom: 10px; - color: hsl(var(--hue), 30%, 40%); -} - -.new-task:hover .new-task-link span { - color: #fff; -} - -.new-tasks .card-columns { - grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; -} diff --git a/build/media_source/com_scheduler/joomla.asset.json b/build/media_source/com_scheduler/joomla.asset.json index 4908ee88b07b6..0a02038b91012 100644 --- a/build/media_source/com_scheduler/joomla.asset.json +++ b/build/media_source/com_scheduler/joomla.asset.json @@ -38,11 +38,6 @@ "type": "module" } }, - { - "name": "com_scheduler.admin-view-select-task-css", - "type": "style", - "uri": "com_scheduler/admin-view-select-task.css" - }, { "name": "com_scheduler.admin-view-task-css", "type": "style", diff --git a/build/media_source/com_scheduler/js/admin-view-select-task-search.es6.js b/build/media_source/com_scheduler/js/admin-view-select-task-search.es6.js index 169fc0d58eda4..659811db96fc9 100644 --- a/build/media_source/com_scheduler/js/admin-view-select-task-search.es6.js +++ b/build/media_source/com_scheduler/js/admin-view-select-task-search.es6.js @@ -62,7 +62,7 @@ if (elSearch && elSearchContainer) { } const cardHeader = card.querySelector('.new-task-title'); - const cardBody = card.querySelector('.card-body'); + const cardBody = card.querySelector('.new-task-caption'); const title = cardHeader ? cardHeader.textContent : ''; const description = cardBody ? cardBody.textContent : ''; diff --git a/build/media_source/plg_behaviour_compat/removed.asset.json b/build/media_source/plg_behaviour_compat/removed.asset.json new file mode 100644 index 0000000000000..2255caad1a967 --- /dev/null +++ b/build/media_source/plg_behaviour_compat/removed.asset.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json", + "name": "plg_behaviour_compat", + "version": "5.0.0", + "description": "Joomla CMS Removed Assets b/c entries, the entries are only placeholders without functionality.", + "license": "GPL-2.0-or-later", + "assets": [ + { + "name": "com_scheduler.admin-view-select-task-css", + "type": "style", + "deprecated": true, + "uri": "" + } + ] +} diff --git a/build/media_source/templates/administrator/atum/scss/pages/_com_scheduler.scss b/build/media_source/templates/administrator/atum/scss/pages/_com_scheduler.scss new file mode 100644 index 0000000000000..84c508e42e11a --- /dev/null +++ b/build/media_source/templates/administrator/atum/scss/pages/_com_scheduler.scss @@ -0,0 +1,75 @@ +.new-tasks { + // We use the same colours for the new task section as we do for the quickicons. + --text-color: var(--template-quickicon-color); + --bg-color: hsl(var(--hue), 60%, 97%); + --bg-color-hvr: var(--template-bg-dark); + --icon-color: var(--template-quickicon-color); + --icon-color-hvr: hsl(var(--hue), 50%, 93%); + + .card-columns { + grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); + } +} + +@if $enable-dark-mode { + @include color-mode(dark) { + .new-tasks { + --bg-color: var(--template-bg-dark-80); + --bg-color-hvr: var(--template-bg-dark-65); + --icon-color: var(--template-bg-dark-80); + --icon-color-hvr: var(--template-quickicon-color); + } + } +} + +.new-task { + display: flex; + overflow: hidden; + color: var(--text-color); + background-color: var(--bg-color); + border: 1px solid hsl(var(--hue), 50%, 93%); + border-radius: $border-radius; + + * { + transition: all .25s ease; + } + + &-details { + flex: 1 0; + padding: 1rem; + } + + &-title { + margin-bottom: .25rem; + font-size: 1rem; + font-weight: 700; + } + + &-caption { + display: flex; + margin: 0; + font-size: .875rem; + } + + &-link { + display: flex; + align-items: flex-end; + justify-content: center; + width: 2.5rem; + font-size: 1.2rem; + background: hsl(var(--hue), 50%, 93%); + + span { + margin-bottom: 10px; + color: var(--icon-color); + } + + .new-task:hover & { + background: var(--bg-color-hvr); + + span { + color: var(--icon-color-hvr); + } + } + } +} diff --git a/build/media_source/templates/administrator/atum/scss/template.scss b/build/media_source/templates/administrator/atum/scss/template.scss index cfea6d3ee19e2..59ca1f775a069 100644 --- a/build/media_source/templates/administrator/atum/scss/template.scss +++ b/build/media_source/templates/administrator/atum/scss/template.scss @@ -73,6 +73,7 @@ @import "pages/com_modules"; @import "pages/com_tags"; @import "pages/com_privacy"; +@import "pages/com_scheduler"; @import "pages/com_templates"; @import "pages/com_users"; diff --git a/plugins/behaviour/compat/compat.xml b/plugins/behaviour/compat/compat.xml index d0bdedf5a55ef..18be372ba8497 100644 --- a/plugins/behaviour/compat/compat.xml +++ b/plugins/behaviour/compat/compat.xml @@ -45,6 +45,18 @@ + + + + diff --git a/plugins/behaviour/compat/src/Extension/Compat.php b/plugins/behaviour/compat/src/Extension/Compat.php index 94fbdb78fff6c..7d6d11142baa1 100644 --- a/plugins/behaviour/compat/src/Extension/Compat.php +++ b/plugins/behaviour/compat/src/Extension/Compat.php @@ -98,5 +98,16 @@ public function onAfterInitialiseDocument(AfterInitialiseDocumentEvent $event) ->getRegistry() ->addRegistryFile('media/plg_behaviour_compat/es5.asset.json'); } + /** + * Load the removed assets stubs, they are needed if an extension + * directly uses a core asset from Joomla 4 which is not present in Joomla 5+ + * and only provides an empty asset to not throw an exception + */ + if ($this->params->get('removed_asset', '1')) { + $event->getDocument() + ->getWebAssetManager() + ->getRegistry() + ->addRegistryFile('media/plg_behaviour_compat/removed.asset.json'); + } } }