I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.
Summary of Changes
This PR improves the publish/unpublish workflow for Articles and Featured lists by adding AJAX support. Users can now toggle statuses instantly without a full page reload, while the existing non-JavaScript redirect behavior is fully preserved for backward compatibility.
Added JSON response handling in publish() in ArticlesController.php without changing the default redirect flow for non-JSON requests.
Implemented an AJAX-based status toggle in articles-status.es6.js that:
- Intercepts clicks on the publish/unpublish icons
- Sends requests asynchronously with CSRF protection
- Updates the icon, tooltip, and row state immediately
- Displays success or error feedback messages
- Falls back to normal form submission if AJAX fails
Integrated the status script into the Articles list view.
Ensured Featured list behaves the same way:
- Loaded the same script in the Featured list view
- Extended JS logic to handle both articles.* and featured.* publish tasks
Updated publish() in FeaturedController.php to avoid overriding redirects for JSON requests, ensuring proper AJAX handling.
Testing Instructions
Open Administrator --> Content --> Articles
Click the publish/unpublish icon on any row
Confirm the status updates immediately without a page reload
Check that success/error messages appear as expected
Repeat steps 1–4 in Administrator --> Content --> Featured Articles
Disable JavaScript (or simulate JS failure), trigger publish/unpublish, and confirm the normal submit/redirect flow still works
Verify that no PHP syntax errors exist in the modified files
Actual result BEFORE applying this Pull Request
Clicking publish/unpublish triggered a full page reload
No AJAX handling was available for status toggles in Articles or Featured lists
Expected result AFTER applying this Pull Request
Publish/unpublish actions are handled via AJAX without page reload
UI updates instantly and shows feedback messages
Non-JavaScript workflow remains fully functional
Behavior is consistent across both Articles and Featured lists
Link to documentations
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
I have Fixed the CI failure by removing the deprecated getErrors() call in ArticlesController::publish(). All 52 checks are now passing. Ready for review..
@SRV-KILLER09 Please check https://github.com/joomla/joomla-cms?tab=readme-ov-file#which-branch-should-my-pull-request-target . As this PR here is not a bug fix, it counts as new feature and so should be made for the 6.2-dev branch.