Feature/ajax Save Ux#26
Merged
Merged
Conversation
Replace outdated scc_ prefix references with warder_ throughout CLAUDE.md, update the PHP layer section to reflect the actual file and function names, expand the settings structure, and correct the Composer package name. Rewrite docs/architecture-plan.md to accurately describe current state, adopt AJAX save as the single recommended approach for Phase 1, add a Phase 2 for extracting inline admin JS to a file, and incorporate relevant WordPress.org plugin guideline references (Guidelines 4, 7, 8, 11, 13).
Add warder_ajax_save_settings() AJAX handler that verifies the nonce and capability, runs input through the existing warder_validate_options(), and returns a JSON success/error response so the page never reloads on save. Extract the inline $admin_js heredoc to assets/js/admin.js and enqueue it as a proper script handle (warder-admin) with a jquery dependency. Add the WARDER_VERSION constant and use wp_localize_script to pass the ajaxurl and translated button-label strings (warderAdmin.save / warderAdmin.saving) instead of hardcoding them. The no-JS fallback via options.php is preserved.
The welcome notice on other admin pages now checks for the presence of warder_options_last_updated before rendering. This option is written on every settings save, so the notice disappears automatically after the first save and does not keep appearing site-wide (WP.org Guideline 11).
The main form's submit handler was firing for the add-cookie submit button (which uses form= to target a separate form), preventing is_regex and other add-cookie fields from reaching PHP. Co-Authored-By: Jasper Frumau <jasper@imagewize.com>
Co-Authored-By: Jasper Frumau <jasper@imagewize.com>
Co-Authored-By: Jasper Frumau <jasper@imagewize.com>
…OST notice The add-cookie container was nested inside #warder-main-settings-form, requiring the HTML5 `form` attribute to associate inputs with a hidden target form. Browsers handle `display:none` target forms inconsistently, causing the checkbox state to be lost and the AJAX save handler to intercept add-cookie submissions. Moves each add-cookie container (now a full self-contained <form>) to render after the main form in the DOM. Adds a redirect-after-POST in warder_handle_admin_actions() so all cookie/category changes show a success notice via ?warder_notice=saved. Co-Authored-By: Jasper Frumau <jasper@imagewize.com>
… on open - After AJAX save, animate scroll to the inserted notice so it is always visible regardless of current scroll position - When opening an add-cookie form, move its container immediately after the main settings form and scroll to it, keeping it out of the main form's DOM subtree - Scope the submit-button disable/enable to :not([form]) to avoid touching add-cookie submit buttons - Exclude inputs with a `form` attribute from the unsaved-change highlight so the add-cookie checkbox no longer turns yellow Co-Authored-By: Jasper Frumau <jasper@imagewize.com>
Add-cookie containers now render after the main form in PHP and no inputs use the HTML5 form= attribute, so the JS workarounds added when the forms were nested are no longer needed: - Remove the .after() reposition of add-cookie containers - Remove :not([form]) filters from the change-highlight selector - Remove :not([form]) filter from the submit-button lookup
Bump Version/WARDER_VERSION in the main plugin file, Stable tag in readme.txt, version in package.json, and add 1.5.2 entries to CHANGELOG.md and readme.txt (== Changelog == and == Upgrade Notice ==). Also tracks docs/admin-ajax-comparison.md, an analysis of the recent form-nesting issues and modern-plugin AJAX patterns that informed the admin.js cleanup in 0f8d9cd.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This release (1.5.2) introduces an AJAX-driven settings save experience for the Cookie Consent admin page, eliminating full-page reloads when administrators update plugin configuration. The bulk of the change extracts inline admin JavaScript into a dedicated
assets/js/admin.jsmodule that intercepts the settings form submission, posts toadmin-ajax.php, and renders an in-page notice scrolled into view on completion. Add-cookie subforms are now rendered outside the main settings form to prevent nested-form HTML invalidity, with an explicit redirect-after-POST notice surfaced when a cookie row is added. The setup nag notice now self-suppresses once the plugin has been configured, and supporting documentation (docs/admin-ajax-comparison.md,docs/architecture-plan.md) plus a.vibeworkflow config have been added to capture the architectural rationale.Admin UX and AJAX Save Flow:
assets/js/admin.jsimplementing AJAX submission of the settings form with an inline success/error notice that is scrolled into the viewport after save (a7e18db,34452c4).<form>to avoid invalid nested-form markup, and added a redirect-after-POST notice so administrators see confirmation when a new cookie row is created (fb09e7c).0a8f1f7).admin.jsafter the structural fix made them unnecessary (0f8d9cd).Plugin Behavior and PHP Changes:
warder_optionsreflects a configured state, preventing the "please configure" prompt from persisting after first save (5299221).warder-cookie-consent.phpto register the new admin script, expose the AJAX endpoint and nonce, and handle the AJAX save callback alongside the existing settings save path.warder-cookie-consent.php,readme.txt,CHANGELOG.md, andpackage.jsonper the project's versioning policy (924ec17).Documentation and Tooling:
docs/admin-ajax-comparison.mdanddocs/architecture-plan.mdto document the AJAX save design and align the broader architectural plan with the currentwarder_codebase conventions (cc9bb26)..vibe/config.tomland.vibe/prompts/vibe.mdfor project workflow tooling, with.distignoreand.gitattributesupdated to exclude these from distribution builds and Composer/WordPress.org exports (96488f3,ee7b31d).CLAUDE.mdto reflect thewarder_function-prefix conventions and the new admin asset layout.Files Changed:
.distignore(Modified).gitattributes(Modified)CHANGELOG.md(Modified)CLAUDE.md(Modified)package.json(Modified)readme.txt(Modified)warder-cookie-consent.php(Modified).vibe/config.toml(Added).vibe/prompts/vibe.md(Added)assets/js/admin.js(Added)docs/admin-ajax-comparison.md(Added)docs/architecture-plan.md(Added)