- contributorType in edit form of Editor

- contributorType in OAI
This commit is contained in:
Arno Kaimbacher 2020-05-05 22:13:10 +02:00
parent 3a2336adad
commit cf996de390
14 changed files with 45 additions and 19 deletions

View file

@ -119,7 +119,8 @@ export default class EditDataset extends Vue {
this.licenses = window.Laravel.licenses;
this.checkeds = window.Laravel.checkeds;
this.referenceTypes = window.Laravel.referenceTypes;
this.relationTypes = window.Laravel.relationTypes;
this.relationTypes = window.Laravel.relationTypes;
console.log(this.form);
}
created() {

View file

@ -53,8 +53,8 @@
data-vv-scope="step-1" />
</td>
<td v-if="Object.keys(contributortypes).length">
<select type="text" v-bind:name="heading+'['+index+'][contributor_type]'" v-validate="{required: true}"
data-vv-scope="step-1" v-model="item.contributor_type">
<select type="text" v-bind:name="heading+'['+index+'][pivot][contributor_type]'" v-validate="{required: true}"
data-vv-scope="step-1" v-model="item.pivot.contributor_type">
<option v-for="(option, i) in contributortypes" :value="option" :key="i">
{{ option }}
</option>

View file

@ -155,8 +155,7 @@ const app = new Vue({
},
beforeMount() {
this.messages = window.Laravel.messages;
this.contributorTypes = window.Laravel.contributorTypes;
console.log(this.contributorTypes);
this.contributorTypes = window.Laravel.contributorTypes;
},
computed: {
keywords_length() {
@ -334,7 +333,7 @@ const app = new Vue({
formData.append('contributors[' + i + '][email]', contributor.email);
formData.append('contributors[' + i + '][identifier_orcid]', contributor.identifier_orcid);
formData.append('contributors[' + i + '][status]', contributor.status);
formData.append('contributors[' + i + '][contributor_type]', contributor.contributor_type);
formData.append('contributors[' + i + '][pivot][contributor_type]', contributor.pivot.contributor_type);
if (contributor.id !== undefined) {
formData.append('contributors[' + i + '][id]', contributor.id);
}
@ -539,7 +538,7 @@ const app = new Vue({
}
},
addNewContributor() {
let newContributor = { status: 0, first_name: '', last_name: '', email: '', academic_title: '', identifier_orcid: '' };
let newContributor = { status: 0, first_name: '', last_name: '', email: '', academic_title: '', identifier_orcid: '', pivot: { contributor_type: ''} };
this.dataset.contributors.push(newContributor);
},
onAddContributor(person) {
@ -550,6 +549,7 @@ const app = new Vue({
} else if (this.dataset.persons.filter(e => e.id === person.id).length > 0) {
this.$toast.error("person is already defined as author");
} else {
person.pivot = { contributor_type: '' };
this.dataset.contributors.push(person);
this.dataset.checkedContributors.push(person.id);
this.$toast.success("person has been successfully added as contributor");