diff --git a/TESTING_CHECKLIST.md b/TESTING_CHECKLIST.md new file mode 100644 index 0000000..27d7db1 --- /dev/null +++ b/TESTING_CHECKLIST.md @@ -0,0 +1,276 @@ +# Map Editor Plugin - Testing Checklist + +## Pre-Testing Setup + +1. [ ] Build the frontend: `npm run build` +2. [ ] Ensure Kirby is running (PHP server) +3. [ ] Log into Kirby Panel +4. [ ] Navigate to the map page (e.g., `/panel/pages/map+carte`) + +## Phase 1: Multi-Mode Testing (Map Page) + +### Basic Marker Operations + +1. [ ] **View existing markers** + - Open map page in Panel + - Verify markers are loaded and displayed on map + - Verify markers appear in sidebar list + +2. [ ] **Create marker via button** + - Click "Add Marker" button in sidebar + - Verify marker appears at map center + - Verify marker appears in sidebar + - Check browser console for errors + +3. [ ] **Create marker via map click** + - Click anywhere on the map + - Verify marker appears at clicked location + - Verify marker appears in sidebar + +4. [ ] **Select marker** + - Click marker in sidebar + - Verify map centers on marker + - Verify marker is highlighted + +5. [ ] **Drag marker** + - Drag a marker to new position + - Verify position updates in real-time + - Reload page and verify position persisted + +6. [ ] **Edit marker** + - Click "Edit" button for a marker in sidebar + - Verify redirect to marker page in Panel + - Verify marker page loads correctly + +7. [ ] **Delete marker** + - Click "Delete" button for a marker + - Verify confirmation dialog appears + - Confirm deletion + - Verify marker removed from map and sidebar + - Reload page and verify deletion persisted + +### Map Data Persistence + +8. [ ] **Map view changes** + - Pan and zoom the map + - Reload the page + - Verify map returns to same view + +9. [ ] **Check YAML data** + - View the mapdata field source + - Verify it contains: background, center, zoom + - Verify it does NOT contain markers array + +### Edge Cases + +10. [ ] **Max markers limit** + - Create markers up to the limit (default 50) + - Verify "Add Marker" button becomes disabled + - Verify map clicks don't create new markers + +11. [ ] **Geocode search** + - Use the address search in sidebar + - Search for an address + - Verify map centers on result + +12. [ ] **Error handling** + - Open browser DevTools Network tab + - Try operations with network offline (simulate) + - Verify errors are logged to console + +## Phase 2: Single-Mode Testing (Marker Page) + +### Marker Page Structure + +1. [ ] **Create test marker** + - In map page sidebar, click "Add Marker" + - Click "Edit" to open the marker page + +2. [ ] **Content tab** + - Verify "Contenu" tab exists + - Edit title field + - Add blocks (heading, text, image, etc.) + - Save and verify content persists + +3. [ ] **Position tab** + - Switch to "Position" tab + - Verify latitude/longitude fields on left + - Verify map preview on right + +### Single-Mode Map Functionality + +4. [ ] **View marker position** + - Verify single marker appears on map + - Verify marker is at coordinates shown in fields + +5. [ ] **Drag marker in single mode** + - Drag the marker to a new position + - Check browser console for API call + - Reload page + - Verify new position persisted + +6. [ ] **Update coordinates via fields** + - Edit latitude field (e.g., 43.8) + - Edit longitude field (e.g., 4.3) + - Save the page + - Verify marker moved on map preview + +7. [ ] **Geocode search in single mode** + - Use address search (if available) + - Verify map centers on result + - Drag marker to searched location + +### Single-Mode Restrictions + +8. [ ] **No CRUD buttons** + - Verify no "Add Marker" button + - Verify no "Delete" button + - Verify no marker list sidebar + +9. [ ] **Map size** + - Verify map height is smaller (400px) than multi-mode + +## Phase 3: Integration Testing + +### Subpage Management + +1. [ ] **View markers as subpages** + - In map page, check sidebar "Marqueurs" section + - Verify all markers listed as subpages + - Verify ordering by num + +2. [ ] **Reorder markers** + - Drag markers in Panel pages section + - Verify order updates + - View map editor + - Verify sidebar reflects new order + +3. [ ] **Delete marker via Panel** + - Delete a marker subpage via Panel (not map editor) + - View map page + - Verify marker removed from map + +4. [ ] **Create marker manually** + - Create a new marker subpage via Panel + - Set template to "marker" + - Add title, latitude, longitude + - View map page + - Verify marker appears on map + +### Multi-Marker Performance + +5. [ ] **Create 10 markers** + - Create 10 markers via map + - Verify performance is acceptable + - Check load time + +6. [ ] **Create 50 markers** (optional stress test) + - Create markers up to limit + - Verify UI remains responsive + - Check browser memory usage + +## Phase 4: Security & API Testing + +### Authentication + +1. [ ] **Logged out access** + - Log out of Panel + - Try accessing API directly (e.g., via curl) + - Verify 401 Unauthorized response + +### CSRF Protection + +2. [ ] **Invalid CSRF token** + - Use browser DevTools to modify X-CSRF header + - Try creating/updating/deleting marker + - Verify 403 Forbidden response + +### Permissions + +3. [ ] **Create restricted user** (optional) + - Create user with limited permissions + - Log in as that user + - Try marker operations + - Verify permission checks work + +### API Responses + +4. [ ] **Check API responses** + - Open DevTools Network tab + - Perform marker operations + - Verify responses match expected format: + ```json + { + "status": "success", + "data": { ... } + } + ``` + +5. [ ] **Test error responses** + - Try invalid coordinates (e.g., lat: 200) + - Verify 400 Bad Request response + - Verify error message is descriptive + +## Phase 5: Build & Deployment + +### Build Verification + +1. [ ] **Clean build** + - Run `npm run build` + - Verify no errors or warnings (except font warnings) + - Check dist folder created + +2. [ ] **Production test** + - Test on production server (if available) + - Verify all functionality works + +### Browser Compatibility + +3. [ ] **Test in Chrome** +4. [ ] **Test in Firefox** +5. [ ] **Test in Safari** +6. [ ] **Test in Edge** (optional) + +## Common Issues & Solutions + +### Issue: Markers not loading +- **Check**: Browser console for API errors +- **Check**: Network tab for 401/403 errors +- **Solution**: Verify user is logged in, CSRF token is valid + +### Issue: Drag doesn't update position +- **Check**: Console for API errors +- **Check**: Network tab for PATCH request +- **Solution**: Verify page permissions, CSRF token + +### Issue: Redirect to Panel doesn't work +- **Check**: Console for errors +- **Check**: panelUrl in API response +- **Solution**: Verify page ID format is correct + +### Issue: Single mode shows multiple markers +- **Check**: MapEditor component mode prop +- **Check**: Blueprint field configuration +- **Solution**: Verify `mode: single` in blueprint + +## Test Results Summary + +Date: __________ +Tester: __________ + +| Phase | Tests Passed | Tests Failed | Notes | +|-------|-------------|--------------|-------| +| Phase 1: Multi-Mode | __ / 12 | __ | | +| Phase 2: Single-Mode | __ / 9 | __ | | +| Phase 3: Integration | __ / 6 | __ | | +| Phase 4: Security | __ / 5 | __ | | +| Phase 5: Build | __ / 6 | __ | | +| **Total** | __ / 38 | __ | | + +## Next Steps After Testing + +- [ ] Document any bugs found +- [ ] Create GitHub issues for bugs +- [ ] Update README with usage instructions +- [ ] Add user documentation +- [ ] Consider implementing suggested improvements diff --git a/public/assets/svg/marker-pin.svg b/public/assets/svg/marker-pin.svg deleted file mode 100644 index 6df71cc..0000000 --- a/public/assets/svg/marker-pin.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/1_un-folklore-abyssal/chapter.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/1_un-folklore-abyssal/chapitre.txt similarity index 100% rename from public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/1_un-folklore-abyssal/chapter.txt rename to public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/1_un-folklore-abyssal/chapitre.txt diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/2_une-culture-fascinante/chapter.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/2_une-culture-fascinante/chapitre.txt similarity index 100% rename from public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/2_une-culture-fascinante/chapter.txt rename to public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/2_une-culture-fascinante/chapitre.txt diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map-static.png b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map-static.png deleted file mode 100644 index 2c4d8dd..0000000 Binary files a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map-static.png and /dev/null differ diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map-static.png.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map-static.png.txt deleted file mode 100644 index 6fe1571..0000000 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map-static.png.txt +++ /dev/null @@ -1 +0,0 @@ -Uuid: fveqiuck5suwp14v \ No newline at end of file diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map.txt deleted file mode 100644 index 7fec40e..0000000 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/1_carte-test/map.txt +++ /dev/null @@ -1,24 +0,0 @@ -Title: Carte test - ----- - -Tags: - ----- - -Text: - ----- - -Mapdata: - -background: - type: osm -center: - lat: 48.868167700000015 - lon: 2.3924468999999817 -zoom: 13 - ----- - -Uuid: qd3aqmiburbztsxq \ No newline at end of file diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/chapter.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/chapitre.txt similarity index 100% rename from public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/chapter.txt rename to public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/3_la-nouvelle-ere/chapitre.txt diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map-static.png b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map-static.png deleted file mode 100644 index 61aad30..0000000 Binary files a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map-static.png and /dev/null differ diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map-static.png.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map-static.png.txt deleted file mode 100644 index 1b092bc..0000000 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map-static.png.txt +++ /dev/null @@ -1 +0,0 @@ -Uuid: 9uhixxughhuqyphe \ No newline at end of file diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map.txt deleted file mode 100644 index c3cb097..0000000 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/4_test/map.txt +++ /dev/null @@ -1,24 +0,0 @@ -Title: test - ----- - -Tags: - ----- - -Text: - ----- - -Mapdata: - -background: - type: osm -center: - lat: 43.836699 - lon: 4.360054 -zoom: 13 - ----- - -Uuid: o06wmgdr075lthky \ No newline at end of file diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/geoformat.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/geoformat.txt index b021f8c..163cd02 100644 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/geoformat.txt +++ b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/1_plongez-dans-les-sources/geoformat.txt @@ -10,7 +10,7 @@ Tags: ---- -Cover: +Cover: - file://15innylddvc2qann ---- diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/.regenerate-map-image b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/.regenerate-map-image deleted file mode 100644 index 26754c9..0000000 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/.regenerate-map-image +++ /dev/null @@ -1 +0,0 @@ -1772115179 \ No newline at end of file diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/1_marker-1769700434/marker.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/1_marker-1769700434/marker.txt index 3de6739..d3d9d07 100644 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/1_marker-1769700434/marker.txt +++ b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/2_roadtrip-a-vos-risques-et-perils/1_marker-1769700434/marker.txt @@ -2,11 +2,7 @@ Title: Nîmes ---- -Cover: - ----- - -Text: [{"content":{"text":"
Nisi nec morbi diam tortor quis interdum fusce quisque sit aliquam scelerisque a vivamus gravida id eros nisl tortor commodo amet mi quis tincidunt metus.
Congue proin urna eget quisque sem a fusce felis eros purus hendrerit facilisis hendrerit metus accumsan metus nec eu cursus elementum maecenas ut scelerisque sit.
"},"id":"1adbada8-6dee-4ab4-b33b-d914d4806b70","isHidden":false,"type":"text"}] +Content: ---- @@ -26,8 +22,4 @@ Markericonsize: 40 ---- -Content: - ----- - Uuid: lajqvh51bnvty5xr \ No newline at end of file diff --git a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/narrative.txt b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/narrative.txt index 3648b80..b97c01d 100644 --- a/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/narrative.txt +++ b/public/content/1_cohesion-des-mondes/5_test-avec-geoformat/narrative.txt @@ -25,13 +25,13 @@ Customcss: body { font-family: "DM Sans", sans-serif; text-align: left; - color: rgb(0, 0, 0); + color: black; + background: transparent; } -/* p { text-align: right; - font-size: 49px; + font-size: 14px; margin: 0mm; font-weight: 300; font-family: Arial; @@ -41,7 +41,6 @@ p { padding-bottom: 0mm; padding-left: 0mm; } -*/ h1 { font-family: DM Sans; diff --git a/public/content/1_cohesion-des-mondes/project.txt b/public/content/1_cohesion-des-mondes/projet.txt similarity index 100% rename from public/content/1_cohesion-des-mondes/project.txt rename to public/content/1_cohesion-des-mondes/projet.txt diff --git a/public/kirby/panel/dist.zip b/public/kirby/panel/dist.zip deleted file mode 100644 index 45a436f..0000000 Binary files a/public/kirby/panel/dist.zip and /dev/null differ diff --git a/public/site/blueprints/blocks/map.yml b/public/site/blueprints/blocks/map.yml index bdb8d78..640308b 100644 --- a/public/site/blueprints/blocks/map.yml +++ b/public/site/blueprints/blocks/map.yml @@ -1,8 +1,8 @@ name: Carte icon: map fields: - map: + map: label: Choisir la carte type: pages - query: page.children.filterBy('intendedTemplate', 'map') - multiple: false + query: page.parent.parent.children.filterBy('intendedTemplate', 'map') + multiple: false \ No newline at end of file diff --git a/public/site/blueprints/fields/blueprint.yml b/public/site/blueprints/fields/blueprint.yml deleted file mode 100644 index 1feb794..0000000 --- a/public/site/blueprints/fields/blueprint.yml +++ /dev/null @@ -1,2 +0,0 @@ -type: headline -label: Page "{{ page.blueprint.title }}" diff --git a/public/site/blueprints/pages/chapitre.yml b/public/site/blueprints/pages/chapitre.yml new file mode 100644 index 0000000..c630786 --- /dev/null +++ b/public/site/blueprints/pages/chapitre.yml @@ -0,0 +1,38 @@ +title: Chapitre + +columns: + main: + width: 2/3 + sections: + fields: + type: fields + fields: + text: + label: Contenu + type: blocks + fieldsets: + text: + label: Texte + type: group + fieldsets: + - heading + - text + - list + - quote + media: + label: Medias + type: group + fieldsets: + - map + - image + - video + + sidebar: + width: 1/3 + sections: + files: + label: Fichiers + type: files + + + diff --git a/public/site/blueprints/pages/chapter.yml b/public/site/blueprints/pages/chapter.yml deleted file mode 100644 index dfb9cb4..0000000 --- a/public/site/blueprints/pages/chapter.yml +++ /dev/null @@ -1,41 +0,0 @@ -title: Chapitre - -tabs: - contentTab: - label: Contenu - columns: - main: - width: 2/3 - sections: - fields: - type: fields - fields: - blueprint: fields/blueprint - text: - label: Contenu - type: blocks - fieldsets: - text: - label: Texte - type: group - fieldsets: - - heading - - text - - list - - quote - media: - label: Medias - type: group - fieldsets: - - map - - image - - video - sidebar: - width: 1/3 - sections: - maps: - label: Cartes - type: pages - template: map - - files: tabs/files diff --git a/public/site/blueprints/pages/geoformat.yml b/public/site/blueprints/pages/geoformat.yml index 3104955..1fca6dc 100644 --- a/public/site/blueprints/pages/geoformat.yml +++ b/public/site/blueprints/pages/geoformat.yml @@ -1,44 +1,38 @@ title: Géoformat -tabs: - contentTab: - columns: - main: - width: 2/3 - sections: - fields: - type: fields - fields: - blueprint: fields/blueprint - subtitle: - label: Sous-titre - type: text - width: 1/2 - tags: - label: Mots-clés - type: tags - width: 1/2 - cover: - label: Media de couverture - type: files - query: page.coverFiles - text: "{{ file.coverLabel }}" - multiple: false - width: 1/2 - text: - label: Chapeau - type: writer - chapters: - label: Chapitres - type: pages - template: chapter - sidebar: - width: 1/3 - sections: - maps: - label: Cartes - type: pages - template: map - help: Créez des cartes ici avant de pouvoir les ajouter dans un bloc ou en couverture. +columns: + main: + width: 2/3 + sections: + fields: + type: fields + fields: + subtitle: + label: Sous-titre + type: text + width: 1/2 + tags: + label: Mots-clés + type: tags + width: 1/2 + cover: + label: Media de couverture + type: files + multiple: false + width: 1/2 + text: + label: Chapeau + type: writer + pages: + label: Chapitres + type: pages + template: chapitre + sidebar: + width: 1/3 + sections: + files: + label: Fichiers + type: files + + - filesTab: tabs/files diff --git a/public/site/blueprints/pages/map.yml b/public/site/blueprints/pages/map.yml index 0349133..65d6662 100644 --- a/public/site/blueprints/pages/map.yml +++ b/public/site/blueprints/pages/map.yml @@ -7,26 +7,21 @@ columns: fields: type: fields fields: - blueprint: fields/blueprint + tags: + label: Mots-clés + type: tags + text: + label: Présentation de la carte + type: writer mapdata: label: Carte type: map-editor defaultCenter: [43.836699, 4.360054] defaultZoom: 13 maxMarkers: 50 - intro: - label: Présentation de la carte - type: writer sidebar: width: 1/3 sections: - tagsSection: - type: fields - fields: - emptyField: - type: gap - secondEmptyField: - type: gap - tags: - label: Mots-clés - type: tags + files: + label: Fichiers + type: files diff --git a/public/site/blueprints/pages/narrative.yml b/public/site/blueprints/pages/narrative.yml index 23dc680..ee1cdee 100644 --- a/public/site/blueprints/pages/narrative.yml +++ b/public/site/blueprints/pages/narrative.yml @@ -1,51 +1,44 @@ -title: Récit +title: Narrative -tabs: - contentTab: - label: Contenu - columns: - main: - width: 2/3 - sections: - fields: - type: fields - fields: - blueprint: fields/blueprint - author: - label: Auteur·ice(s) - type: text - width: 1/2 - cover: - label: Image de couverture - type: files - query: page.coverFiles - text: "{{ file.coverLabel }}" - multiple: false - width: 1/2 - introduction: - label: Introduction - type: writer - parts: - label: Parties - type: pages - template: - - map - - geoformat - info: "{{ page.blueprint.title }}" - sidebar: - width: 1/3 - sections: - files: - label: Fichiers +columns: + main: + width: 2/3 + sections: + fields: + type: fields + fields: + blueprint: + type: headline + label: Page "{{ page.intendedTemplate }}" + author: + label: Auteur·ice(s) + type: text + width: 1/2 + cover: + label: Image de couverture type: files - CSSTab: - label: CSS - icon: brush - fields: - customCss: - label: Custom CSS - type: code-editor - language: css - help: Custom CSS styling for this narrative's print view - theme: monokai - size: large + multiple: false + width: 1/2 + introduction: + label: Introduction + type: writer + customCss: + label: Custom CSS + type: code-editor + language: css + help: Custom CSS styling for this narrative's print view + theme: monokai + size: large + pages: + label: Pages + type: pages + template: + - map + - geoformat + info: "{{ page.intendedTemplate }}" + sidebar: + width: 1/3 + sections: + files: + label: Fichiers + type: files diff --git a/public/site/blueprints/pages/project.yml b/public/site/blueprints/pages/projet.yml similarity index 93% rename from public/site/blueprints/pages/project.yml rename to public/site/blueprints/pages/projet.yml index 32de087..fbcac36 100644 --- a/public/site/blueprints/pages/project.yml +++ b/public/site/blueprints/pages/projet.yml @@ -7,7 +7,6 @@ columns: fields: type: fields fields: - blueprint: fields/blueprint subtitle: label: Sous-titre type: text diff --git a/public/site/blueprints/site.yml b/public/site/blueprints/site.yml index 8c1294f..915996f 100644 --- a/public/site/blueprints/site.yml +++ b/public/site/blueprints/site.yml @@ -13,7 +13,7 @@ tabs: label: Projets type: pages templates: - - project + - projet secondary: width: 1/2 sections: diff --git a/public/site/blueprints/tabs/files.yml b/public/site/blueprints/tabs/files.yml deleted file mode 100644 index be2f551..0000000 --- a/public/site/blueprints/tabs/files.yml +++ /dev/null @@ -1,15 +0,0 @@ -label: Fichiers -icon: attachment -columns: - - width: 1/4 - fields: - manageFilesInfo: - label: false - type: info - text: À droite, tous les fichiers que stocke la page. Pensez à supprimer les fichiers inutilisés éviter de surcharger inutilement le serveur. - - - width: 3/4 - sections: - filesSection: - label: Fichiers - type: files diff --git a/public/site/plugins/cover-files/index.php b/public/site/plugins/cover-files/index.php deleted file mode 100644 index f17a27e..0000000 --- a/public/site/plugins/cover-files/index.php +++ /dev/null @@ -1,19 +0,0 @@ - [ - 'coverFiles' => function () { - return $this->files()->add( - $this->children()->filterBy('intendedTemplate', 'map')->files() - ); - } - ], - 'fileMethods' => [ - 'coverLabel' => function () { - if ($this->parent()->intendedTemplate()->name() === 'map') { - return 'Carte "' . $this->parent()->title() . '"'; - } - return $this->filename(); - } - ] -]); diff --git a/public/site/plugins/virtual-print-page/index.php b/public/site/plugins/virtual-print-page/index.php index 0bea7cf..9240cea 100644 --- a/public/site/plugins/virtual-print-page/index.php +++ b/public/site/plugins/virtual-print-page/index.php @@ -3,7 +3,7 @@ * Virtual Print Page Plugin * * Creates a virtual /print page for each narrative - * Allows access to print editor via /project/narrative/print + * Allows access to print editor via /projet/narrative/print */ use Kirby\Cms\Page; diff --git a/public/site/templates/narrative.json.php b/public/site/templates/narrative.json.php index e4ab738..3da5296 100644 --- a/public/site/templates/narrative.json.php +++ b/public/site/templates/narrative.json.php @@ -1,7 +1,7 @@ map()->toPages()->first(); - if ($mapPage) { - $blockData['content'] = parseMap($mapPage); - } else { - $blockData['content'] = [ - 'map' => $block->map()->value() - ]; - } + $blockData['content'] = [ + 'map' => $block->map()->value() + ]; break; default: @@ -127,53 +122,31 @@ function parseBlocks($blocksField, $page) { } /** - * Parse a chapter + * Parse un chapitre */ -function parseChapter($chapter) { +function parseChapitre($chapitre) { return [ - 'id' => $chapter->id(), - 'uuid' => $chapter->uuid()->toString(), - 'template' => 'chapter', - 'title' => $chapter->title()->value(), - 'slug' => $chapter->slug(), - 'blocks' => parseBlocks($chapter->text(), $chapter) + 'id' => $chapitre->id(), + 'uuid' => $chapitre->uuid()->toString(), + 'template' => 'chapitre', + 'title' => $chapitre->title()->value(), + 'slug' => $chapitre->slug(), + 'blocks' => parseBlocks($chapitre->text(), $chapitre) ]; } /** - * Parse a marker + * Parse une carte */ -function parseMarker($marker) { +function parseCarte($carte) { return [ - 'title' => $marker->title()->value(), - 'cover' => resolveFileUrl($marker->cover(), $marker), - 'icon' => $marker->markerIcon()->toFile() ? $marker->markerIcon()->toFile()->url() : null, - 'iconSize' => $marker->markerIconSize()->value() ?? 40, - 'blocks' => parseBlocks($marker->text(), $marker) - ]; -} - -/** - * Parse a map - */ -function parseMap($map) { - $markers = []; - foreach ($map->children()->listed() as $child) { - if ($child->intendedTemplate()->name() === 'marker') { - $markers[] = parseMarker($child); - } - } - $staticImage = $map->file('map-static.png'); - return [ - 'id' => $map->id(), - 'uuid' => $map->uuid()->toString(), + 'id' => $carte->id(), + 'uuid' => $carte->uuid()->toString(), 'template' => 'carte', - 'title' => $map->title()->value(), - 'slug' => $map->slug(), - 'tags' => $map->tags()->isNotEmpty() ? $map->tags()->split() : [], - 'image' => $staticImage ? $staticImage->url() : null, - 'intro' => resolveImagesInHtml($map->text()->value(), $map), - 'markers' => $markers + 'title' => $carte->title()->value(), + 'slug' => $carte->slug(), + 'tags' => $carte->tags()->isNotEmpty() ? $carte->tags()->split() : [], + 'text' => resolveImagesInHtml($carte->text()->value(), $carte) ]; } @@ -181,13 +154,10 @@ function parseMap($map) { * Parse un geoformat */ function parseGeoformat($geoformat) { - $children = []; + $chapitres = []; foreach ($geoformat->children()->listed() as $child) { - $template = $child->intendedTemplate()->name(); - if ($template === 'chapter') { - $children[] = parseChapter($child); - } elseif ($template === 'map') { - $children[] = parseMap($child); + if ($child->intendedTemplate()->name() === 'chapitre') { + $chapitres[] = parseChapitre($child); } } @@ -201,7 +171,7 @@ function parseGeoformat($geoformat) { 'tags' => $geoformat->tags()->isNotEmpty() ? $geoformat->tags()->split() : [], 'cover' => resolveFileUrl($geoformat->cover(), $geoformat), 'text' => resolveImagesInHtml($geoformat->text()->value(), $geoformat), - 'children' => $children + 'children' => $chapitres ]; } @@ -227,8 +197,8 @@ foreach ($page->children()->listed() as $child) { if ($template === 'geoformat') { $data['children'][] = parseGeoformat($child); - } elseif ($template === 'map') { - $data['children'][] = parseMap($child); + } elseif ($template === 'carte') { + $data['children'][] = parseCarte($child); } } diff --git a/public/site/templates/print.php b/public/site/templates/print.php index ab8e7e3..3d9870c 100644 --- a/public/site/templates/print.php +++ b/public/site/templates/print.php @@ -1,7 +1,7 @@ -