Skip to content

Commit

Permalink
Batch: fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Nov 9, 2023
1 parent ea49f20 commit d93f520
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ protected function addToolbar()
// Add a batch button
if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state')) {
$childBar->popupButton('batch', 'JTOOLBAR_BATCH')
->selector('collapseModal')
->popupType('inline')
->textHeader(Text::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'))
->url('#joomla-dialog-batch')
->modalWidth('800px')
->modalHeight('fit-content')
->listCheck(true);
}
}
Expand Down
10 changes: 1 addition & 9 deletions administrator/components/com_fields/tmpl/fields/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,7 @@
&& $user->authorise('core.edit', $component)
&& $user->authorise('core.edit.state', $component)
) : ?>
<?php echo HTMLHelper::_(
'bootstrap.renderModal',
'collapseModal',
[
'title' => Text::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'),
'footer' => $this->loadTemplate('batch_footer')
],
$this->loadTemplate('batch_body')
); ?>
<template id="joomla-dialog-batch"><?php echo $this->loadTemplate('batch_body'); ?></template>
<?php endif; ?>
<?php endif; ?>
<input type="hidden" name="task" value="">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,8 @@
</div>
</div>
</div>
<div class="btn-toolbar p-3">
<joomla-toolbar-button task="field.batch" class="ms-auto">
<button type="button" class="btn btn-success"><?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?></button>
</joomla-toolbar-button>
</div>

This file was deleted.

16 changes: 10 additions & 6 deletions build/media_source/com_fields/js/admin-fields-default-batch.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
document.addEventListener('DOMContentLoaded', () => {
'use strict';
const setUp = (container) => {
const batchSelector = container.getElementById('batch-group-id');
const batchCopyMove = container.getElementById('batch-copy-move');

const batchSelector = document.getElementById('batch-group-id');
const batchCopyMove = document.getElementById('batch-copy-move');
batchCopyMove.classList.add('hidden');
if (!container || !batchCopyMove) {
return;
}

batchCopyMove.classList.add('hidden');
batchSelector.addEventListener('change', () => {
if (batchSelector.value === 'nogroup' || batchSelector.value !== '') {
batchCopyMove.classList.remove('hidden');
} else {
batchCopyMove.classList.add('hidden');
}
}, false);
});
};
document.addEventListener('DOMContentLoaded', () => setUp(document));
document.addEventListener('joomla:loaded', ({ target }) => setUp(target));

0 comments on commit d93f520

Please sign in to comment.