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..889b79665e 100644
--- a/src/js/associations-rights-mixin.js
+++ b/src/js/associations-rights-mixin.js
@@ -94,6 +94,11 @@ export default {
return child.author.user_id === this.$user.id;
}
+ // technical limitation, a route should at least have one waypoint
+ if (child.type === 'w' && (parent.type !== 'r' || parent.associations.waypoints?.length > 1)) {
+ return true;
+ }
+
return false;
},
},
diff --git a/src/js/constants/documentsProperties.json b/src/js/constants/documentsProperties.json
index eb1709da1e..d1e4abe6f1 100644
--- a/src/js/constants/documentsProperties.json
+++ b/src/js/constants/documentsProperties.json
@@ -341,6 +341,7 @@
]
}
},
+ { "id": "ending_waypoints" },
{
"id": "engagement_rating",
"properties": {
@@ -501,6 +502,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/translations/ca.json b/src/translations/ca.json
index 264ce3bc69..4f59747d3f 100644
--- a/src/translations/ca.json
+++ b/src/translations/ca.json
@@ -915,6 +915,7 @@
"quality_types": "buit"
},
"empty comment": "comentari buit",
+ "ending waypoints": "punts d'arribada",
"en": {
"langs": "anglès"
},
@@ -1612,6 +1613,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..25f99d8a67 100644
--- a/src/translations/de.json
+++ b/src/translations/de.json
@@ -1159,6 +1159,7 @@
"quality_types": "leer"
},
"empty comment": "leerer Kommentar",
+ "ending waypoints": "ankunftsorte",
"en": {
"langs": "englisch"
},
@@ -1906,6 +1907,7 @@
"stories": {
"article_categories": "Geschichten"
},
+ "starting waypoints": "startpunkte",
"strava": "Strava",
"strong text": "fetter Text",
"summary": "Überblick",
diff --git a/src/translations/es.json b/src/translations/es.json
index aa90e08cbf..0c7b7b5ac9 100644
--- a/src/translations/es.json
+++ b/src/translations/es.json
@@ -815,6 +815,7 @@
"quality_types": "vacío"
},
"empty comment": "comentario vacío",
+ "ending waypoints": "puntos de llegada",
"en": {
"langs": "inglés"
},
@@ -1460,6 +1461,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..7a6bae4ba9 100644
--- a/src/translations/fr.json
+++ b/src/translations/fr.json
@@ -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"
},
@@ -1717,6 +1718,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..a5d1e387a4 100644
--- a/src/translations/hu.json
+++ b/src/translations/hu.json
@@ -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"
},
@@ -1582,6 +1586,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..e521cc3cc6 100644
--- a/src/translations/it.json
+++ b/src/translations/it.json
@@ -1055,6 +1055,7 @@
"quality_types": "vuoto"
},
"empty comment": "commento vuoto",
+ "ending waypoints": "punti di arrivo",
"en": {
"langs": "inglese"
},
@@ -1775,6 +1776,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..55f2935264 100644
--- a/src/translations/ru.json
+++ b/src/translations/ru.json
@@ -697,6 +697,7 @@
"quality_types": "пустой"
},
"empty comment": "пустой комментарий",
+ "ending waypoints": "пункты прибытия",
"en": {
"langs": "английский"
},
@@ -1079,6 +1080,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..de65f67743 100644
--- a/src/translations/sl.json
+++ b/src/translations/sl.json
@@ -1089,6 +1089,7 @@
"quality_types": "prazno"
},
"empty comment": "prazni komentar",
+ "ending waypoints": "točke prihoda",
"en": {
"langs": "angleščina"
},
@@ -1826,6 +1827,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..555b992756 100644
--- a/src/translations/zh_CN.json
+++ b/src/translations/zh_CN.json
@@ -1087,6 +1087,7 @@
"quality_types": "空白"
},
"empty comment": "空白评论",
+ "ending waypoints": "到达点",
"en": {
"langs": "English"
},
@@ -1833,6 +1834,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..a6fd3475a3 100644
--- a/src/views/wiki/edition/RouteEditionView.vue
+++ b/src/views/wiki/edition/RouteEditionView.vue
@@ -25,7 +25,27 @@
-
+
+
+
@@ -209,6 +229,8 @@ export default {
if (this.mode === 'add' && this.$route.query.w) {
this.document.main_waypoint_id = parseInt(this.$route.query.w);
}
+ this.document.starting_waypoints = []; // TODO waiting for api upgrade, remove before merging
+ this.document.ending_waypoints = []; // TODO waiting for api upgrade, remove before merging
},
beforeSave() {
@@ -239,6 +261,14 @@ export default {
this.document.main_waypoint_id = null;
}
+ // clear removed waypoints
+ this.document.starting_waypoints = this.document.starting_waypoints.filter(
+ (waypoint) => waypoints.findIndex((doc) => doc.document_id === waypoint.document_id) !== -1
+ );
+ this.document.ending_waypoints = this.document.ending_waypoints.filter(
+ (waypoint) => waypoints.findIndex((doc) => doc.document_id === waypoint.document_id) !== -1
+ );
+
// 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;
@@ -258,6 +288,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 @@