Adds ability to exclude components from specific: - Categories (by slug or term_id) - Post/Page IDs - URL patterns (substring or regex) Architecture: - Domain: Value Objects (CategoryExclusion, PostIdExclusion, UrlPatternExclusion, ExclusionRuleSet) + Contracts - Application: EvaluateExclusionsUseCase + EvaluateComponentVisibilityUseCase (orchestrator) - Infrastructure: WordPressExclusionRepository, WordPressPageContextProvider, WordPressServerRequestProvider - Admin: ExclusionFormPartial (reusable UI), ExclusionFieldProcessor, JS toggle The PageVisibilityHelper now uses the orchestrator UseCase that combines page-type visibility (Plan 99.10) with exclusion rules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
/**
|
|
* Toggle para mostrar/ocultar reglas de exclusion en FormBuilders
|
|
*
|
|
* Escucha cambios en checkboxes con ID que termine en "ExclusionsEnabled"
|
|
* y muestra/oculta el contenedor de reglas correspondiente.
|
|
*
|
|
* @package ROITheme\Admin
|
|
*/
|
|
(function() {
|
|
'use strict';
|
|
|
|
function initExclusionToggles() {
|
|
document.querySelectorAll('[id$="ExclusionsEnabled"]').forEach(function(checkbox) {
|
|
// Handler para cambios
|
|
checkbox.addEventListener('change', function() {
|
|
const prefix = this.id.replace('ExclusionsEnabled', '');
|
|
const rulesContainer = document.getElementById(prefix + 'ExclusionRules');
|
|
if (rulesContainer) {
|
|
rulesContainer.style.display = this.checked ? 'block' : 'none';
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
// Inicializar cuando DOM este listo
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', initExclusionToggles);
|
|
} else {
|
|
initExclusionToggles();
|
|
}
|
|
})();
|