-
Notifications
You must be signed in to change notification settings - Fork 154
enhance: warning message for empty field options #1760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
enhance: warning message for empty field options #1760
Conversation
WalkthroughThis PR updates the form builder UI by replacing loader indicators with a localized empty-state message when no field is being edited, and ensures the editing field ID is cleared when a field is deleted. It also adds the corresponding i18n string key. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
assets/js/wpuf-form-builder.js (1)
404-408: Clearediting_field_idafter top‑level field deletionResetting
state.editing_field_idto0here avoids leaving the options panel logically pointing at a deleted field and aligns with the new empty‑state message behavior. You might optionally mirror this indelete_repeat_inner_field_elementanddelete_column_field_elementfor consistency when nested fields are removed, but it isn’t strictly required.admin/form-builder/assets/js/form-builder.js (1)
404-408: Keep builder state clean after delete in admin entrypointMatching the other builder script, clearing
state.editing_field_idto0after deleting a field prevents stale selections and supports the empty field‑options state. Good to keep both implementations consistent.includes/Admin/Forms/Admin_Form_Builder.php (1)
319-351: Wire up i18n string for empty field‑options stateAdding
empty_field_options_msghere cleanly supports the new empty‑state copy used in the Vue templates and keeps everything localized. The wording is serviceable; any further copy tweaks would just be UX polish.Separately, this file (and the PR overall) only affects the form‑builder UI; it doesn’t appear to touch product‑category handling in notifications, so if issue
#1016is about “Missing product cat” in emails, that likely still needs a separate fix or explicit confirmation.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
admin/form-builder/assets/js/components/field-options/template.php(1 hunks)admin/form-builder/assets/js/form-builder.js(1 hunks)admin/form-builder/views/form-builder-v4.1.php(1 hunks)assets/js-templates/form-components.php(1 hunks)assets/js/wpuf-form-builder.js(1 hunks)includes/Admin/Forms/Admin_Form_Builder.php(1 hunks)
🔇 Additional comments (3)
admin/form-builder/views/form-builder-v4.1.php (1)
179-179: No behavioral change in layout wrapperThis looks like a whitespace-only adjustment to the closing container; DOM structure and behavior remain unchanged.
admin/form-builder/assets/js/components/field-options/template.php (1)
2-4: Use localized guidance instead of a loader when no field is selectedSwapping the spinner/placeholder for
{{ i18n.empty_field_options_msg }}gives users a clear instruction in the empty state while preserving the wrapper andtext-centerclass that existing JS checks rely on. Nicely scoped UX improvement.assets/js-templates/form-components.php (1)
510-513: Align template empty‑state with shared i18n messageThis template now matches the component version by rendering
i18n.empty_field_options_msgin the empty state, which keeps the different builder variants consistent and fully localized.
fixes #1016
Summary
This PR improves the form builder UX by replacing the loading spinner with a clear instructional message when there is no field in the form builder editing panel. Users now see helpful guidance instead of a generic loader.
Summary by CodeRabbit
Bug Fixes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.