Skip to content

FlexRepeater: rotating caret icon for collapse state#430

Closed
danspringer wants to merge 1 commit into
FriendsOfREDAXO:mainfrom
danspringer:feature/repeater-collapse-icon-rotation
Closed

FlexRepeater: rotating caret icon for collapse state#430
danspringer wants to merge 1 commit into
FriendsOfREDAXO:mainfrom
danspringer:feature/repeater-collapse-icon-rotation

Conversation

@danspringer

@danspringer danspringer commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

Makes the FlexRepeater's collapse/expand button visually obvious by replacing the previous fa-square-ofa-minus icon toggle with a single fa-caret-square-o-down icon that rotates 180° when the item is open.

The old empty-square vs. minus combination was hard to read as an expand/collapse affordance — the caret direction makes the state obvious at a glance, and the CSS transition adds a smooth flip animation between states.

Affects three buttons:

  • mfr-btn-collapse (top-level item)
  • mfr-btn-nested-toggle (nested repeater item)
  • mfr-btn-toggle-all (toolbar)

Before

  • Collapsed: empty square (fa-square-o)
  • Expanded: minus sign (fa-minus)

After

  • Collapsed: caret-square pointing down
  • Expanded: caret-square rotated 180° (smooth transition)

Changes

  • PHPMFormParser.php (item template + toggle-all) and MFormFlexRepeaterRenderer.php (nested toggle): initial icon class changed to fa-caret-square-o-down.
  • JSsetCollapseIconState() and the toggle-all updater now keep the caret icon fixed and only toggle a .mfr-icon-open state class on the <i> element. They also clean up legacy fa-square-o / fa-minus classes if present in already-rendered markup, so existing pages re-render correctly after upgrade.
  • CSS — new .mfr-icon-open rule in flex-repeater.css rotates the icon 180° with a 180ms ease transition.

Test plan

  • Open a module with a FlexRepeater (top-level and nested) and verify the caret icon points down when collapsed, up (rotated) when expanded.
  • Click the "Toggle all" toolbar button and verify the icon flips in sync with the items.
  • Hard-reload the backend after upgrading to make sure no stale fa-square-o / fa-minus classes remain.
  • Dark-mode visual check.

🤖 Generated with Claude Code

Summary by CodeRabbit

Style

  • Verbesserte Icon-Animationen: Collapse- und Expand-Icons rotieren nun smooth mit einer 180°-Animation beim Umschalten zwischen geöffneten und geschlossenen Zuständen.
  • Aktualisierte Icon-Darstellung: Das Icon-Design für Toggle-Kontrollen wurde überarbeitet, um eine bessere visuelle Konsistenz zu bieten.

Review Change Stack

Replaces the previous fa-square-o / fa-minus toggle on the item-collapse,
nested-toggle and toggle-all buttons with a single fa-caret-square-o-down
icon that rotates 180° via CSS when the item is open. The caret direction
makes the expand/collapse affordance obvious at a glance (compared to the
hard-to-read empty-square vs. minus combination) and the rotation gives a
smooth visual transition between states.

- PHP: initial icon class changed in MFormParser (template + toggle-all)
  and MFormFlexRepeaterRenderer (nested toggle).
- JS: setCollapseIconState() and the toggle-all updater now keep the
  caret icon fixed and only toggle a `mfr-icon-open` state class.
  Also cleans up legacy `fa-square-o` / `fa-minus` classes if present,
  so existing markup re-renders correctly after upgrade.
- CSS: `.mfr-icon-open` rotates the caret 180° with a 180ms transition.
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a5f27791-d74d-4071-a21c-c732cb55a969

📥 Commits

Reviewing files that changed from the base of the PR and between 55cc123 and 6009b58.

📒 Files selected for processing (4)
  • assets/css/flex-repeater.css
  • assets/js/flex-repeater.js
  • lib/MForm/FlexRepeater/MFormFlexRepeaterRenderer.php
  • lib/MForm/Parser/MFormParser.php

Walkthrough

Moin! Diese PR aktualisiert die visuelle Darstellung von Collapse- und Toggle-Icons in der Flex-Repeater-Komponente durchgehend: Das FontAwesome-Icon wechselt von fa-square-o zu fa-caret-square-o-down, die JavaScript-Zustandsverwaltung wird angepasst und eine CSS-Rotationsanimation für das geöffnet-Zustand hinzugefügt.

Changes

Flex Repeater Icon Visual Update

Layer / File(s) Summary
Icon-Klassen in Templates und Parser
lib/MForm/Parser/MFormParser.php, lib/MForm/FlexRepeater/MFormFlexRepeaterRenderer.php
FontAwesome-Icon-Klasse fa-square-o wird in allen Template-Ausgabepunkten durch fa-caret-square-o-down ersetzt: Toggle-All-Button, Repeater-Item-Collapse-Button und Nested-Repeater-Container.
JavaScript Icon-Zustandsverwaltung
assets/js/flex-repeater.js
setCollapseIconState() und _updateToggleAllButton() ändern die Klassenverwaltungslogik: Die neue Klasse wird explizit hinzugefügt, alte Klassen (fa-square-o, fa-minus, fa-caret-square-o-up) werden entfernt und mfr-icon-open wird zustandsabhängig getoggelt.
CSS Rotationsanimation
assets/css/flex-repeater.css
Neue CSS-Regeln für Icon-Rotation: i-Elemente in den Collapse-/Toggle-Button-Klassen erhalten eine transform-Transition und rotieren um 180° bei mfr-icon-open-Klasse.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • FriendsOfREDAXO/mform#400: Beide PRs berühren MFormParser::openFlexRepeaterElement() und die Flex-Repeater-Initialisierung mit unterschiedlichen Aspekten (Icon-Klassen vs. Default-Optionen).
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Der Titel beschreibt präzise die Hauptänderung: Das Ersetzen des Umschalter-Icons durch ein rotierendes Caret-Icon in der FlexRepeater-Komponente.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the FlexRepeater collapse/expand affordance by switching to a single caret-square icon and indicating the open state via a 180° rotation, improving visual clarity across top-level, nested, and “toggle all” controls.

Changes:

  • Update PHP-rendered button markup to use fa-caret-square-o-down as the base icon.
  • Adjust JS icon updates to keep the caret icon class fixed and toggle a state class (.mfr-icon-open), while cleaning up legacy fa-square-o / fa-minus.
  • Add CSS to animate icon rotation via transform with a short transition.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lib/MForm/Parser/MFormParser.php Switches FlexRepeater item template + toggle-all button icon to caret-square-down.
lib/MForm/FlexRepeater/MFormFlexRepeaterRenderer.php Switches nested repeater toggle icon to caret-square-down.
assets/js/flex-repeater.js Updates icon state handling to toggle .mfr-icon-open and remove legacy FA classes.
assets/css/flex-repeater.css Adds rotation + transition rules for collapse/toggle icons when open.

Comment on lines 1303 to +1307
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);
@skerbis

skerbis commented May 27, 2026

Copy link
Copy Markdown
Member

Das hatte ich schon probiert und empfand es auch als irreführend und verwechselbar mit den positions Pfeilen

@danspringer

Copy link
Copy Markdown
Member Author

ich finde das jetzige Icon (fa-square-o) sieht aus wie ein nicht geladenes font-icon

@skerbis

skerbis commented May 27, 2026

Copy link
Copy Markdown
Member
Bildschirmfoto 2026-05-27 um 20 23 24 wird so aussehen aber danke für den stups

@skerbis skerbis closed this May 27, 2026
@danspringer danspringer deleted the feature/repeater-collapse-icon-rotation branch May 27, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants