diff --git a/administrator/components/com_content/tmpl/articles/default.php b/administrator/components/com_content/tmpl/articles/default.php index 5645f3c3323ad..28dcae889ee18 100644 --- a/administrator/components/com_content/tmpl/articles/default.php +++ b/administrator/components/com_content/tmpl/articles/default.php @@ -57,24 +57,9 @@ $workflow_featured = false; if ($workflow_enabled) : -// @todo move the script to a file - $js = <<getRegistry()->addExtensionRegistryFile('com_workflow'); $wa->useScript('com_workflow.admin-items-workflow-buttons') - ->addInlineScript($js, [], ['type' => 'module']); + ->useScript('com_content.articles-status'); $workflow_state = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article'); $workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article'); diff --git a/administrator/components/com_content/tmpl/featured/default.php b/administrator/components/com_content/tmpl/featured/default.php index d0f9714e2494b..8aff2eb661e2c 100644 --- a/administrator/components/com_content/tmpl/featured/default.php +++ b/administrator/components/com_content/tmpl/featured/default.php @@ -58,24 +58,9 @@ $workflow_featured = false; if ($workflow_enabled) : -// @todo move the script to a file - $js = <<getRegistry()->addExtensionRegistryFile('com_workflow'); $wa->useScript('com_workflow.admin-items-workflow-buttons') - ->addInlineScript($js, [], ['type' => 'module']); + ->useScript('com_content.articles-status'); $workflow_state = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article'); $workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article'); diff --git a/build/media_source/com_content/joomla.asset.json b/build/media_source/com_content/joomla.asset.json index af995ea1c937f..695bcab967809 100644 --- a/build/media_source/com_content/joomla.asset.json +++ b/build/media_source/com_content/joomla.asset.json @@ -166,6 +166,29 @@ "attributes": { "type": "module" } + }, + { + "name": "com_content.articles-status.es5", + "type": "script", + "uri": "com_content/articles-status-es5.min.js", + "dependencies": [ + "core" + ], + "attributes": { + "nomodule": true, + "defer": true + } + }, + { + "name": "com_content.articles-status", + "type": "script", + "uri": "com_content/articles-status.min.js", + "dependencies": [ + "com_content.articles-status.es5" + ], + "attributes": { + "type": "module" + } } ] } diff --git a/build/media_source/com_content/js/articles-status.es6.js b/build/media_source/com_content/js/articles-status.es6.js new file mode 100644 index 0000000000000..61d836fb47798 --- /dev/null +++ b/build/media_source/com_content/js/articles-status.es6.js @@ -0,0 +1,18 @@ +/** + * @copyright (C) 2022 Open Source Matters, Inc. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +(function () { + 'use strict'; + + document.addEventListener('DOMContentLoaded', () => { + const elements = [].slice.call(document.querySelectorAll('.article-status')); + + elements.forEach((element) => { + element.addEventListener('click', (event) => { + event.stopPropagation(); + }); + }); + }); +}());