Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions assets/css/flex-repeater.css
Original file line number Diff line number Diff line change
Expand Up @@ -651,3 +651,18 @@ body.rex-theme-dark .mfr-btn-copy {
max-width: 120px;
}
}

/* ============================================================
Collapse-Icon: rotiert um 180° wenn das Item geöffnet ist
============================================================ */
.mfr-btn-collapse i,
.mfr-btn-nested-toggle i,
.mfr-btn-toggle-all i {
display: inline-block;
transition: transform 180ms ease;
}
.mfr-btn-collapse i.mfr-icon-open,
.mfr-btn-nested-toggle i.mfr-icon-open,
.mfr-btn-toggle-all i.mfr-icon-open {
transform: rotate(180deg);
}
10 changes: 6 additions & 4 deletions assets/js/flex-repeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@

function setCollapseIconState(iconEl, isCollapsed) {
if (!iconEl) return;
iconEl.classList.toggle('fa-square-o', !!isCollapsed);
iconEl.classList.toggle('fa-minus', !isCollapsed);
iconEl.classList.add('fa-caret-square-o-down');
iconEl.classList.remove('fa-square-o', 'fa-minus', 'fa-caret-square-o-up');
iconEl.classList.toggle('mfr-icon-open', !isCollapsed);
}

function flashAndRevealItem(itemEl, center, openBody) {
Expand Down Expand Up @@ -1301,8 +1302,9 @@
this.toggleAllBtns.forEach(function (btn) {
const icon = btn.querySelector('i');
if (icon) {
icon.classList.toggle('fa-square-o', hasCollapsed);
icon.classList.toggle('fa-minus', !hasCollapsed);
icon.classList.add('fa-caret-square-o-down');
icon.classList.remove('fa-square-o', 'fa-minus', 'fa-caret-square-o-up');
icon.classList.toggle('mfr-icon-open', !hasCollapsed);
Comment on lines 1303 to +1307
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/MForm/FlexRepeater/MFormFlexRepeaterRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ private static function renderNestedRepeaterContainer(string $fieldKey, string $
. '<button type="button" class="btn btn-xs mfr-btn-nested-up" title="Nach oben"><i class="rex-icon fa-chevron-up"></i></button>'
. '<button type="button" class="btn btn-xs mfr-btn-nested-down" title="Nach unten"><i class="rex-icon fa-chevron-down"></i></button>'
. '<button type="button" class="btn btn-xs mfr-btn-nested-add-after" title="Hinzufuegen nach diesem Element"><i class="rex-icon fa-plus"></i></button>'
. '<button type="button" class="btn btn-xs mfr-btn-nested-toggle" title="Aufklappen/Zuklappen"><i class="rex-icon fa-square-o"></i></button>'
. '<button type="button" class="btn btn-xs mfr-btn-nested-toggle" title="Aufklappen/Zuklappen"><i class="rex-icon fa-caret-square-o-down"></i></button>'
. '<button type="button" class="btn btn-xs btn-danger mfr-btn-nested-remove" title="Entfernen"><i class="rex-icon fa-trash"></i></button>'
. '</div></div>'
. '<div class="mfr-nested-body mform form-horizontal" style="display:none">%s</div>'
Expand Down
4 changes: 2 additions & 2 deletions lib/MForm/Parser/MFormParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private function openFlexRepeaterElement(MFormItem $item, int|string $key, array
) : '';

$toggleAllButton = sprintf(
'<button type="button" class="btn btn-default mfr-btn-toggle-all" title="%s"><i class="rex-icon fa-square-o"></i> %s</button>',
'<button type="button" class="btn btn-default mfr-btn-toggle-all" title="%s"><i class="rex-icon fa-caret-square-o-down"></i> %s</button>',
htmlspecialchars(rex_i18n::msg('mform_flex_repeater_toggle_all'), ENT_QUOTES),
htmlspecialchars(rex_i18n::msg('mform_flex_repeater_toggle_all'), ENT_QUOTES),
);
Expand All @@ -210,7 +210,7 @@ private function openFlexRepeaterElement(MFormItem $item, int|string $key, array
$this->elements[] = '<div class="mfr-items-list"></div>';

$this->elements[] = sprintf(
'<template class="mfr-item-template"><div class="mfr-item"><div class="mfr-item-header"><span class="mfr-item-drag" title="Verschieben"><i class="rex-icon fa-bars"></i></span><span class="mfr-item-title"></span><div class="mfr-item-actions"><button type="button" class="btn btn-xs mfr-btn-up" title="%s"><i class="rex-icon fa-chevron-up"></i></button><button type="button" class="btn btn-xs mfr-btn-down" title="%s"><i class="rex-icon fa-chevron-down"></i></button><button type="button" class="btn btn-xs mfr-btn-add-after" title="%s"><i class="rex-icon fa-plus"></i></button>%s<button type="button" class="btn btn-xs mfr-btn-visibility" title="%s"><i class="rex-icon fa-eye"></i></button><button type="button" class="btn btn-xs mfr-btn-collapse" title="%s"><i class="rex-icon fa-square-o"></i></button><button type="button" class="btn btn-xs btn-danger mfr-btn-remove" title="%s"><i class="rex-icon fa-trash"></i></button></div></div><div class="mfr-item-body mform form-horizontal">%s</div></div></template>',
'<template class="mfr-item-template"><div class="mfr-item"><div class="mfr-item-header"><span class="mfr-item-drag" title="Verschieben"><i class="rex-icon fa-bars"></i></span><span class="mfr-item-title"></span><div class="mfr-item-actions"><button type="button" class="btn btn-xs mfr-btn-up" title="%s"><i class="rex-icon fa-chevron-up"></i></button><button type="button" class="btn btn-xs mfr-btn-down" title="%s"><i class="rex-icon fa-chevron-down"></i></button><button type="button" class="btn btn-xs mfr-btn-add-after" title="%s"><i class="rex-icon fa-plus"></i></button>%s<button type="button" class="btn btn-xs mfr-btn-visibility" title="%s"><i class="rex-icon fa-eye"></i></button><button type="button" class="btn btn-xs mfr-btn-collapse" title="%s"><i class="rex-icon fa-caret-square-o-down"></i></button><button type="button" class="btn btn-xs btn-danger mfr-btn-remove" title="%s"><i class="rex-icon fa-trash"></i></button></div></div><div class="mfr-item-body mform form-horizontal">%s</div></div></template>',
htmlspecialchars(rex_i18n::msg('mform_flex_repeater_move_up'), ENT_QUOTES),
htmlspecialchars(rex_i18n::msg('mform_flex_repeater_move_down'), ENT_QUOTES),
htmlspecialchars($btnText, ENT_QUOTES),
Expand Down
Loading