fix: [UI] Remove unnecessary prevent default from ListTopBar

pull/8613/head
Jakub Onderka 2022-10-01 13:42:10 +02:00
parent b959b94bbb
commit 5262a40cb9
3 changed files with 17 additions and 20 deletions

View File

@ -1,6 +1,6 @@
<?php
if (!isset($data['requirement']) || $data['requirement']) {
if (!empty($data['onClick']) || empty($data['url'])) {
if (!empty($data['onClick'])) {
$onClickParams = array();
if (!empty($data['onClickParams'])) {
foreach ($data['onClickParams'] as $param) {
@ -15,11 +15,11 @@
$onClick = sprintf(
'onclick="%s%s"',
(empty($data['url'])) ? 'event.preventDefault();' : '',
(!empty($data['onClick']) ? sprintf(
sprintf(
'%s(%s)',
h($data['onClick']),
$onClickParams
) : '')
)
);
}
$dataFields = array();

View File

@ -1,13 +1,13 @@
<?php
if (!isset($data['requirement']) || $data['requirement']) {
$elements = '';
if (!isset($data['requirement']) || $data['requirement']) {
$elements = [];
foreach ($data['children'] as $element) {
$elements .= $this->element('/genericElements/ListTopBar/element_' . (empty($element['type']) ? 'simple' : h($element['type'])), array('data' => $element));
$elements[] = $this->element('/genericElements/ListTopBar/element_' . (empty($element['type']) ? 'simple' : $element['type']), array('data' => $element));
}
echo sprintf(
'<div %s class="btn-group">%s</div>',
(!empty($data['id'])) ? 'id="' . h($data['id']) . '"' : '',
$elements
'<div%s class="btn-group">%s</div>',
(!empty($data['id'])) ? ' id="' . h($data['id']) . '"' : '',
implode('', $elements)
);
}
?>
}

View File

@ -1,10 +1,7 @@
<div class="btn-toolbar" style="margin:0 10px;">
<?php
$groups = '';
foreach ($data['children'] as $group) {
$groups .= $this->element('/genericElements/ListTopBar/group_' . (empty($group['type']) ? 'simple' : h($group['type'])), array('data' => $group));
echo $this->element('/genericElements/ListTopBar/group_' . (empty($group['type']) ? 'simple' : $group['type']), array('data' => $group));
}
echo sprintf(
'<div class="btn-toolbar" style="margin:0px 10px;">%s</div>',
$groups
);
?>
</div>