JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

[6.0] Added possibility to batch remove a tag #609

Open joomlapl-bot opened 2 weeks ago

joomlapl-bot commented 2 weeks ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/40613 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/language/en-GB/lib_joomla.ini b/administrator/language/en-GB/lib_joomla.ini index b940984bcd512..154b38a64382f 100644 --- a/administrator/language/en-GB/lib_joomla.ini +++ b/administrator/language/en-GB/lib_joomla.ini @@ -379,8 +379,11 @@ JLIB_HTML_BATCH_MOVE="Move" JLIB_HTML_BATCH_MOVE_QUESTION="Action to Perform" JLIB_HTML_BATCH_NO_CATEGORY="- Don't copy or move -" JLIB_HTML_BATCH_NOCHANGE="- Keep original Access Levels -" -JLIB_HTML_BATCH_TAG_LABEL="Add Tag" +JLIB_HTML_BATCH_TAG_ADD="Add" +JLIB_HTML_BATCH_TAG_ADDREMOVE_QUESTION="Action to Perform" +JLIB_HTML_BATCH_TAG_LABEL="Add or Remove Tag" JLIB_HTML_BATCH_TAG_NOCHANGE="- Keep original Tags -" +JLIB_HTML_BATCH_TAG_REMOVE="Remove" JLIB_HTML_BATCH_USER_LABEL="Set User." JLIB_HTML_BATCH_USER_NOCHANGE="- Keep original User -" JLIB_HTML_BATCH_USER_NOUSER="No User." diff --git a/build/media_source/layouts/js/joomla/html/batch/batch-tag-addremove.es6.js b/build/media_source/layouts/js/joomla/html/batch/batch-tag-addremove.es6.js new file mode 100644 index 0000000000000..54fa047e18ac2 --- /dev/null +++ b/build/media_source/layouts/js/joomla/html/batch/batch-tag-addremove.es6.js @@ -0,0 +1,42 @@ +/** + * @copyright (C) 2023 Open Source Matters, Inc. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +(() => { + const onSelect = () => { + const batchTag = document.getElementById('batch-tag-id'); + const batchTagAddRemove = document.getElementById('batch-tag-addremove'); + let batchSelector; + + const onChange = () => { + if (!batchSelector.value + || (batchSelector.value && parseInt(batchSelector.value, 10) === 0)) { + batchTagAddRemove.classList.add('hidden'); + } else { + batchTagAddRemove.classList.remove('hidden'); + } + }; + + if (batchTag) { + batchSelector = batchTag; + } + + if (batchTagAddRemove) { + batchTagAddRemove.classList.add('hidden'); + } + + if (batchTagAddRemove) { + batchSelector.addEventListener('change', onChange); + } + + // Cleanup + document.removeEventListener('DOMContentLoaded', onSelect, true); + }; + + // Document loaded + document.addEventListener('DOMContentLoaded', onSelect, true); + + // Joomla updated + document.addEventListener('joomla:updated', onSelect, true); +})(); diff --git a/build/media_source/system/joomla.asset.json b/build/media_source/system/joomla.asset.json index 1eae307baedf8..71dd180f0384d 100644 --- a/build/media_source/system/joomla.asset.json +++ b/build/media_source/system/joomla.asset.json @@ -304,6 +304,14 @@ "defer": true } }, + { + "name": "joomla.batch-tag-addremove", + "type": "script", + "uri": "layouts/joomla/html/batch/batch-tag-addremove.min.js", + "attributes": { + "defer": true + } + }, { "name": "webcomponent.field-fancy-select-legacy", "type": "script", diff --git a/language/en-GB/lib_joomla.ini b/language/en-GB/lib_joomla.ini index 867b99ac71159..0254984502a2f 100644 --- a/language/en-GB/lib_joomla.ini +++ b/language/en-GB/lib_joomla.ini @@ -375,8 +375,11 @@ JLIB_HTML_BATCH_MOVE="Move" JLIB_HTML_BATCH_MOVE_QUESTION="Action to Perform" JLIB_HTML_BATCH_NO_CATEGORY="- Don't copy or move -" JLIB_HTML_BATCH_NOCHANGE="- Keep original Access Levels -" -JLIB_HTML_BATCH_TAG_LABEL="Add Tag" +JLIB_HTML_BATCH_TAG_ADD="Add" +JLIB_HTML_BATCH_TAG_ADDREMOVE_QUESTION="Action to Perform" +JLIB_HTML_BATCH_TAG_LABEL="Add or Remove Tag" JLIB_HTML_BATCH_TAG_NOCHANGE="- Keep original Tags -" +JLIB_HTML_BATCH_TAG_REMOVE="Remove" JLIB_HTML_BATCH_USER_LABEL="Set User." JLIB_HTML_BATCH_USER_NOCHANGE="- Keep original User -" JLIB_HTML_BATCH_USER_NOUSER="No User." diff --git a/layouts/joomla/html/batch/tag.php b/layouts/joomla/html/batch/tag.php index 4112bb222b7fd..ea122fdf50e00 100644 --- a/layouts/joomla/html/batch/tag.php +++ b/layouts/joomla/html/batch/tag.php @@ -10,14 +10,35 @@ defined('_JEXEC') or die; +use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +// Create the add/remove tag options. +$options = [ + HTMLHelper::_('select.option', 'a', Text::_('JLIB_HTML_BATCH_TAG_ADD')), + HTMLHelper::_('select.option', 'r', Text::_('JLIB_HTML_BATCH_TAG_REMOVE')) +]; + +/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ +$wa = Factory::getApplication()->getDocument()->getWebAssetManager(); +$wa->useScript('joomla.batch-tag-addremove'); + ?> -