-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/form decomposition #223
Merged
Merged
Changes from 50 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
c472f43
add step 1 - subcomponent
edelagnier 15d411b
add step 3 - (component + form inside component)
edelagnier ee1c438
add step 4 - with data from sub-component
edelagnier 8181439
Merge branch 'spike/divide_editBouquetCmpt' into feature/form_decompo…
edelagnier 300557e
rename item -> properties
edelagnier 57c5078
set new form in form page
edelagnier 0bbe683
Merge branch 'feature/search_by_subtheme' into feature/form_decomposi…
edelagnier 36c88fb
clean import
edelagnier 1a6e31e
remove step 1 from bigform
edelagnier c56096f
handle step validation
edelagnier 343f6f1
extract options to configUtils
edelagnier cf57fe6
distinct Topic and BetaTopic
edelagnier 7a298b6
add step 2
edelagnier 8100d0a
create DatasetList vue
edelagnier 795437b
Merge branch 'main' into feature/form_decomposition
edelagnier fecf7de
Handle availability and source URL
edelagnier 5e4c70f
Merge branch 'main' into feature/form_decomposition
edelagnier 3413be2
handle accordeon
edelagnier 1d15c33
clarify validation is true by default
edelagnier e7fc28d
remove warning id is a number
edelagnier 335ff6d
handle remove added dataset
edelagnier b5a30b4
step 2 and 3 don't need validation
edelagnier 142d721
only display current step
edelagnier 687ba81
title of dataset list
edelagnier 919bd6c
standardize grid
edelagnier c7772db
declare emits
edelagnier 1f54c9e
standardize size of the stepper
edelagnier e510e9f
set uri of ecosphere dataset
edelagnier 72a66b6
clean up structure
edelagnier 5955f7f
use local vs eco id
edelagnier 1d7fbba
create topic
edelagnier 424effe
remove warning
edelagnier 3be93d9
add validation for step 2
edelagnier e266bad
handle validation for step 3 + global
edelagnier e9d2c7a
Merge branch 'main' into feature/form_decomposition
edelagnier 3c3813d
update to fix vulnerabilities
edelagnier 111ed02
Merge branch 'main' into feature/form_decomposition
edelagnier cc9cb6e
typo
edelagnier 7b57422
use topicform as bouquet edit view
edelagnier b273a5f
Merge branch 'main' into feature/form_decomposition
edelagnier ee691aa
prevent reload !
edelagnier aad57bb
redirect
edelagnier 806d455
improve layout
edelagnier db4f505
url is available
edelagnier 4e8d844
dataset form display
edelagnier 77bf7a5
add type
edelagnier a8782eb
disable subtheme if no theme
edelagnier a493f4e
Merge branch 'main' into feature/form_decomposition
edelagnier 0710ac6
fix markdown
edelagnier 93c8122
renaming
edelagnier dc83095
Merge branch 'main' into feature/form_decomposition
edelagnier 687e984
remove unused/duplicate
edelagnier 5f9a099
fix null label
edelagnier 26a330d
move bouquet to custom
edelagnier 4d00aa4
make tooltip info more accessible
edelagnier 10c4879
fix display of available tag
edelagnier a71bd8d
availability as enum
edelagnier b115fe9
Merge branch 'main' into feature/form_decomposition
edelagnier 9efd091
fix import
edelagnier 9f20dbe
markdown
edelagnier d9d6b04
fix behavior after merge
edelagnier 17c3df3
Merge branch 'main' into feature/form_decomposition
abulte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edelagnier marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<template> | ||
<div v-if="numberOfDatasets < 1" class="no-dataset"> | ||
<p>Ce bouquet ne contient pas encore de jeux de données</p> | ||
</div> | ||
<div v-else> | ||
<DsfrAccordionsGroup> | ||
<li v-for="(dataset, index) in datasets"> | ||
<DsfrAccordion | ||
:title="dataset.title" | ||
:id="getAccordeonId(index)" | ||
:expanded-id="isExpanded[getAccordeonId(index)]" | ||
@expand="isExpanded[getAccordeonId(index)] = $event" | ||
> | ||
<DsfrTag | ||
v-if="!isAvailable(dataset)" | ||
class="fr-mb-2w uppercase bold" | ||
:label="`${dataset.availability}`" | ||
/> | ||
<div> | ||
{{ dataset.purpose }} | ||
</div> | ||
<div class="button__wrapper"> | ||
<DsfrButton | ||
icon="ri-delete-bin-line" | ||
label="Retirer de la section" | ||
class="fr-mr-2w" | ||
@click.prevent="this.$emit('removeDataset', index)" | ||
/> | ||
<a | ||
v-if="!isAvailable(dataset)" | ||
class="fr-btn fr-btn--secondary inline-flex" | ||
:href="`mailto:${email}`" | ||
> | ||
Aidez-nous à trouver la donnée</a | ||
> | ||
<a | ||
v-if="dataset.uri" | ||
class="fr-btn fr-btn--secondary inline-flex" | ||
:href="dataset.uri" | ||
target="_blank" | ||
>Accéder au catalogue</a | ||
> | ||
</div> | ||
</DsfrAccordion> | ||
</li> | ||
</DsfrAccordionsGroup> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import config from '@/config' | ||
import { type DatasetProperties, Availability } from '@/model' | ||
|
||
export const getDatasetListTitle = function ( | ||
datasets: DatasetProperties[] | ||
): string { | ||
const title = 'Composition du bouquet ' | ||
const numberOfDatasets = datasets.length | ||
switch (numberOfDatasets) { | ||
case 0: { | ||
return title | ||
} | ||
case 1: { | ||
return title + '( 1 jeu de données )' | ||
} | ||
default: { | ||
return title + `( ${numberOfDatasets} jeux de données )` | ||
} | ||
} | ||
} | ||
|
||
export default { | ||
name: 'DatasetList', | ||
emits: ['removeDataset'], | ||
props: { | ||
datasets: { | ||
type: Array<DatasetProperties>, | ||
default: [] | ||
} | ||
}, | ||
data() { | ||
return { | ||
isExpanded: {} | ||
} | ||
}, | ||
computed: { | ||
email() { | ||
return config.website.contact_email | ||
}, | ||
numberOfDatasets(): number { | ||
return this.datasets.length | ||
} | ||
}, | ||
methods: { | ||
getAccordeonId(index: number): string { | ||
return `accordion_${index}` | ||
}, | ||
isAvailable(dataset: DatasetProperties): boolean { | ||
return Availability.isAvailable(dataset.availability) | ||
} | ||
} | ||
} | ||
</script> |
edelagnier marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edelagnier marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<template> | ||
<h4>{{ getDatasetListTitle() }}</h4> | ||
<DatasetList | ||
class="fr-mt-4w fr-mb-4w" | ||
@removeDataset="removeDataset" | ||
:datasets="datasets" | ||
/> | ||
<DatasetPropertiesForm | ||
@addDataset="addDataset" | ||
:alreadySelectedDatasets="datasets" | ||
/> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import DatasetList from '@/components/DatasetList.vue' | ||
import DatasetPropertiesForm from '@/components/forms/dataset/DatasetPropertiesForm.vue' | ||
import type { DatasetProperties } from '@/model' | ||
|
||
import { getDatasetListTitle } from '../../DatasetList.vue' | ||
|
||
export default { | ||
name: 'BouquetContentFieldGroup', | ||
components: { | ||
DatasetPropertiesForm: DatasetPropertiesForm, | ||
DatasetList: DatasetList | ||
}, | ||
props: { | ||
currentDatasets: { | ||
type: Array<DatasetProperties>, | ||
default: [] | ||
} | ||
}, | ||
data() { | ||
return { | ||
datasets: this.currentDatasets | ||
} | ||
}, | ||
watch: { | ||
isValid(newValue) { | ||
this.$emit('updateValidation', newValue) | ||
} | ||
}, | ||
computed: { | ||
isValid(): boolean { | ||
return this.datasets.length > 0 | ||
} | ||
}, | ||
methods: { | ||
addDataset(datasetProperties: DatasetProperties) { | ||
this.datasets.push(datasetProperties) | ||
this.$emit('update:datasets', this.datasets) | ||
}, | ||
removeDataset(index: number) { | ||
this.datasets.splice(index, 1) | ||
this.$emit('update:datasets', this.datasets) | ||
}, | ||
getDatasetListTitle() { | ||
return getDatasetListTitle(this.datasets) | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<h4> | ||
Description du bouquet de données | ||
<DsfrButton | ||
:icon-only="true" | ||
size="sm" | ||
icon="ri-pencil-line" | ||
title="Editer Étape 1" | ||
:tertiary="true" | ||
:no-outline="true" | ||
@click.prevent="goToStep(1)" | ||
/> | ||
</h4> | ||
|
||
<p class="fr-mb-0"><strong>Sujet du bouquet</strong></p> | ||
<p v-html="bouquet.name" /> | ||
<p class="fr-mb-0"><strong>Objectif du bouquet</strong></p> | ||
<p v-html="markdown(bouquet.description)" /> | ||
<hr /> | ||
|
||
<h4> | ||
Information du bouquet de données | ||
<DsfrButton | ||
:icon-only="true" | ||
size="sm" | ||
icon="ri-pencil-line" | ||
title="Editer Étape 2" | ||
:tertiary="true" | ||
:no-outline="true" | ||
@click.prevent="goToStep(2)" | ||
/> | ||
</h4> | ||
<p class="fr-mb-0"><strong>Thématique</strong></p> | ||
<p v-html="bouquet.theme" /> | ||
<p class="fr-mb-0"><strong>Chantier</strong></p> | ||
<p v-html="bouquet.subtheme" /> | ||
<hr /> | ||
|
||
<h4> | ||
{{ getDatasetListTitle() }} | ||
<DsfrButton | ||
:icon-only="true" | ||
size="sm" | ||
icon="ri-pencil-line" | ||
title="Editer Étape 3" | ||
:tertiary="true" | ||
:no-outline="true" | ||
@click.prevent="goToStep(3)" | ||
/> | ||
</h4> | ||
<DatasetList :datasets="bouquet.datasetsProperties" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import MarkdownIt from 'markdown-it' | ||
import type { PropType } from 'vue' | ||
|
||
import type { Bouquet } from '@/model' | ||
|
||
import DatasetList from '../../DatasetList.vue' | ||
import { getDatasetListTitle } from '../../DatasetList.vue' | ||
|
||
export default { | ||
name: 'BouquetFormRecap', | ||
emits: ['updateStep'], | ||
components: { | ||
DatasetList: DatasetList | ||
}, | ||
props: { | ||
bouquet: { | ||
type: Object as PropType<Partial<Bouquet>>, | ||
default: '' | ||
} | ||
}, | ||
computed: { | ||
numberOfDatasets(): number { | ||
return this.datasets.length | ||
}, | ||
compositionTitle(): string { | ||
const title = ' Composition du bouquet' | ||
return this.numberOfDatasets < 1 | ||
? title | ||
: title + `( ${this.numberOfDatasets} )` | ||
} | ||
}, | ||
methods: { | ||
goToStep(step: number) { | ||
this.$emit('updateStep', step) | ||
}, | ||
getDatasetListTitle() { | ||
return getDatasetListTitle(this.bouquet.datasetsProperties) | ||
}, | ||
markdown(text: string) { | ||
return MarkdownIt().render(text) | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A scoper dans un composant ? Ca me parait un peu dangereux en style global.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cf #223 (comment) , le comportement decrit (avoir une marge autour des champs) me parait suffisament generique pour etre mis par defaut au moins dans un premier temps et eviter que l'on ajoute la marge dans chaque composant