Release of v5.1.1-alpha5
Refactor initialization flow to accommodate future scalability and integration with all designated areas. Refactor the Creator Builders class. Refactor the FieldString and FieldXML classes.
This commit is contained in:
131
admin/layouts/powerselectiontable.php
Normal file
131
admin/layouts/powerselectiontable.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
$table_id = $displayData['id'] ?? 'power_selection_table';
|
||||
$headers = $displayData['headers'] ?? ['error'];
|
||||
$default_items_number = 10;
|
||||
$unique_name = '';
|
||||
|
||||
?>
|
||||
<?php echo LayoutHelper::render(
|
||||
'table',
|
||||
[
|
||||
'id' => $table_id,
|
||||
'table_class' => 'table table-striped',
|
||||
'table_container_class' => 'power-selection-table-container',
|
||||
'name' => Text::_('COM_COMPONENTBUILDER_MAKE_YOUR_SELECTION'),
|
||||
'headers' => $headers,
|
||||
'items' => 10,
|
||||
'default_items_number' => $default_items_number,
|
||||
'init' => false
|
||||
]
|
||||
); ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var selectedPowerItems = [];
|
||||
var targetPowerRepoUrl = '';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let <?php echo $table_id; ?> = new DataTable('#<?php echo $table_id; ?>', {
|
||||
responsive: true,
|
||||
paging: false,
|
||||
order: [[ 0, "asc" ]],
|
||||
scrollY: 450,
|
||||
select: {
|
||||
style: 'multi+shift',
|
||||
selector: 'tr:not(.no-select)'
|
||||
},
|
||||
info: false,
|
||||
columnDefs: [
|
||||
{ 'targets': [ -1 ], 'visible': false, 'searchable': false },
|
||||
{ responsivePriority: 1, targets: 1 },
|
||||
{ responsivePriority: 2, targets: -3 }
|
||||
],
|
||||
columns: [<?php foreach($headers as $header): ?><?php if ($header === 'path'): ?>
|
||||
{
|
||||
data: 'path',
|
||||
render: function(data, type) {
|
||||
if (type === 'display') {
|
||||
return '<a href="' + targetPowerRepoUrl + data + '" target="_blank">' + data + '</a>'
|
||||
}
|
||||
return data;
|
||||
}
|
||||
},<?php else: ?>
|
||||
{
|
||||
data: '<?php echo $header; ?>'
|
||||
},<?php endif; ?><?php endforeach; ?>
|
||||
],
|
||||
createdRow: function(row, data, dataIndex) {
|
||||
if (data.local === true) {
|
||||
row.classList.add('no-select');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// start the initialization manager
|
||||
const initManager = new InitializationManager();
|
||||
|
||||
// Add selected rows to global array
|
||||
<?php echo $table_id; ?>.on('select', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
let data = <?php echo $table_id; ?>.rows(indexes).data();
|
||||
initManager.addSelectedItems(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove deselected rows from global array
|
||||
<?php echo $table_id; ?>.on('deselect', function (e, dt, type, indexes) {
|
||||
if (type === 'row') {
|
||||
let data = <?php echo $table_id; ?>.rows(indexes).data();
|
||||
initManager.removeSelectedItems(data);
|
||||
}
|
||||
});
|
||||
|
||||
<?php echo $table_id; ?>.on('draw', function () {
|
||||
selectedPowerItems = [];
|
||||
});
|
||||
});
|
||||
|
||||
function drawPowerSelectionTable<?php echo $unique_name; ?>() {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function clearPowerSelectionTable<?php echo $unique_name; ?>() {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
// Clear the table
|
||||
table.clear();
|
||||
// Draw the table
|
||||
table.draw(true);
|
||||
}
|
||||
|
||||
function buildPowerSelectionTable<?php echo $unique_name; ?>(items) {
|
||||
let table = new jQuery.fn.dataTable.Api('#<?php echo $table_id; ?>');
|
||||
// clear the table
|
||||
table.clear();
|
||||
// load the new items
|
||||
table.rows.add(getArrayFormat(items));
|
||||
// Draw the table
|
||||
table.draw(true);
|
||||
}
|
||||
</script>
|
59
admin/layouts/reposelectioncardbody.php
Normal file
59
admin/layouts/reposelectioncardbody.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper as Html;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
|
||||
// No direct access to this file
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
$base = $displayData['repo']->base ?? null;
|
||||
$path = $displayData['repo']->path ?? null;
|
||||
$url = "#";
|
||||
if (!empty($base) && !empty($path))
|
||||
{
|
||||
$url = "{$base}/{$path}";
|
||||
}
|
||||
$name = $displayData['name'] ?? 'error';
|
||||
$area = $displayData['area'] ?? 'error';
|
||||
$organisation = $displayData['repo']->organisation ?? 'error';
|
||||
$repository = $displayData['repo']->repository ?? 'error';
|
||||
$read_branch = $displayData['repo']->read_branch ?? 'error';
|
||||
$guid = $displayData['repo']->guid ?? 'error';
|
||||
|
||||
?>
|
||||
<div>
|
||||
<div class="uk-card repo-selection-card">
|
||||
<div class="uk-card-header">
|
||||
<?php echo $name; ?>: <a class="uk-link-heading" href="<?php echo $url; ?>" target="_blank" title="<?php echo Text::sprintf('COM_COMPONENTBUILDER_OPEN_THIS_REMOTE_S_REPOSITORY', $name); ?>"><?php echo $url; ?></a>
|
||||
</div>
|
||||
<div class="uk-card-body">
|
||||
<ul class="uk-list uk-list-disc">
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_ORGANISATION'); ?>: <code><?php echo $organisation; ?></code></li>
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_REPOSITORY'); ?>: <code><?php echo $repository; ?></code></li>
|
||||
<li><?php echo Text::_('COM_COMPONENTBUILDER_BRANCH'); ?>: <code><?php echo $read_branch; ?></code></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="uk-card-footer">
|
||||
<button type="button"
|
||||
class="uk-button uk-button-primary uk-width-1-1 select-repo-to-initialize"
|
||||
data-repo="<?php echo $guid; ?>"
|
||||
data-area="<?php echo $area; ?>">
|
||||
<?php echo Text::sprintf('COM_COMPONENTBUILDER_LOAD_ITEMS_FROM_THIS_S_REPOSITORY', $name); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user