Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -340,6 +340,106 @@ class MethodUpdater
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update controller action references in Route() calls and Ajax endpoints
|
||||
* Only processes files in rsx/ directory that are in the manifest
|
||||
*
|
||||
* @param string $class_name Controller class name
|
||||
* @param string $old_action Old action/method name
|
||||
* @param string $new_action New action/method name
|
||||
* @return int Number of files updated
|
||||
*/
|
||||
public function update_controller_action_route_references(string $class_name, string $old_action, string $new_action): int
|
||||
{
|
||||
$updated_count = 0;
|
||||
|
||||
// Get all files from manifest in rsx/ directory
|
||||
$manifest = \App\RSpade\Core\Manifest\Manifest::get_all();
|
||||
|
||||
foreach ($manifest as $relative_path => $metadata) {
|
||||
// Only process files in rsx/ directory
|
||||
if (!str_starts_with($relative_path, 'rsx/')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$extension = $metadata['extension'] ?? '';
|
||||
$file_path = base_path($relative_path);
|
||||
|
||||
if (!file_exists($file_path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$content = file_get_contents($file_path);
|
||||
$updated_content = $content;
|
||||
|
||||
// Apply replacements based on file type
|
||||
if ($extension === 'js' || $extension === 'jqhtml') {
|
||||
// Replace Rsx.Route('CLASS', 'OLD_ACTION'
|
||||
// Pattern matches with optional whitespace between parameters
|
||||
$updated_content = preg_replace(
|
||||
'/\bRsx\.Route\(\s*[\'"]' . preg_quote($class_name, '/') . '[\'"]\s*,\s*[\'"]' . preg_quote($old_action, '/') . '[\'"]/',
|
||||
'Rsx.Route(\'' . $class_name . '\', \'' . $new_action . '\'',
|
||||
$updated_content
|
||||
);
|
||||
}
|
||||
|
||||
if ($extension === 'jqhtml' || $extension === 'blade.php') {
|
||||
// Replace $action="OLD_ACTION" when $controller="CLASS_NAME" is on same line
|
||||
// This uses a callback to check both attributes are present
|
||||
$updated_content = preg_replace_callback(
|
||||
'/^.*$/m',
|
||||
function ($matches) use ($class_name, $old_action, $new_action) {
|
||||
$line = $matches[0];
|
||||
|
||||
// Check if line has both $controller="CLASS_NAME" and $action="OLD_ACTION"
|
||||
$has_controller = preg_match('/\$controller=["\']' . preg_quote($class_name, '/') . '["\']/', $line);
|
||||
$has_action = preg_match('/\$action=["\']' . preg_quote($old_action, '/') . '["\']/', $line);
|
||||
|
||||
if ($has_controller && $has_action) {
|
||||
// Replace the action
|
||||
return preg_replace(
|
||||
'/(\$action=["\'])' . preg_quote($old_action, '/') . '(["\'])/',
|
||||
'$1' . $new_action . '$2',
|
||||
$line
|
||||
);
|
||||
}
|
||||
|
||||
return $line;
|
||||
},
|
||||
$updated_content
|
||||
);
|
||||
}
|
||||
|
||||
if ($extension === 'js') {
|
||||
// Replace Ajax endpoint calls: CLASS.OLD_ACTION(
|
||||
// Pattern: (non-alnum)(CLASS).(METHOD)(non-alnum)
|
||||
$updated_content = preg_replace(
|
||||
'/(?<=[^a-zA-Z0-9_])' . preg_quote($class_name, '/') . '\.' . preg_quote($old_action, '/') . '(?=[^a-zA-Z0-9_])/',
|
||||
$class_name . '.' . $new_action,
|
||||
$updated_content
|
||||
);
|
||||
}
|
||||
|
||||
if ($extension === 'php' || $extension === 'blade.php') {
|
||||
// Replace Rsx::Route('CLASS', 'OLD_ACTION'
|
||||
// Pattern matches with optional whitespace between parameters
|
||||
$updated_content = preg_replace(
|
||||
'/\bRsx::Route\(\s*[\'"]' . preg_quote($class_name, '/') . '[\'"]\s*,\s*[\'"]' . preg_quote($old_action, '/') . '[\'"]/',
|
||||
'Rsx::Route(\'' . $class_name . '\', \'' . $new_action . '\'',
|
||||
$updated_content
|
||||
);
|
||||
}
|
||||
|
||||
// Write if changed
|
||||
if ($updated_content !== $content) {
|
||||
file_put_contents($file_path, $updated_content);
|
||||
$updated_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return $updated_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write file atomically using temp file
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user