- licence name_long varchar 200
- remove and add authors and creators in edit form - EditDataset.js - add authors array to Dataset.ts - use id in PersonTable.vue - remove active styles from create-step1.blade.php
This commit is contained in:
parent
f6442b5f7a
commit
a8ea6120fd
17 changed files with 146 additions and 28 deletions
|
@ -4,11 +4,18 @@ import VeeValidate from 'vee-validate';
|
|||
Vue.use(VeeValidate);
|
||||
import LocationsMap from './components/locations-map.vue';
|
||||
import Dataset from './components/Dataset';
|
||||
import PersonTable from './components/PersonTable.vue';
|
||||
import MyAutocomplete from './components/MyAutocomplete.vue';
|
||||
import VueToast from 'vue-toast-notification';
|
||||
import 'vue-toast-notification/dist/index.css';
|
||||
Vue.use(VueToast);
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
LocationsMap,
|
||||
datetime
|
||||
datetime,
|
||||
PersonTable,
|
||||
MyAutocomplete
|
||||
}
|
||||
})
|
||||
export default class EditDataset extends Vue {
|
||||
|
@ -91,6 +98,26 @@ export default class EditDataset extends Vue {
|
|||
|
||||
}
|
||||
});
|
||||
const isUnique = (value, [objectArray, index, attribute]) =>
|
||||
new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
if (objectArray.some((item, i) => item[attribute] === value && index !== i)) {
|
||||
return resolve({
|
||||
valid: false,
|
||||
data: {
|
||||
message: value + ' is already taken.'
|
||||
}
|
||||
});
|
||||
}
|
||||
return resolve({
|
||||
valid: true
|
||||
});
|
||||
}, 200);
|
||||
});
|
||||
VeeValidate.Validator.extend("unique", {
|
||||
getMessage: (field, params, data) => field + ' ' + data.message,
|
||||
validate: isUnique,
|
||||
});
|
||||
}
|
||||
|
||||
mounted() {
|
||||
|
@ -259,4 +286,24 @@ export default class EditDataset extends Vue {
|
|||
this.form.abstracts.splice(key, 1);
|
||||
}
|
||||
|
||||
onAddAuthor(person) {
|
||||
//if person is not in person array
|
||||
//if (this.persons.includes(person) == false) {
|
||||
if (this.form.authors.filter(e => e.id === person.id).length > 0) {
|
||||
this.$toast.error("person is already defined as author");
|
||||
} else if (this.form.contributors.filter(e => e.id === person.id).length > 0) {
|
||||
this.$toast.error("person is already defined as contributor");
|
||||
}
|
||||
else {
|
||||
//person.sort_order = this.dataset.persons.length;
|
||||
this.form.authors.push(person);
|
||||
// this.dataset.checkedAuthors.push(person.id);
|
||||
this.$toast.success("person has been successfully added as author");
|
||||
}
|
||||
|
||||
// else if (this.dataset.contributors.filter(e => e.id === person.id).length > 0) {
|
||||
// this.$toast.error("person is already defined as contributor");
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue