From 4cbff9aa1a0b4b1e569c1b9ce3377a38170643d6 Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Fri, 20 Oct 2023 13:47:27 +0200 Subject: [PATCH 01/41] Create step component + add chantier --- src/components/CreateBouquetStep1.vue | 101 ++++++++++++ src/components/CreateBouquetStep2.vue | 204 +++++++++++++++++++++++++ src/views/bouquets/BouquetEditView.vue | 113 +++++--------- 3 files changed, 347 insertions(+), 71 deletions(-) create mode 100644 src/components/CreateBouquetStep1.vue create mode 100644 src/components/CreateBouquetStep2.vue diff --git a/src/components/CreateBouquetStep1.vue b/src/components/CreateBouquetStep1.vue new file mode 100644 index 000000000..bd4f66160 --- /dev/null +++ b/src/components/CreateBouquetStep1.vue @@ -0,0 +1,101 @@ + + + \ No newline at end of file diff --git a/src/components/CreateBouquetStep2.vue b/src/components/CreateBouquetStep2.vue new file mode 100644 index 000000000..a72b0ca8c --- /dev/null +++ b/src/components/CreateBouquetStep2.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/src/views/bouquets/BouquetEditView.vue b/src/views/bouquets/BouquetEditView.vue index e6be7b791..b712a4b66 100644 --- a/src/views/bouquets/BouquetEditView.vue +++ b/src/views/bouquets/BouquetEditView.vue @@ -1,14 +1,14 @@ From bbf8556936fa06c477acd10df67608c7c283e77b Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Sun, 5 Nov 2023 17:48:24 +0100 Subject: [PATCH 20/41] Edit default text --- src/views/bouquets/BouquetEditView.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/bouquets/BouquetEditView.vue b/src/views/bouquets/BouquetEditView.vue index caf6f523d..9156e46eb 100644 --- a/src/views/bouquets/BouquetEditView.vue +++ b/src/views/bouquets/BouquetEditView.vue @@ -265,7 +265,7 @@
From 9eed5f32b9f5c85b39575e32304dbb293e5574d2 Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Mon, 6 Nov 2023 09:39:24 +0100 Subject: [PATCH 21/41] Remove code --- src/views/bouquets/BouquetEditView.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/bouquets/BouquetEditView.vue b/src/views/bouquets/BouquetEditView.vue index 9156e46eb..fd669d8f0 100644 --- a/src/views/bouquets/BouquetEditView.vue +++ b/src/views/bouquets/BouquetEditView.vue @@ -361,7 +361,6 @@

Aucune donnée ajoutée

