Forzar máximo 2 steps en plan: 1 coder + 1 reviewer opcional
El planner generaba 3+ steps para tareas simples causando que el coder repitiera acciones en cada step (creaba el módulo varias veces). Ahora el engine fusiona los steps en 1 coder con descripción combinada. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -72,12 +72,29 @@ Patrón para colores configurables por el usuario:
|
||||
|
||||
JavaScript scopeado al módulo usando `section_id`:
|
||||
|
||||
This is the default and expected place for module JavaScript.
|
||||
Do NOT embed `<script>` tags directly inside `index-base.tpl` for normal module behavior.
|
||||
Keep `index-base.tpl` for HTML/Twig markup and put interactive logic in `script.js`.
|
||||
`script.js` is a static file: do NOT use Twig syntax inside it.
|
||||
Do NOT write `{{ section_id }}`, `{{ variable }}`, `{% if ... %}`, or builder attributes inside `script.js`.
|
||||
|
||||
If JavaScript needs dynamic values, pass them from `index-base.tpl` through `data-*` attributes:
|
||||
|
||||
```html
|
||||
<section
|
||||
class="buscador-apartados"
|
||||
data-section-id="{{ section_id }}"
|
||||
data-hook-endpoint="/hooks/buscadorapartados_hjd8s/">
|
||||
</section>
|
||||
```
|
||||
|
||||
```js
|
||||
const section = document.getElementById('{{ section_id }}');
|
||||
if (section) {
|
||||
document.querySelectorAll('.buscador-apartados').forEach((section) => {
|
||||
const sectionId = section.dataset.sectionId;
|
||||
const hookEndpoint = section.dataset.hookEndpoint;
|
||||
const buttons = section.querySelectorAll('.btn');
|
||||
// ...
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### CmsApi (Client-Side)
|
||||
@@ -88,6 +105,25 @@ CmsApi.hook('/hooks/module_id/', { action: 'getData', id: 123 }, function(respon
|
||||
});
|
||||
```
|
||||
|
||||
If you are calling a hook that belongs to the current module, the endpoint must use the real module id:
|
||||
|
||||
```js
|
||||
// Module folder: template/estandar/modulos/buscadorapartados_hjd8s/
|
||||
CmsApi.hook('/hooks/buscadorapartados_hjd8s/', { termino: 'vela' }, function(response) {
|
||||
console.log(response);
|
||||
});
|
||||
```
|
||||
|
||||
Do not try to build this endpoint with Twig inside `script.js`. Put the final endpoint in a `data-hook-endpoint` attribute in `index-base.tpl` if needed.
|
||||
|
||||
### Module Styles (`style.css`)
|
||||
|
||||
`style.css` is also a static file.
|
||||
Do NOT use Twig syntax or builder attributes inside it.
|
||||
Do NOT write selectors or values that depend on `{{ section_id }}`.
|
||||
|
||||
Scope styles with the module root class instead of dynamic Twig ids.
|
||||
|
||||
### Cuándo usar Vue 3
|
||||
|
||||
Usar Vue 3 CDN cuando la lógica requiera:
|
||||
|
||||
Reference in New Issue
Block a user