Commit cfae6836 authored by Jean Rabreau's avatar Jean Rabreau
Browse files

🔀Merge branch 'feature/fix' into develop

parents 43a6020c 96498313
Pipeline #61457 passed with stages
in 4 minutes and 29 seconds
......@@ -46,6 +46,7 @@ export const en_US = {
close: "Close",
confirm: "Confirm",
delete: "Delete",
download: "Télécharger",
modify: "Modify",
remove: "Remove",
send: "Send",
......@@ -590,7 +591,7 @@ export const en_US = {
dismissManager: "Dismiss @.lower:project.manager",
removeMember: "Remove from project",
subtitles: {
managers: "{label} : {managers}",
managers: "{label}: {names}",
},
contributor: "Contributor",
search: "@:search.title in the @.lower:project.label",
......@@ -606,6 +607,7 @@ export const en_US = {
generalInfo: {
updated: "General info of this set have been updated",
},
initiator: "Started by:",
publisher: "Publisher",
template: "Metadata template",
count: "No set | {count} set | {count} sets",
......@@ -646,6 +648,12 @@ export const en_US = {
continue: "Continue with {method}",
},
template: {
csv: {
export: 'CSV export',
warning: 'Warning',
noOptions: `Exported file do not contain available options of fields such as select, checkboxes...
<br>Please keep this in mind while building your import file.`
},
label: 'Template',
plural: 'Templates',
scopes: {
......
......@@ -52,6 +52,7 @@ export const fr_FR = {
close: "Fermer",
confirm: "Confirmer",
delete: "Supprimer",
download: "Télécharger",
modify: "Modifier",
remove: "Retirer",
send: "Envoyer",
......@@ -604,7 +605,7 @@ export const fr_FR = {
dismissManager: "DĂ©stituer @.lower:project.manager",
removeMember: "Retirer du projet",
subtitles: {
managers: "{label} : {managers}",
managers: "{label} : {names}",
},
contributor: "Contributeur",
search: "@:search.title dans le @.lower:project.label",
......@@ -621,6 +622,7 @@ export const fr_FR = {
updated: "Les informations générales de l'ensemble ont bien été mises à jour",
},
publisher: "Éditeur",
initiator: "Initié par : {name}",
template: "Modèle de métadonnées",
count: "Aucun ensemble | {count} ensemble | {count} ensembles",
label: "Ensemble",
......@@ -660,6 +662,12 @@ export const fr_FR = {
continue: "Continuer avec {method}",
},
template: {
csv: {
export: 'Export CSV',
warning: 'Attention',
noOption: `Le fichier exporté ne contient pas les contraintes de saisie telles que des listes déroulantes, cases à cocher....
<br>Soyez y attentif lors de la construction de votre fichier d'import.`
},
label: 'Template',
plural: 'Templates',
scopes: {
......
......@@ -12,7 +12,7 @@ import {
/**
* @typedef {Object} SetItem
* @property {boolean} canEdit
* @property {boolean} canEdit - rights for project manager
* @property {string} description
* @property {string} id
* @property {boolean} isPublic
......@@ -44,9 +44,9 @@ import {
/**
* @typedef {Object} FileViewer
* @property {string} [component]
* @property {string} [fileId]
* @property {boolean} isDownloadable
* @property {string} [component] - name of component used to read the file
* @property {string} [fileId] - id of the MediaFile to be read
* @property {boolean} isDownloadable - control download button visibility
*/
/**
......@@ -54,6 +54,7 @@ import {
* @property {string|null} s - url to object's 48Ă—48 thumbnail
* @property {string|null} m - url to object's 64Ă—64 thumbnail
* @property {string|null} l - url to object's 128Ă—128 thumbnail
* @property {string|null} embed - url to object's 512Ă—512 thumbnail
*/
/**
......@@ -66,17 +67,18 @@ import {
/**
* @typedef {Object} PountItem
* @property {boolean} canEdit
* @property {boolean} canEdit - true if user is project manager or creator of this item
* @property {boolean} canBeShared - true if itself, its parents set and project are public
* @property {ItemCreator} creator
* @property {string} description
* @property {string} [id]
* @property {boolean} isPublic
* @property {MediaFile[]} mediaFiles
* @property {MetaData[]} metadata
* @property {Object} set
* @property {ThumbnailSource} thumbnails
* @property {string} title
* @property {FileViewer} viewer
* @property {Object} set - parent set details
* @property {ThumbnailSource} thumbnails - urls of thumbnails
* @property {string} title - 255 chars max
* @property {FileViewer} viewer - viewer parameters
*/
const initialItem = {
......
......@@ -170,6 +170,22 @@ const Template = {
{root: true}
))
},
/**
* export current template as csv
*/
exportCsv({getters}) {
const templateId = getters['current'].id
return authority.get(
`templates/${templateId}/export_as_csv`,
{responseType: 'arraybuffer'}
).then(response => {
let blob = new Blob([response.data], { type: 'application/csv' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = 'template.csv'
link.click()
})
},
/**
* Retrieve all templates of current project in store
*
......
......@@ -8,7 +8,7 @@
prepend-inner-icon="mdi-magnify"
@change="onSearch"
/>
<v-tabs v-model="tab">
<v-tabs v-model="activeTab">
<v-tab
v-for="tab in tabs"
:key="tab.id"
......@@ -17,7 +17,7 @@
</v-tab>
</v-tabs>
<v-divider />
<v-tabs-items v-model="tab">
<v-tabs-items v-model="activeTab">
<v-tab-item
v-for="tab in tabs"
:key="tab.id"
......@@ -106,7 +106,7 @@ export default {
data: function() {
return {
query: '',
tab: undefined,
activeTab: undefined,
tabsRoot: [ 'project', 'set' ],
tabs: {
project: {
......@@ -182,16 +182,17 @@ export default {
subtitles: function() {
let subtitles;
if (mode === 'project') {
const managers = result.managers.map(m => m.name).join(', ');
const names = result.managers.map(m => m.name).join(', ');
const label = that.$tc('project.managers', result.managers.length)
subtitles = [
`${that.$t('project.subtitles.managers', { managers, label: that.$tc('project.managers', result.managers.length) })}`,
`${that.$tc('set.count', result.publicSetsCount)}`,
`${that.$tc('item.count', result.publicItemsCount)}`,
that.$t('project.subtitles.managers', { names, label }),
that.$tc('set.count', result.publicSetsCount),
that.$tc('item.count', result.publicItemsCount),
];
} else if (mode === 'set') {
subtitles = [
`${that.$t('item.fields.creator.label')} : ${result.creator.name}`,
`${that.$tc('item.count', result.publicItemsCount)}`,
that.$t('set.initiator', { name: result.creator.name}),
that.$tc('item.count', result.publicItemsCount),
];
}
return subtitles;
......
......@@ -333,13 +333,14 @@ export default {
crudListItems() {
return this.projectList.pageContent
.map((project) => {
const managers = project.managers.map(m => m.name).join(', ');
const names = project.managers.map(m => m.name).join(', ');
const label = this.$tc('project.managers', project.managers.length)
return {
id: project.id,
title: this.textTruncate(project.name, 50),
subtitle: `${this.$t('project.subtitles.managers', { managers, label: this.$tc('project.managers', project.managers.length) })}`,
subtitle: this.$t('project.subtitles.managers', { names, label }),
description: this.textTruncate(this.stripHtml(project.description), 150),
thumbnail: project.thumbnails.m,
thumbnail: project.thumbnails.embed,
to: { name: 'projectPublic', params: { projectId: project.id } },
}
});
......
......@@ -80,12 +80,13 @@ export default {
computed: {
...mapState('project', { project: 'current' }),
itemHeader() {
const managers = this.project.managers.map(m => m.name).join(', ');
const names = this.project.managers.map(m => m.name).join(', ');
const label = this.$tc('project.managers', this.project.managers.length)
return {
thumbnail: this.project.thumbnails.m,
title: this.project.name,
subtitles: [
`${this.$t('project.subtitles.managers', { managers, label: this.$tc('project.managers', this.project.managers.length) })}`,
this.$t('project.subtitles.managers', { names, label }),
],
};
},
......
......@@ -69,12 +69,13 @@ export default {
computed: {
...mapState('community', ['currentProject', 'setList']),
project() {
const managers = this.currentProject.managers.map(m => m.name).join(', ');
const names = this.currentProject.managers.map(m => m.name).join(', ');
const label = this.$tc('project.managers', this.currentProject.managers.length)
return {
thumbnail: this.currentProject.thumbnails.m,
title: this.currentProject.name,
subtitles: [
`${this.$t('project.subtitles.managers', { managers, label: this.$tc('project.managers', this.currentProject.managers.length) })}`,
this.$t('project.subtitles.managers', { names, label }),
],
description: this.currentProject.description,
};
......@@ -85,7 +86,7 @@ export default {
id: set.id,
title: this.textTruncate(set.title, 50),
description: this.textTruncate(this.stripHtml(set.description), 150),
thumbnail: set.thumbnails.m,
thumbnail: set.thumbnails.embed,
to: { name: 'setPublic', params: { setId: set.id } },
}));
},
......
......@@ -126,7 +126,6 @@ export default {
thumbnail: this.set.thumbnails.m,
title: this.set.title,
subtitles: [
`${this.$t('set.publisher')}: ${this.set.publisher}`,
{ label: this.$t('project.label'), value: this.set.project.name, to: { name: 'projectSets', params: { projectId: this.set.project.id } } },
this.visibility,
],
......
......@@ -133,8 +133,9 @@ export default {
thumbnail: this.currentSet.thumbnails.m,
title: this.currentSet.title,
subtitles: [
`${this.$t('set.publisher')}: ${this.currentSet.publisher}`,
...this.embed ? [] : [{ label: this.$t('project.label'), value: this.currentSet.project.name, to: { name: 'projectPublic', params: { projectId: this.currentSet.project.id } } }],
...this.embed
? []
: [{ label: this.$t('project.label'), value: this.currentSet.project.name, to: { name: 'projectPublic', params: { projectId: this.currentSet.project.id } } }],
],
description: this.currentSet.description,
};
......
......@@ -7,6 +7,15 @@
<v-card-title>
{{ template.name }}
<v-spacer />
<v-btn
class="mr-2"
tile
elevation="0"
color="secondary"
@click="csvOpen = true"
>
{{ $t('template.csv.export') }}
</v-btn>
<v-btn
v-if="template.scope > 2"
tile
......@@ -32,6 +41,19 @@
:is-submit-button-displayed="false"
/>
</v-card-text>
<v-dialog v-model="csvOpen">
<v-card>
<v-card-title>
{{ $t ('template.csv.warning') }}
</v-card-title>
<v-card-text v-html="$t ('template.csv.noOption')">
</v-card-text>
<v-card-actions>
<v-btn @click="csvOpen = false">{{$t('btn.cancel')}}</v-btn>
<v-btn @click="csvExport">{{$t('btn.download')}}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card>
</template>
......@@ -58,6 +80,7 @@ export default {
TemplateForm,
},
data: () => ({
csvOpen: false,
editMode: false,
}),
computed: {
......@@ -65,6 +88,11 @@ export default {
},
methods: {
...mapActions('template', ['updateTemplate']),
csvExport() {
this.$store.dispatch('template/exportCsv').then(() => {
this.csvOpen = false
})
},
onSaveTemplate(template) {
this.updateTemplate( {
...this.template,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment