diff --git a/src/components/generics/inputs/InputDocument.vue b/src/components/generics/inputs/InputDocument.vue
index 2b4866a8bd..0551c5d7d6 100644
--- a/src/components/generics/inputs/InputDocument.vue
+++ b/src/components/generics/inputs/InputDocument.vue
@@ -23,7 +23,7 @@
{{ $gettext(type + 's') | uppercaseFirstLetter }}
doc,
+ },
},
data() {
@@ -162,7 +166,9 @@ export default {
documentTypesWithResults() {
const result = this.promise.data;
- return this.documentTypes_.filter((type) => result[type + 's'] && result[type + 's'].documents.length !== 0);
+ return this.documentTypes_.filter(
+ (type) => result[type + 's'] && result[type + 's'].documents.filter(this.optionsFilter).length !== 0
+ );
},
letterTypes() {
diff --git a/src/js/associations-rights-mixin.js b/src/js/associations-rights-mixin.js
index 91fa67eb22..fe9109caa6 100644
--- a/src/js/associations-rights-mixin.js
+++ b/src/js/associations-rights-mixin.js
@@ -94,6 +94,10 @@ export default {
return child.author.user_id === this.$user.id;
}
+ if (child.type === 'w' && parent.type === 'r') {
+ return true;
+ }
+
return false;
},
},
diff --git a/src/js/constants/Field.js b/src/js/constants/Field.js
index c5e4317727..51487a92ca 100644
--- a/src/js/constants/Field.js
+++ b/src/js/constants/Field.js
@@ -306,6 +306,18 @@ Field.prototype.isVisibleForWaypointTypes = function (waypointTypes) {
return utils.intersectionIsNotNull(this.waypoint_types, waypointTypes);
};
+Field.prototype.isVisibleForRouteType = function (routeTypes) {
+ if (!this.route_types) {
+ return true;
+ }
+
+ if (!routeTypes) {
+ return false;
+ }
+
+ return utils.intersectionIsNotNull(this.route_types, routeTypes);
+};
+
Field.prototype.isVisibleFor = function (document) {
if (!this.extraIsVisibleFor(document)) {
return false;
@@ -319,6 +331,10 @@ Field.prototype.isVisibleFor = function (document) {
return false;
}
+ if (document.type === 'r' && !this.isVisibleForRouteType(document.route_types)) {
+ return false;
+ }
+
return true;
};
diff --git a/src/js/constants/documentsProperties.json b/src/js/constants/documentsProperties.json
index eb1709da1e..0928c83f13 100644
--- a/src/js/constants/documentsProperties.json
+++ b/src/js/constants/documentsProperties.json
@@ -341,6 +341,12 @@
]
}
},
+ {
+ "id": "ending_waypoints",
+ "properties": {
+ "route_types": ["loop", "loop_hut", "traverse", "raid", "expedition"]
+ }
+ },
{
"id": "engagement_rating",
"properties": {
@@ -455,6 +461,7 @@
{ "id": "labande_ski_rating", "properties": { "url": "srat", "activities": ["skitouring"] } },
{ "id": "lift_access" },
{ "id": "main_waypoint_id" },
+ { "id": "main_waypoint" },
{ "id": "mixed_rating", "properties": { "url": "mrat", "activities": ["snow_ice_mixed", "ice_climbing"] } },
{ "id": "mtb_down_rating", "properties": { "url": "mbdr", "activities": ["mountain_biking"] } },
{ "id": "mtb_height_diff_portages", "properties": { "url": "mbpush", "activities": ["mountain_biking"] } },
@@ -501,6 +508,7 @@
}
},
{ "id": "route_types", "properties": { "url": "rtyp" } },
+ { "id": "starting_waypoints" },
{ "id": "ski_exposition", "properties": { "url": "sexpo", "activities": ["skitouring"] } },
{ "id": "ski_rating", "properties": { "url": "trat", "activities": ["skitouring"] } },
{ "id": "slackline_height", "properties": { "activities": ["slacklining"] } },
diff --git a/src/js/constants/fieldsProperties.json b/src/js/constants/fieldsProperties.json
index 9cf2dde83c..c872bc8f84 100644
--- a/src/js/constants/fieldsProperties.json
+++ b/src/js/constants/fieldsProperties.json
@@ -284,6 +284,11 @@
"unit": "m",
"helper": "1063027#elevation-up_snow"
},
+ "ending_waypoints": {
+ "type": "document",
+ "documentType": "waypoint",
+ "multiple": true
+ },
"engagement_rating": {
"values": "engagement_ratings",
"queryMode": "valuesRangeSlider",
@@ -541,7 +546,9 @@
"lift_status": {
"values": "lift_status"
},
- "main_waypoint_id": {
+ "main_waypoint": {
+ "type": "document",
+ "documentType": "waypoint",
"helper": "1063045#main-waypoint"
},
"maps_info": {
@@ -881,6 +888,11 @@
"helper": "239491#snowshoe-rating",
"sortable": true
},
+ "starting_waypoints": {
+ "type": "document",
+ "documentType": "waypoint",
+ "multiple": true
+ },
"summary": {
"type": "markdown",
"parent": "locales"
diff --git a/src/translations/ca.json b/src/translations/ca.json
index 264ce3bc69..979b4bcb3c 100644
--- a/src/translations/ca.json
+++ b/src/translations/ca.json
@@ -153,7 +153,7 @@
"Danger rating - low": "Perill feble",
"Danger rating - moderate": "Perill moderat",
"Danger rating - very high": "Perill molt fort",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Dades tècniques, com l'orientació, el tipus de roca o la configuració general de l'itinerari (aresta, pilar, etc.)",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Dades tècniques, com l'orientació, el tipus de roca, punts de pas o la configuració general de l'itinerari (aresta, pilar, etc.)",
"Delete": {
"yeti": "Eliminar"
},
@@ -915,6 +915,7 @@
"quality_types": "buit"
},
"empty comment": "comentari buit",
+ "ending waypoints": "punts d'arribada",
"en": {
"langs": "anglès"
},
@@ -1180,6 +1181,7 @@
"book_types": "revista"
},
"main_waypoint_id": "ID del punt de pas principal",
+ "main_waypoint": "Punt de pas principal",
"male": {
"genders": "home"
},
@@ -1612,6 +1614,7 @@
"stone_ice_fall": {
"event_types": "caiguda de pedra/glaç/serac"
},
+ "starting waypoints": "punts de partida",
"stories": {
"article_categories": "narracions"
},
diff --git a/src/translations/de.json b/src/translations/de.json
index 592aef5979..c49112a756 100644
--- a/src/translations/de.json
+++ b/src/translations/de.json
@@ -229,7 +229,7 @@
"Danger rating - moderate": "Mässig",
"Danger rating - very high": "Sehr gross",
"Danger:": "Stufe :",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Technische Daten, wie Ausrichtung, Gestein oder Aufbau der Route (Kante, Rinne ...)",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Technische Daten, wie Ausrichtung, Gestein, Wegpunkte oder Aufbau der Route (Kante, Rinne ...)",
"Delete": {
"yeti": "Löschen"
},
@@ -1159,6 +1159,7 @@
"quality_types": "leer"
},
"empty comment": "leerer Kommentar",
+ "ending waypoints": "ankunftsorte",
"en": {
"langs": "englisch"
},
@@ -1446,6 +1447,7 @@
"book_types": "Zeitschrift"
},
"main_waypoint_id": "ID des Hauptwegpunkts",
+ "main_waypoint": "Hauptwegpunkts",
"male": {
"genders": "männlich"
},
@@ -1906,6 +1908,7 @@
"stories": {
"article_categories": "Geschichten"
},
+ "starting waypoints": "startpunkte",
"strava": "Strava",
"strong text": "fetter Text",
"summary": "Überblick",
diff --git a/src/translations/en.json b/src/translations/en.json
index c4c8e4d211..e12e9a6977 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -536,6 +536,7 @@
"route_types": "loop hut"
},
"main_waypoint_id": "ID of the main waypoint",
+ "main_waypoint": "Main waypoint",
"maps_info": "Maps info",
"maps_references": "Maps references",
"matress_unstaffed": "Matress if unstaffed",
diff --git a/src/translations/es.json b/src/translations/es.json
index aa90e08cbf..51e5337a7f 100644
--- a/src/translations/es.json
+++ b/src/translations/es.json
@@ -159,7 +159,7 @@
"Danger rating - moderate": "Clasificación de peligro: moderado",
"Danger rating - very high": "Clasificación de peligro: muy alto",
"Danger:": "Peligro :",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Datos técnicos, tal como orientación, tipo de roca, o la configuración general del itinerario (arista, pilar...)",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Datos técnicos, tal como orientación, tipo de roca, puntos de ruta o la configuración general del itinerario (arista, pilar...)",
"Delete": {
"yeti": "Eliminar"
},
@@ -815,6 +815,7 @@
"quality_types": "vacío"
},
"empty comment": "comentario vacío",
+ "ending waypoints": "puntos de llegada",
"en": {
"langs": "inglés"
},
@@ -1074,6 +1075,7 @@
"book_types": "revista"
},
"main_waypoint_id": "ID del punto de ruta principal",
+ "main_waypoint": "Punto de ruta principal",
"male": {
"genders": "varón"
},
@@ -1460,6 +1462,7 @@
"stories": {
"article_categories": "historias"
},
+ "starting waypoints": "puntos de salida",
"strava": "Strava",
"summary": "Resumen",
"summit": {
diff --git a/src/translations/eu.json b/src/translations/eu.json
index 1541f93dcf..b5aeaf5d25 100644
--- a/src/translations/eu.json
+++ b/src/translations/eu.json
@@ -343,6 +343,7 @@
"empty": {
"quality_types": "hutsa"
},
+ "ending waypoints": "iristeko puntuak",
"en": {
"langs": "ingelesa"
},
@@ -874,6 +875,7 @@
"stories": {
"article_categories": "kontakizuna"
},
+ "starting waypoints": "abia puntuak",
"strava": "Strava",
"summary": "laburpena",
"summit": {
diff --git a/src/translations/fr.json b/src/translations/fr.json
index b9c734f174..e567743735 100644
--- a/src/translations/fr.json
+++ b/src/translations/fr.json
@@ -174,7 +174,7 @@
"Danger rating - very high": "Danger très fort",
"Danger:": "Danger :",
"Dashboard": "Tableau de bord",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Données techniques, comme l'orientation, le type de roche ou la configuration générale de l'itinéraire (arête, pilier...)",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Données techniques, comme l'orientation, le type de roche, le type de route (aller-retour, boucle), les points de passage ou la configuration générale de l'itinéraire (arête, pilier...)",
"Delete": {
"yeti": "Supprimer"
},
@@ -257,7 +257,7 @@
"Extent": "Couverture",
"FAQ?": "FAQ ?",
"Fauna protection areas": "Faune",
- "Fauna protection site:": "Site de protection de la faune :",
+ "Fauna protection site:": "Site de protection de la faune :",
"Feel free to edit it.": "Éditez-le.",
"Filter on map extent": "Limiter la recherche à la carte visible",
"Filter results": "Filtrer",
@@ -1032,6 +1032,7 @@
"quality_types": "vide"
},
"empty comment": "commentaire vide",
+ "ending waypoints": "points d'arrivée",
"en": {
"langs": "anglais"
},
@@ -1292,6 +1293,7 @@
"route_types": "boucle (approche ou refuge)"
},
"main_waypoint_id": "ID du point de passage principal",
+ "main_waypoint": "Point de passage principal",
"male": {
"genders": "homme"
},
@@ -1717,6 +1719,7 @@
"stone_ice_fall": {
"event_types": "chute de pierre/glace/serac"
},
+ "starting waypoints": "points de départ",
"stories": {
"article_categories": "récits"
},
diff --git a/src/translations/hu.json b/src/translations/hu.json
index 78a22155f3..1434fdcf30 100644
--- a/src/translations/hu.json
+++ b/src/translations/hu.json
@@ -191,7 +191,7 @@
"Danger rating - low": "Veszélyességi besorolás - alacsony",
"Danger rating - moderate": "Veszélyességi besorolás - mérsékelt",
"Danger rating - very high": "Veszélyességi besorolás - nagyon magas",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Adatok, mint például orientáció, szikla típus, út típus (pl. oda-vissza, vagy körtúra) és út körülmények (pl. gerinc vagy vízmosás).",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Adatok, mint például orientáció, szikla típus, út típus (pl. oda-vissza, vagy körtúra), útpont és út körülmények (pl. gerinc vagy vízmosás).",
"Delete": {
"yeti": "Törlés"
},
@@ -900,7 +900,11 @@
"quality_types": "üres"
},
"empty comment": "üres megjegyzés",
+ "ending waypoints": "érkezési pontok",
"engagement_rating": "elkötelezettség_besorolás",
+ "en": {
+ "langs": "angol"
+ },
"environment": {
"book_types": "környezet"
},
@@ -1149,6 +1153,7 @@
"book_types": "folyóirat"
},
"main_waypoint_id": "fő_útvonalpont_azonosító",
+ "main_waypoint": "fő útvonalpont",
"male": {
"genders": "férfi"
},
@@ -1582,6 +1587,7 @@
"stories": {
"article_categories": "történetek"
},
+ "starting waypoints": "indulási pontok",
"strava": "Strava",
"strong text": "hangsúlyos szöveg",
"summary": "összefoglaló",
diff --git a/src/translations/it.json b/src/translations/it.json
index e493933620..1fa090e2b2 100644
--- a/src/translations/it.json
+++ b/src/translations/it.json
@@ -180,7 +180,7 @@
"Danger rating - very high": "Grado molto forte",
"Danger:": "Pericolo:",
"Dashboard": "Pannello interattivo",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Dati tecnici, come l'orientazione, il tipo di roccia o la configurazione dell'itinerario ",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Dati tecnici, come l'orientazione, il tipo di roccia, tipo di itinerario (andata e ritorno, loop), punto di passaggio o la configurazione dell'itinerario ",
"Delete": {
"yeti": "Cancellare"
},
@@ -1055,6 +1055,7 @@
"quality_types": "vuoto"
},
"empty comment": "commento vuoto",
+ "ending waypoints": "punti di arrivo",
"en": {
"langs": "inglese"
},
@@ -1328,6 +1329,7 @@
"book_types": "rivista"
},
"main_waypoint_id": "ID del punto di passaggio principale",
+ "main_waypoint": "unto di passaggio principale",
"male": {
"genders": "maschio "
},
@@ -1775,6 +1777,7 @@
"stories": {
"article_categories": "racconti"
},
+ "starting waypoints": "punti di partenza",
"strava": "Strava",
"strong text": "testo in grassetto ",
"summary": "Riassunto",
diff --git a/src/translations/ru.json b/src/translations/ru.json
index 1defd9a030..e7ee37a301 100644
--- a/src/translations/ru.json
+++ b/src/translations/ru.json
@@ -172,7 +172,7 @@
"Current password": "действующий пароль",
"Danger level": "Уровень опасности",
"Danger level from the avalanche bulletin applies to all orientations. The compass rose distinguishes the most critical sectors presenting an increased risk.": "Уровень опасности из лавинного бюллетеня распространяется на любую ориентацию. Роза ветров определяет наиболее важные сектора, представляющие повышенный риск.",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Технические данные, такие как ориентация, тип скал или общая конфигурация маршрута (гребень, кулуар, стена)",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Технические данные, такие как ориентация, тип скал, тип маршрута (туда и обратно, петля), точки пересечения или общая конфигурация маршрута (гребень, кулуар, стена)",
"Delete": {
"yeti": "Удалить"
},
@@ -697,6 +697,7 @@
"quality_types": "пустой"
},
"empty comment": "пустой комментарий",
+ "ending waypoints": "пункты прибытия",
"en": {
"langs": "английский"
},
@@ -851,6 +852,7 @@
"book_types": "Журнал"
},
"main_waypoint_id": "Id главной путевой точки",
+ "main_waypoint": "главной путевой точки",
"map": "карта",
"maps": "карты",
"maps_info": "карты",
@@ -1079,6 +1081,7 @@
"stories": {
"article_categories": "рассказы"
},
+ "starting waypoints": "пункты отправления",
"strava": "Strava",
"suunto": "Suunto",
"tags": {
diff --git a/src/translations/sl.json b/src/translations/sl.json
index d0b249ceb1..1640cde2da 100644
--- a/src/translations/sl.json
+++ b/src/translations/sl.json
@@ -75,7 +75,7 @@
"Area not covered": "Območje ni pokrito",
"Area too large": "Območje je preveliko",
"Articles, waypoints or routes to be linked.": "Poveži članek, točko ali smer",
- "Articles, waypoints, routes or books to be linked.": "Povezani članki, točke, smeri ali knjige",
+ "Articles, waypoints, routes or books to be linked.": "Povezani članki, točke poti, smeri ali knjige",
"As the name suggests, this method is intended for beginners. Therefore, the safety margin must be particularly important. No parameter other than the danger level is specified. Orientation is ignored.": "Kot že ime pove, je ta metoda namenjena začetnikom. Zato mora biti varnostna meja zelo velika. Noben drug parameter ni določen razen stopnje nevarnosti plazovnega biltena. Orientacija je prezrta.",
"Associated outings": "Povezani vzponi",
"Associated routes": "Povezane smeri",
@@ -190,7 +190,7 @@
"Danger rating - moderate": "Zmerna nevarnost",
"Danger rating - very high": "Zelo velika nevarnost",
"Danger:": "Nevarnost:",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "Podatki, kot so orientacija, vrsta kamnine, vrsta itinerarja (povratno, zanka ...) in konfiguracija smeri (npr greben ali žleb).",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "Podatki, kot so orientacija, vrsta kamnine, vrsta itinerarja (povratno, zanka ...), točke poti in konfiguracija smeri (npr greben ali žleb).",
"Delete": {
"yeti": "Izbrišite"
},
@@ -1089,6 +1089,7 @@
"quality_types": "prazno"
},
"empty comment": "prazni komentar",
+ "ending waypoints": "točke prihoda",
"en": {
"langs": "angleščina"
},
@@ -1369,6 +1370,7 @@
"book_types": "revija"
},
"main_waypoint_id": "ID glavne točke",
+ "main_waypoint": "glavna točke poti",
"male": {
"genders": "moški"
},
@@ -1826,6 +1828,7 @@
"stories": {
"article_categories": "zgodbe"
},
+ "starting waypoints": "točke odhoda",
"strava": "Strava",
"strong text": "krepko besedilo",
"summary": "Povzetek",
diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json
index 116256a3a5..bc0ff7a5fc 100644
--- a/src/translations/zh_CN.json
+++ b/src/translations/zh_CN.json
@@ -217,7 +217,7 @@
"Danger rating - moderate": "危险等级 - 中等",
"Danger rating - very high": "危险等级 - 非常高",
"Danger:": "危险:",
- "Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).": "朝向、岩石类型、路线类型(如原路返回或环线)以及线路地形类型(如山脊或冲沟)",
+ "Data like orientation, rock type, route type (such as return trip or loop), waypoints and route configuration type (such as ridge or gully).": "朝向、岩石类型、路线类型(如原路返回或环线)以及线路地形类型(如山脊或冲沟)",
"Delete": {
"yeti": "删除"
},
@@ -1087,6 +1087,7 @@
"quality_types": "空白"
},
"empty comment": "空白评论",
+ "ending waypoints": "到达点",
"en": {
"langs": "English"
},
@@ -1373,6 +1374,7 @@
"book_types": "杂志"
},
"main_waypoint_id": "主要路点的id",
+ "main_waypoint": "主要路点的",
"male": {
"genders": "男士"
},
@@ -1833,6 +1835,7 @@
"stories": {
"article_categories": "故事"
},
+ "starting waypoints": "起点",
"strava": "Strava",
"strong text": "加粗字体",
"summary": "总结",
diff --git a/src/views/wiki/edition/RouteEditionView.vue b/src/views/wiki/edition/RouteEditionView.vue
index 4064cf1a4d..b86e6d6884 100644
--- a/src/views/wiki/edition/RouteEditionView.vue
+++ b/src/views/wiki/edition/RouteEditionView.vue
@@ -10,13 +10,8 @@
expanded-on-load
>
-
-
+
+
@@ -25,7 +20,6 @@
-
@@ -36,7 +30,7 @@
:title="$gettext('configuration')"
:sub-title="
$gettext(
- 'Data like orientation, rock type, route type (such as return trip or loop) and route configuration type (such as ridge or gully).'
+ 'Data like orientation, rock type, route type (such as return trip or loop), waypoints, waypoints and route configuration type (such as ridge or gully).'
)
"
>
@@ -46,6 +40,29 @@
+
+
+
+
this.document.activities.includes(act))
) {
return this.$gettext('Describe the route following the structure below');
}
return undefined;
},
+ titlePrefix() {
+ if (!this.document?.main_waypoint) {
+ return '';
+ }
+ return this.$documentUtils.getDocumentTitle(this.document.main_waypoint);
+ },
},
watch: {
'document.associations.waypoints': 'onWaypointsAssociation',
+ 'document.main_waypoint': 'onMainWaypointSelection',
'document.geometry.geom': 'onGeometryUpdate',
'document.geometry.geom_detail': 'onGeometryUpdate',
'document.climbing_outdoor_type': {
@@ -205,9 +231,15 @@ export default {
methods: {
afterLoad() {
- // on creation from a waypoint, set this waypoint as main
- if (this.mode === 'add' && this.$route.query.w) {
- this.document.main_waypoint_id = parseInt(this.$route.query.w);
+ const waypoints = this.document.associations.waypoints;
+ if (this.mode === 'add') {
+ if (this.document.main_waypoint_id === null && waypoints.length !== 0) {
+ this.document.main_waypoint =
+ waypoints.find((waypoint) => waypoint.waypoint_type !== 'access') || waypoints[0];
+ }
+ if (this.document.starting_waypoints.length === 0 && waypoints.length !== 0) {
+ this.document.starting_waypoints = waypoints.filter((waypoint) => waypoint.waypoint_type === 'access');
+ }
}
},
@@ -231,21 +263,32 @@ export default {
}
},
- onWaypointsAssociation() {
- const waypoints = this.document.associations.waypoints;
-
- // clean main waypoint if it is missing from associated waypoints
- if (waypoints.findIndex((doc) => doc.document_id === this.document.main_waypoint_id) === -1) {
+ onMainWaypointSelection() {
+ if (
+ this.document.main_waypoint_id &&
+ this.document.main_waypoint_id === this.document.main_waypoint.document_id
+ ) {
this.document.main_waypoint_id = null;
+ this.document.main_waypoint = null;
+ } else {
+ this.document.main_waypoint_id = this.document.main_waypoint.document_id;
+ this.$documentUtils.addAssociation(this.document, this.document.main_waypoint);
}
+ },
- // on creation mode, if main waypoint is null, and some waypoints are associated, take the first
- if (this.mode === 'add' && this.document.main_waypoint_id === null && waypoints.length !== 0) {
- this.document.main_waypoint_id = waypoints[0].document_id;
- }
+ onWaypointsAssociation() {
+ const waypoints = this.document.associations.waypoints;
+ // clear removed waypoints
+ this.document.starting_waypoints = this.document.starting_waypoints.filter((waypoint) =>
+ waypoints.some((doc) => doc.document_id === waypoint.document_id)
+ );
+ this.document.ending_waypoints = this.document.ending_waypoints.filter((waypoint) =>
+ waypoints.some((doc) => doc.document_id === waypoint.document_id)
+ );
},
handleRockFreeRating(climbingType) {
+ if (!this.document || !this.document.rock_free_rating) return;
const documentRating = this.document.rock_free_rating;
const ratings = this.fields.rock_free_rating.values;
switch (climbingType) {
@@ -258,6 +301,25 @@ export default {
this.fields.rock_free_rating.values = ratings.map((grade) => grade.toLowerCase());
}
},
+
+ filterAccessWaypoints(doc) {
+ return doc.waypoint_type && doc.waypoint_type === 'access';
+ },
+
+ filterStartingWaypoints(waypoint) {
+ return this.$documentUtils.isInArray(this.document.starting_waypoints, waypoint);
+ },
+
+ filterIntermediateWaypoints(waypoint) {
+ return (
+ !this.$documentUtils.isInArray(this.document.starting_waypoints, waypoint) &&
+ !this.$documentUtils.isInArray(this.document.ending_waypoints, waypoint)
+ );
+ },
+
+ filterEndingWaypoints(waypoint) {
+ return this.$documentUtils.isInArray(this.document.ending_waypoints, waypoint);
+ },
},
};
diff --git a/src/views/wiki/edition/utils/AssociationsInputRow.vue b/src/views/wiki/edition/utils/AssociationsInputRow.vue
index ca8342e5e2..5eddf4c797 100644
--- a/src/views/wiki/edition/utils/AssociationsInputRow.vue
+++ b/src/views/wiki/edition/utils/AssociationsInputRow.vue
@@ -8,18 +8,27 @@