- add titles and abstracts in edit form
This commit is contained in:
parent
fef6dea98d
commit
f6442b5f7a
11 changed files with 344 additions and 152 deletions
|
@ -56,15 +56,41 @@ export default class EditDataset extends Vue {
|
|||
elevation = "no_elevation";
|
||||
depth = "no_depth";
|
||||
time = "no_time";
|
||||
titleTypes = [];
|
||||
|
||||
get remainingTitleTypes() {
|
||||
// this.titleTypes.filter(e => e != 'Main');
|
||||
var filtered = Object.fromEntries(Object.entries(this.titleTypes).filter(([k,v]) => v != 'Main'));
|
||||
return filtered;
|
||||
}
|
||||
|
||||
beforeMount() {
|
||||
// this.form = window.Laravel.form;
|
||||
this.realMerge(this.form, window.Laravel.form);
|
||||
this.titleTypes = window.Laravel.titleTypes;
|
||||
this.descriptionTypes = window.Laravel.descriptionTypes;
|
||||
this.languages = window.Laravel.languages;
|
||||
this.projects = window.Laravel.projects;
|
||||
this.licenses = window.Laravel.licenses;
|
||||
this.checkeds = window.Laravel.checkeds;
|
||||
this.referenceTypes = window.Laravel.referenceTypes;
|
||||
this.relationTypes = window.Laravel.relationTypes;
|
||||
|
||||
|
||||
}
|
||||
|
||||
created() {
|
||||
// add the required rule
|
||||
VeeValidate.Validator.extend('translatedLanguage', {
|
||||
getMessage: field => 'The translated ' + field + ' must be in a language other than than the dataset language.',
|
||||
validate: (value, [mainLanguage, type]) => {
|
||||
if (type == "Translated") {
|
||||
return value !== mainLanguage;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mounted() {
|
||||
|
@ -207,14 +233,30 @@ export default class EditDataset extends Vue {
|
|||
this.form.references.splice(key, 1);
|
||||
}
|
||||
|
||||
// @Watch('form.coverage.time_absolut')
|
||||
// onTimeAbsolutChanged(val) {
|
||||
// this.time = "absolut";
|
||||
// }
|
||||
addTitle() {
|
||||
let newTitle = { value: '', language: this.form.language, type: '' };
|
||||
//this.dataset.files.push(uploadedFiles[i]);
|
||||
this.form.titles.push(newTitle);
|
||||
}
|
||||
|
||||
// @Watch('form.coverage.time_min')
|
||||
// onTimeMinChanged(val) {
|
||||
// this.time = "range";
|
||||
// }
|
||||
/*
|
||||
Removes a selected title
|
||||
*/
|
||||
removeTitle(key) {
|
||||
this.form.titles.splice(key, 1);
|
||||
}
|
||||
|
||||
addDescription() {
|
||||
let newTitle = { value: '', language: this.form.language, type: '' };
|
||||
//this.dataset.files.push(uploadedFiles[i]);
|
||||
this.form.abstracts.push(newTitle);
|
||||
}
|
||||
|
||||
/*
|
||||
Removes a selected description
|
||||
*/
|
||||
removeDescription(key) {
|
||||
this.form.abstracts.splice(key, 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -131,6 +131,16 @@ export default class Dataset extends Vue {
|
|||
onLanguageChanged(val) {
|
||||
this.title_main.language = val;
|
||||
this.abstract_main.language = val;
|
||||
for (let [key, title] of Object.entries(this.titles)) {
|
||||
if (title.type == "Main") {
|
||||
title.language = val;
|
||||
}
|
||||
}
|
||||
for (let [key, abstract] of Object.entries(this.abstracts)) {
|
||||
if (abstract.type == "Abstract") {
|
||||
abstract.language = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue