- add active authors and contributors

- check redundant authors and contributors
This commit is contained in:
Arno Kaimbacher 2019-09-16 18:34:32 +02:00
parent 8f040c2770
commit 68add9025f
3 changed files with 20 additions and 6 deletions

View File

@ -335,6 +335,8 @@ class IndexController extends Controller
$dataset->persons()->attach($person['id'], $pivot_data); $dataset->persons()->attach($person['id'], $pivot_data);
} else { } else {
$dataPerson = new Person($person); $dataPerson = new Person($person);
$dataPerson->status = true;
$dataPerson->name_type = "Organizational";
$dataset->persons()->save($dataPerson, $pivot_data); $dataset->persons()->save($dataPerson, $pivot_data);
} }
} }
@ -360,6 +362,8 @@ class IndexController extends Controller
$dataset->persons()->attach($contributor['id'], $pivot_data); $dataset->persons()->attach($contributor['id'], $pivot_data);
} else { } else {
$dataContributor = new Person($contributor); $dataContributor = new Person($contributor);
$dataContributor->status = true;
$dataContributor->name_type = "Organizational";
$dataset->persons()->save($dataContributor, $pivot_data); $dataset->persons()->save($dataContributor, $pivot_data);
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -500,10 +500,15 @@ const app = new Vue({
onAddAuthor(person) { onAddAuthor(person) {
//if person is not in person array //if person is not in person array
//if (this.persons.includes(person) == false) { //if (this.persons.includes(person) == false) {
if (this.dataset.persons.filter(e => e.id === person.id).length == 0) { if (this.dataset.persons.filter(e => e.id === person.id).length > 0) {
this.$toast.error("person is already defined as author");
} else if (this.dataset.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; //person.sort_order = this.dataset.persons.length;
this.dataset.persons.push(person); this.dataset.persons.push(person);
this.dataset.checkedAuthors.push(person.id); this.dataset.checkedAuthors.push(person.id);
this.$toast.success("person has been successfully added as author");
} }
}, },
addNewContributor() { addNewContributor() {
@ -513,9 +518,14 @@ const app = new Vue({
onAddContributor(person) { onAddContributor(person) {
//if person is not in contributors array //if person is not in contributors array
//if (this.contributors.includes(person) == false) { //if (this.contributors.includes(person) == false) {
if (this.dataset.contributors.filter(e => e.id === person.id).length == 0) { if (this.dataset.contributors.filter(e => e.id === person.id).length > 0) {
this.$toast.error("person is already defined as contributor");
} else if (this.dataset.persons.filter(e => e.id === person.id).length > 0) {
this.$toast.error("person is already defined as author");
} else {
this.dataset.contributors.push(person); this.dataset.contributors.push(person);
this.dataset.checkedContributors.push(person.id); this.dataset.checkedContributors.push(person.id);
this.$toast.success("person has been successfully added as contributor");
} }
}, },
// onAddSubmitter(person) { // onAddSubmitter(person) {