complément de doc : les crayons et les filtrages par URL d'appel

This commit is contained in:
cy_altern 2022-05-31 12:25:00 +02:00
parent 686acc8452
commit d924e4ad9a
2 changed files with 53 additions and 22 deletions

View file

@ -68,7 +68,6 @@ Choisir entre la version minifiée de vuejs (sans le debug) ou la version de dev
}
```
## Utiliser les actions :
```html
[(#SET{statut,
@ -90,6 +89,25 @@ Choisir entre la version minifiée de vuejs (sans le debug) ou la version de dev
## Utiliser les crayons :
```json
[{
"header":{
"id": "ID",
"activite": "Activité",
"massif": "Massif",
"sommet": "Sommet",
"voie": "Voie",
"participants_max": "Participants max",
"tarif_prive": "Prix"
},
"crayons":{
"tarif_prive" : "activite"
}
```
Dans cet exemple :
- `activite` est le raccourci du nom de la table (spip_activites)
- `tarif_prive` est **obligatoirement** l'intitulé du champs dans cette table (si besoin il faut modifier la clé du champ...)
### Caches
l'invalidation du cache ne se fait que pour les objets publiés
@ -113,24 +131,24 @@ Il faut surcharger cette autorisation : autoriser_crayonner_dist() `inc/crayons`
### @Deprecated
=> integre par default dans la 3.4.2 pour tous les objets
>- il faut utiliser le pipeline `crayons_vue_affichage_final`
>```php
>/**
> * injection du reload de vuejs pour les crayons de l'objet souscription
> *
> */
>function prefixPlugin_crayons_vue_affichage_final($flux){
> if ($flux['args']['type'] === 'souscription') {
> $id = $flux['args']['id'];
> if ($id = intval($id)) {
> $flux['data'] .= ' <script type="text/javascript"> app.rechargerJson('.$id.'); </script>';
> } else {
> $flux['data'] .= ' <script type="text/javascript"> app.rechargerJson(); </script>';
> }
> }
> return $flux;
>}
>```
- il faut utiliser le pipeline `crayons_vue_affichage_final`
```php
/**
* injection du reload de vuejs pour les crayons de l'objet souscription
*
*/
function prefixPlugin_crayons_vue_affichage_final($flux){
if ($flux['args']['type'] === 'souscription') {
$id = $flux['args']['id'];
if ($id = intval($id)) {
$flux['data'] .= ' <script type="text/javascript"> app.rechargerJson('.$id.'); </script>';
} else {
$flux['data'] .= ' <script type="text/javascript"> app.rechargerJson(); </script>';
}
}
return $flux;
}
```
## Utiliser une mediabox ou modalbox :
@ -185,5 +203,18 @@ Il faut surcharger cette autorisation : autoriser_crayonner_dist() `inc/crayons`
}>
</div>
```
## Liens
>https://unpkg.com/browse/vue-next-select@2.10.4/
## URLs avec filtrage :
Concatener le filtrage dans l'url d'appel du json :
```html
http://guides.spip/?page=grille_tarifs&activite=Alpinisme
```
ou
```html
<a class="btn" href="[(#URL_PAGE{commandes}|parametre_url{annee,2021})]">2021</a>
```
## Refs
https://unpkg.com/browse/vue-next-select@2.10.4/

View file

@ -20,7 +20,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
jQuery(function () {
$('#app').on('click', '.url_action', function (e) {