From 393479280f90010ff6477b9b12bc5e993b1ad0d5 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Oct 2025 04:44:11 +0000 Subject: [PATCH] Update documentation to show Rsx.Route() pattern for Ajax calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../Rules/JavaScript/DirectAjaxApi_CodeQualityRule.php | 2 +- app/RSpade/Core/Ajax/CLAUDE.md | 4 +++- app/RSpade/man/bundle_api.txt | 4 +++- app/RSpade/man/controller.txt | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/RSpade/CodeQuality/Rules/JavaScript/DirectAjaxApi_CodeQualityRule.php b/app/RSpade/CodeQuality/Rules/JavaScript/DirectAjaxApi_CodeQualityRule.php index eeb95c094..25de967d3 100755 --- a/app/RSpade/CodeQuality/Rules/JavaScript/DirectAjaxApi_CodeQualityRule.php +++ b/app/RSpade/CodeQuality/Rules/JavaScript/DirectAjaxApi_CodeQualityRule.php @@ -39,7 +39,7 @@ class DirectAjaxApi_CodeQualityRule extends CodeQualityRule_Abstract * Should use: * await Controller.action(params) * Or: - * await Ajax.call('Controller', 'action', params) + * await Ajax.call(Rsx.Route('Controller', 'action'), params) */ public function check(string $file_path, string $contents, array $metadata = []): void { diff --git a/app/RSpade/Core/Ajax/CLAUDE.md b/app/RSpade/Core/Ajax/CLAUDE.md index 45e58d2b6..b28d7db28 100755 --- a/app/RSpade/Core/Ajax/CLAUDE.md +++ b/app/RSpade/Core/Ajax/CLAUDE.md @@ -88,11 +88,13 @@ Behind the scenes, the stub translates to: ```javascript class Demo_Index_Controller { static async hello_world(...args) { - return Ajax.call('Demo_Index_Controller', 'hello_world', args); + return Ajax.call(Rsx.Route('Demo_Index_Controller', 'hello_world'), args); } } ``` +Note: `Rsx.Route()` generates type-safe URLs like `/_ajax/Demo_Index_Controller/hello_world`. + ### Response Format Success responses: diff --git a/app/RSpade/man/bundle_api.txt b/app/RSpade/man/bundle_api.txt index 0017ae543..9c44eb37d 100755 --- a/app/RSpade/man/bundle_api.txt +++ b/app/RSpade/man/bundle_api.txt @@ -269,10 +269,12 @@ JAVASCRIPT STUBS // Automatically included in bundles class User_Controller { static async get_profile(...args) { - return Ajax.call('User_Controller', 'get_profile', args); + return Ajax.call(Rsx.Route('User_Controller', 'get_profile'), args); } } + Note: Rsx.Route() generates type-safe URLs like /_ajax/User_Controller/get_profile + Models with fetch() methods get stubs: class User_Model { static async fetch(id) { diff --git a/app/RSpade/man/controller.txt b/app/RSpade/man/controller.txt index 5605016fa..523bd92d8 100755 --- a/app/RSpade/man/controller.txt +++ b/app/RSpade/man/controller.txt @@ -248,12 +248,14 @@ JAVASCRIPT STUB GENERATION class User_Controller { static async search(...args) { - return Ajax.call('User_Controller', 'search', args); + return Ajax.call(Rsx.Route('User_Controller', 'search'), args); } } Stubs included automatically in bundles. + Note: Rsx.Route() generates type-safe URLs like /_ajax/User_Controller/search + CALLING API METHODS From JavaScript: // Single argument