From 3d9325a9372bc507a503f1ddabb1734d86f2bfe8 Mon Sep 17 00:00:00 2001 From: Nayor Date: Sun, 5 May 2024 16:16:18 +0200 Subject: [PATCH] feat:#3936 selecting starting and ending waypoints for a route - Starting points and ending points can be selected using a document input - They are stored in route specific field because the generic data structure isn't made to have specific information in a route-waypoint association - The entire waypoint object is stored in order to use it easily - Ending waypoints are always available in order to avoid back and forth with activity type - Only access waypoints are displayed - Fhe filter is done after the research - Possible improvement: add a filter on the api call - All waypoints (start, end and intermediate) are still stored in document's waypoints attribute - In order to avoid any data/api breaking changes - Allow waypoint suppression directly from associationInputRow --- .../generics/inputs/InputDocument.vue | 10 +++- src/js/associations-rights-mixin.js | 5 ++ src/js/constants/documentsProperties.json | 2 + src/translations/ca.json | 2 + src/translations/de.json | 2 + src/translations/es.json | 2 + src/translations/eu.json | 2 + src/translations/fr.json | 4 +- src/translations/hu.json | 5 ++ src/translations/it.json | 2 + src/translations/ru.json | 2 + src/translations/sl.json | 2 + src/translations/zh_CN.json | 2 + src/views/wiki/edition/RouteEditionView.vue | 51 ++++++++++++++++++- .../edition/utils/AssociationsInputRow.vue | 39 ++++++++++---- src/views/wiki/edition/utils/FormInput.vue | 18 ++++++- 16 files changed, 134 insertions(+), 16 deletions(-) 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 }}
- +
-
- -
+
@@ -47,6 +56,16 @@ export default { type: String, default: undefined, // default must be undefined. null means explicit no helper }, + + cardsFilter: { + type: Function, + default: () => true, + }, + + optionsFilter: { + type: Function, + default: (doc) => doc, + }, }, computed: { @@ -60,7 +79,7 @@ export default { methods: { showDeleteButton(document) { - return this.canRemove(this.document, document); // ! FIXME import mixin + return this.canRemove(this.document, document); }, }, }; diff --git a/src/views/wiki/edition/utils/FormInput.vue b/src/views/wiki/edition/utils/FormInput.vue index 74c041f327..e59b00942a 100644 --- a/src/views/wiki/edition/utils/FormInput.vue +++ b/src/views/wiki/edition/utils/FormInput.vue @@ -46,7 +46,8 @@ multiple clear-input-on-toggle :has-error="hasError" - @add="$documentUtils.propagateProperties(document, arguments[0])" + @add="onAdd" + :options-filter="optionsFilter" v-model="object[field.name]" /> @@ -115,7 +116,9 @@ import InputConditionsLevels from './InputConditionsLevels'; import { requireDocumentProperty, requireFieldProperty } from '@/js/properties-mixins'; export default { - components: { InputConditionsLevels }, + components: { + InputConditionsLevels, + }, mixins: [requireFieldProperty, requireDocumentProperty], @@ -148,6 +151,10 @@ export default { type: Number, default: undefined, }, + optionsFilter: { + type: Function, + default: (doc) => doc, + }, }, computed: { @@ -191,5 +198,12 @@ export default { return this.field.error !== null; }, }, + + methods: { + onAdd(child) { + this.$documentUtils.propagateProperties(this.document, arguments[0]); + this.$emit('add', child); + }, + }, };