wizard for publishing: step 0

This commit is contained in:
Arno Kaimbacher 2019-03-19 18:04:41 +01:00
parent d9b26afb3f
commit 9d195c450e
10 changed files with 102 additions and 55 deletions

View file

@ -10,7 +10,7 @@ function initialState() {
project_id: "",
creating_corporation: "GBA Repository",
language: "en",
language: "",
embargo_date: "",
belongs_to_bibliography: 0,
@ -55,6 +55,12 @@ const dataset = new Vue({
// };
// this.reset(json);
},
watch: {
language(val) {
this.title_main.language = val;
this.abstract_main.language = val;
}
},
methods: {
reset() {
Object.assign(this.$data, initialState());

View file

@ -59,7 +59,7 @@ const app = new Vue({
isModalVisible: false,
step: 1,
step: 0,
dataset: dataset
// dataset: {
// type: '',
@ -101,6 +101,17 @@ const app = new Vue({
return value || options.some((option) => option[testProp]);
}
});
// add the required rule
VeeValidate.Validator.extend('translatedLanguage', {
getMessage: field => 'The translated title must be in a language other than than the dataset language.',
validate: (value, [mainLanguage, type]) => {
if (type == "translated") {
return value !== mainLanguage;
}
return true;
}
});
},
mounted() {
//this.step = 2;
@ -118,7 +129,7 @@ const app = new Vue({
},
isFailed() {
return this.currentStatus === STATUS_FAILED;
}
}
},
methods: {
@ -134,7 +145,7 @@ const app = new Vue({
this.uploadedFiles = [];
this.uploadError = null;
this.dataset.reset();//reset methods will trigger property changed.
this.step = 1;
this.step = 0;
},
retry() {
// reset form to initial state