- {{ datasetProperty }}
  • Date: Mon, 6 Nov 2023 18:10:30 +0100 Subject: [PATCH 22/41] Add Step4 + Custom Bouquet page --- src/assets/main.css | 6 +- src/views/bouquets/BouquetDetailView.vue | 114 ++++++++-------- src/views/bouquets/BouquetEditView.vue | 158 ++++++++++++++++++----- 3 files changed, 188 insertions(+), 90 deletions(-) diff --git a/src/assets/main.css b/src/assets/main.css index e82a45bfb..0d4aa5d22 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -18,4 +18,8 @@ .align-center { align-items: center; -} \ No newline at end of file +} + +.block { + display: block; +} diff --git a/src/views/bouquets/BouquetDetailView.vue b/src/views/bouquets/BouquetDetailView.vue index a332cfcaa..b63629305 100644 --- a/src/views/bouquets/BouquetDetailView.vue +++ b/src/views/bouquets/BouquetDetailView.vue @@ -4,7 +4,6 @@ import { useRoute, useRouter } from 'vue-router' import config from '@/config' -import Tile from '../../components/Tile.vue' import { useDatasetStore } from '../../store/DatasetStore' import { useTopicStore } from '../../store/TopicStore' import { useUserStore } from '../../store/UserStore' @@ -20,8 +19,8 @@ const datasets = ref([]) const description = computed(() => descriptionFromMarkdown(bouquet)) -const goToEdit = () => { - router.push({ name: 'bouquet_edit', params: { bid: bouquet.value.slug } }) +const goToCreate = () => { + router.push({ name: 'bouquet_add' }) } const canEdit = computed(() => { @@ -32,7 +31,6 @@ const canEdit = computed(() => { ) }) - onMounted(() => { store.load(route.params.bid).then((res) => { bouquet.value = res @@ -46,62 +44,70 @@ onMounted(() => { + + diff --git a/src/views/bouquets/BouquetEditView.vue b/src/views/bouquets/BouquetEditView.vue index fd669d8f0..342c7f5f0 100644 --- a/src/views/bouquets/BouquetEditView.vue +++ b/src/views/bouquets/BouquetEditView.vue @@ -5,6 +5,7 @@ import { useRouter, useRoute } from 'vue-router' import SearchAPI from '../../services/api/SearchAPI' import config from '@/config' + import { descriptionFromMarkdown } from '@/utils' import Tooltip from '@/components/Tooltip.vue' import Multiselect from '@vueform/multiselect' @@ -25,21 +26,19 @@ [`${config.universe.name}:datasets_properties`]: [] }) const isEditDesc = ref(false) - const isFormValidated = ref(false) const errorMessage = ref() - const steps = [ - 'Description du bouquet de données', - 'Informations du bouquet de données', - 'Composition du bouquet', - 'Récapitulatif' - ] - const selectedTheme = ref(null); const selectedSubTheme = ref(null) const currentStep = ref(1) const libelle = ref() const raison = ref() const urlData = ref() + const steps = [ + 'Description du bouquet de données', + 'Informations du bouquet de données', + 'Composition du bouquet', + 'Récapitulatif' + ] const themes = computed(() => config.themes) @@ -60,6 +59,12 @@ })) }) + const isDatasetPropertyEmpty = computed(() => { + return datasetProperty.value[`${config.universe.name}:datasets_properties`].length + }) + + const description = computed(() => descriptionFromMarkdown(form)) + const onThemeChanged = () => { selectedSubTheme.value = null; } @@ -80,15 +85,6 @@ return extras } - const informationsInExtras = { - [`${config.universe.name}:informations`]: [ - { - theme: selectedTheme.value, - subtheme: selectedSubTheme.value - } - ] - } - let nextId = 0 const addDatasetPropertysToExtras = async () => { const setUri = urlData.value ? urlData.value : null @@ -142,10 +138,7 @@ if (!form.value.name || !form.value.description) { errorMessage.value = 'Merci de bien remplir les champs' } else { - isFormValidated.value = true - setTimeout(() => { - currentStep.value = newStep - }, 1000) + currentStep.value = newStep } } @@ -154,6 +147,15 @@ const data = { ...form.value } + const informationsInExtras = { + [`${config.universe.name}:informations`]: [ + { + theme: selectedTheme.value, + subtheme: selectedSubTheme.value + } + ] + } + if (isCreate) { res = await topicStore.create({ ...data, @@ -188,6 +190,7 @@ onMounted(() => { if (!isCreate) { topicStore.load(route.params.bid).then((data) => { + // TODO: AFFICHER AU EDIT LES VALEURS INFORMATIONS, LIBELLE & RAISON loadedBouquet.value = data form.value.name = data.name form.value.description = data.description @@ -210,12 +213,6 @@
    -
    @@ -293,6 +291,7 @@ type="button" class="fr-mt-2w" label="Suivant" + :disabled="!selectedSubTheme" @click.prevent="validateAndMoveToStep(3)" />
    @@ -320,11 +319,12 @@

    -

    Données sélectionnées ({{ datasetProperty.length }})

    -
    +

    Données sélectionnées ({{ isDatasetPropertyEmpty }})

    +

    Aucune donnée ajoutée

    -
    +
  • - +
  • + +
    +

    Informations du bouquet + +

    + +

    Sujet du bouquet

    +

    +

    Thématique

    +

    +

    Chantier

    +

    +


    + +

    Description du bouquet

    +

    Objectif du bouquet

    +

    +


    + +

    Composition du bouquet

    +
    + +
  • + +
    + {{ property.raison }} +
    + +
    +
  • +
    +
    + + +
    + @@ -415,6 +489,7 @@ display: flex; align-items: center; justify-content: flex-end; + text-align: center; } :deep .tooltip { @@ -431,4 +506,17 @@ left: 46%; } } + +.markdown__description { + :deep a { + color: var(--text-action-high-blue-france); + } +} + +.fr-accordions-group { + border: { + left: 1px solid var(--border-default-grey); + right: 1px solid var(--border-default-grey); + } +} From 00009c14b409bbbd3c9febd5ecaf4fc39425051f Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Tue, 7 Nov 2023 15:15:39 +0100 Subject: [PATCH 23/41] Display data when bouquet is created on edit page --- src/views/bouquets/BouquetEditView.vue | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/views/bouquets/BouquetEditView.vue b/src/views/bouquets/BouquetEditView.vue index 342c7f5f0..39868822c 100644 --- a/src/views/bouquets/BouquetEditView.vue +++ b/src/views/bouquets/BouquetEditView.vue @@ -27,7 +27,7 @@ }) const isEditDesc = ref(false) const errorMessage = ref() - const selectedTheme = ref(null); + const selectedTheme = ref(null) const selectedSubTheme = ref(null) const currentStep = ref(1) const libelle = ref() @@ -66,7 +66,7 @@ const description = computed(() => descriptionFromMarkdown(form)) const onThemeChanged = () => { - selectedSubTheme.value = null; + selectedSubTheme.value = null } const search = async (query) => { @@ -88,7 +88,7 @@ let nextId = 0 const addDatasetPropertysToExtras = async () => { const setUri = urlData.value ? urlData.value : null - + if (libelle.value && raison.value) { if (selectedDataset.value.id) { const dataset = await datasetStore.load(selectedDataset.value.id) @@ -127,10 +127,10 @@ const onDeleteDataset = (datasetId) => { if (datasetProperty.value && datasetProperty.value[`${config.universe.name}:datasets_properties`]) { - datasetProperty.value[`${config.universe.name}:datasets_properties`] = datasetProperty.value[`${config.universe.name}:datasets_properties`].filter((d) => d.id !== datasetId); + datasetProperty.value[`${config.universe.name}:datasets_properties`] = datasetProperty.value[`${config.universe.name}:datasets_properties`].filter((d) => d.id !== datasetId) } if (loadedBouquet.value.extras) { - delete loadedBouquet.value.extras[`${config.universe.name}:${datasetId}:description`]; + delete loadedBouquet.value.extras[`${config.universe.name}:${datasetId}:description`] } } @@ -190,10 +190,20 @@ onMounted(() => { if (!isCreate) { topicStore.load(route.params.bid).then((data) => { - // TODO: AFFICHER AU EDIT LES VALEURS INFORMATIONS, LIBELLE & RAISON + const datasetProperties = data.extras[`${config.universe.name}:datasets_properties`].map(property => { + return { + datagouvId: property.datagouvId, + libelle: property.libelle, + raison: property.raison, + uri: property.uri + } + }) loadedBouquet.value = data form.value.name = data.name form.value.description = data.description + selectedTheme.value = data.extras[`${config.universe.name}:informations`][0].theme + selectedSubTheme.value = data.extras[`${config.universe.name}:informations`][0].subtheme + datasetProperty.value[`${config.universe.name}:datasets_properties`] = datasetProperties loadDatasets(data.datasets.map(d => d.id), data) }) } @@ -469,7 +479,6 @@ label="Terminer" /> - From c45e53282de5c99aa3203cd77d90315d58ca5bce Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Tue, 7 Nov 2023 15:21:54 +0100 Subject: [PATCH 24/41] Edit config --- configs/ecospheres/config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/ecospheres/config.yaml b/configs/ecospheres/config.yaml index ebf7b7637..91687e889 100644 --- a/configs/ecospheres/config.yaml +++ b/configs/ecospheres/config.yaml @@ -55,7 +55,7 @@ website: # display settings organizations_list_page_size: 9 -# List of themes and sub themes for step 2 +# For step 2 of bouquet creation themes: - name: Produire subthemes: @@ -85,10 +85,10 @@ themes: subthemes: - name: Consommation plus durable (ménages) - name: Numérique responsable - - name: Achats durables (de l’État, des collectivités et des entreprises) + - name: Achats durables (de l'État, des collectivités et des entreprises) - name: Chantiers transverses subthemes: - - name: Le financement qui permet de définir des trajectoires d’investissement crédibles et cohérentes + - name: Le financement qui permet de définir des trajectoires d'investissement crédibles et cohérentes - name: La planification et la différenciation territoriale selon les caractéristiques et les spécificités de chaque territoire, incluant les territoires ultra-marins - name: La transition des filières avec la gestion des emplois, des formations et des compétences - name: Les données environnementales From 0b83173bfe8d60265aa013eb4967fff954bc95e1 Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Tue, 7 Nov 2023 15:30:10 +0100 Subject: [PATCH 25/41] Edit path --- src/views/bouquets/BouquetEditView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/bouquets/BouquetEditView.vue b/src/views/bouquets/BouquetEditView.vue index 39868822c..973383e5b 100644 --- a/src/views/bouquets/BouquetEditView.vue +++ b/src/views/bouquets/BouquetEditView.vue @@ -3,7 +3,7 @@ import { useDatasetStore } from '@/store/DatasetStore' import { useTopicStore } from '@/store/TopicStore' import { useRouter, useRoute } from 'vue-router' - import SearchAPI from '../../services/api/SearchAPI' + import SearchAPI from '@/services/api/SearchAPI' import config from '@/config' import { descriptionFromMarkdown } from '@/utils' import Tooltip from '@/components/Tooltip.vue' From 3dc69662987a576794eff545ce16002e38b3f940 Mon Sep 17 00:00:00 2001 From: Marvin SAURAYE Date: Tue, 7 Nov 2023 15:44:04 +0100 Subject: [PATCH 26/41] use lint --- src/views/bouquets/BouquetDetailView.vue | 4 ++-- src/views/bouquets/BouquetEditView.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/bouquets/BouquetDetailView.vue b/src/views/bouquets/BouquetDetailView.vue index b63629305..aee4c6a24 100644 --- a/src/views/bouquets/BouquetDetailView.vue +++ b/src/views/bouquets/BouquetDetailView.vue @@ -23,7 +23,7 @@ const goToCreate = () => { router.push({ name: 'bouquet_add' }) } -const canEdit = computed(() => { +const canCreate = computed(() => { return ( userStore.isAdmin() || (userStore.$state.isLoggedIn && @@ -54,7 +54,7 @@ onMounted(() => { /> Date: Tue, 7 Nov 2023 15:53:17 +0100 Subject: [PATCH 27/41] Run format --- src/components/Tooltip.vue | 2 +- src/views/bouquets/BouquetDetailView.vue | 28 +- src/views/bouquets/BouquetEditView.vue | 524 +++++++++++++---------- 3 files changed, 314 insertions(+), 240 deletions(-) diff --git a/src/components/Tooltip.vue b/src/components/Tooltip.vue index 5730ec011..3083c8f09 100644 --- a/src/components/Tooltip.vue +++ b/src/components/Tooltip.vue @@ -13,7 +13,7 @@ const props = defineProps(['title', 'name', 'show', 'text']) @mouseout="show = false" @click.prevent="show = !show" @blur="show = false" - > + > { .then((ds) => (datasets.value = ds)) }) }) -