add contributors to dataset
This commit is contained in:
parent
f906b7eb77
commit
14878a20c8
|
@ -28,7 +28,8 @@ class IndexController extends Controller
|
||||||
{
|
{
|
||||||
$builder = Dataset::query();
|
$builder = Dataset::query();
|
||||||
$datasets = $builder
|
$datasets = $builder
|
||||||
->where('server_state', 'inprogress')
|
//->where('server_state', 'inprogress')
|
||||||
|
->whereIn('server_state', ['inprogress', 'unpublished'])
|
||||||
->get();
|
->get();
|
||||||
return view('publish.index', compact('datasets'));
|
return view('publish.index', compact('datasets'));
|
||||||
}
|
}
|
||||||
|
@ -287,6 +288,14 @@ class IndexController extends Controller
|
||||||
}
|
}
|
||||||
$dataset->persons()->sync($data_to_sync);
|
$dataset->persons()->sync($data_to_sync);
|
||||||
|
|
||||||
|
//store contributors
|
||||||
|
$data_to_sync = [];
|
||||||
|
foreach ($request->get('contributors') as $key => $contributor_id) {
|
||||||
|
$pivot_data = ['role' => 'contributor', 'sort_order' => $key + 1];
|
||||||
|
$data_to_sync[$contributor_id] = $pivot_data;
|
||||||
|
}
|
||||||
|
$dataset->persons()->sync($data_to_sync);
|
||||||
|
|
||||||
//save main title:
|
//save main title:
|
||||||
if (isset($data['title_main'])) {
|
if (isset($data['title_main'])) {
|
||||||
$formTitle = $request->input('title_main');
|
$formTitle = $request->input('title_main');
|
||||||
|
|
|
@ -9,6 +9,7 @@ class Person extends Model
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'academic_title',
|
'academic_title',
|
||||||
|
'date_of_birth',
|
||||||
'last_name',
|
'last_name',
|
||||||
'first_name',
|
'first_name',
|
||||||
'email',
|
'email',
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -52,11 +52,12 @@ const app = new Vue({
|
||||||
uploadFieldName: 'photos',
|
uploadFieldName: 'photos',
|
||||||
fileCount: 0,
|
fileCount: 0,
|
||||||
persons: [],
|
persons: [],
|
||||||
|
contributors: [],
|
||||||
|
|
||||||
step: 1,
|
step: 1,
|
||||||
dataset: {
|
dataset: {
|
||||||
type: '',
|
type: '',
|
||||||
state: 'inprogress',
|
state: '',
|
||||||
rights: null,
|
rights: null,
|
||||||
project_id: '',
|
project_id: '',
|
||||||
|
|
||||||
|
@ -74,7 +75,8 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
checkedAuthors: [],
|
checkedAuthors: [],
|
||||||
checkedLicenses: [],// [],
|
checkedLicenses: [],// [],
|
||||||
files: []
|
files: [],
|
||||||
|
checkedContributors: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -164,6 +166,9 @@ const app = new Vue({
|
||||||
for (var i = 0; i < this.dataset.checkedAuthors.length; i++) {
|
for (var i = 0; i < this.dataset.checkedAuthors.length; i++) {
|
||||||
formData.append('authors[' + i + ']', this.dataset.checkedAuthors[i]);
|
formData.append('authors[' + i + ']', this.dataset.checkedAuthors[i]);
|
||||||
}
|
}
|
||||||
|
for (var i = 0; i < this.dataset.checkedContributors.length; i++) {
|
||||||
|
formData.append('contributors[' + i + ']', this.dataset.checkedContributors[i]);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Make the request to the POST /multiple-files URL
|
Make the request to the POST /multiple-files URL
|
||||||
|
@ -250,6 +255,14 @@ const app = new Vue({
|
||||||
this.dataset.checkedAuthors.push(person.id);
|
this.dataset.checkedAuthors.push(person.id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onAddContributor(person) {
|
||||||
|
//if person is not in person array
|
||||||
|
//if (this.persons.includes(person) == false) {
|
||||||
|
if (this.contributors.filter(e => e.id === person.id).length == 0) {
|
||||||
|
this.contributors.push(person);
|
||||||
|
this.dataset.checkedContributors.push(person.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
/*
|
/*
|
||||||
Removes a select file the user has uploaded
|
Removes a select file the user has uploaded
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -95,8 +95,12 @@
|
||||||
|
|
||||||
<div class="pure-u-1 pure-u-md-1-2 pure-div">
|
<div class="pure-u-1 pure-u-md-1-2 pure-div">
|
||||||
{!! Form::label('State', 'State..') !!}
|
{!! Form::label('State', 'State..') !!}
|
||||||
{{ Form::text('State', null, ['class' => 'pure-u-23-24', 'placeholder' => trans('validation.attributes.backend.pages.title'),
|
{{-- {{ Form::text('State', null, ['class' => 'pure-u-23-24', 'placeholder' => trans('validation.attributes.backend.pages.title'),
|
||||||
'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2', 'readonly' => 'true']) }}
|
'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2', 'readonly' => 'true']) }} --}}
|
||||||
|
<div class="select pure-u-23-24">
|
||||||
|
{!! Form::select( 'State', ['unpublished', 'inprogress'], null, ['id' => 'state',
|
||||||
|
'placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2'] ) !!}
|
||||||
|
</div>
|
||||||
{{-- <div class="select pure-u-23-24">
|
{{-- <div class="select pure-u-23-24">
|
||||||
{!! Form::select( 'State', array_except(Config::get('enums.server_states'),['published', 'deleted', 'temporary']), '',
|
{!! Form::select( 'State', array_except(Config::get('enums.server_states'),['published', 'deleted', 'temporary']), '',
|
||||||
['placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2'] ) !!}
|
['placeholder' => '-- select server state --', 'v-model' => 'dataset.state', "v-validate" => "'required'", 'data-vv-scope' => 'step-2'] ) !!}
|
||||||
|
@ -212,6 +216,7 @@
|
||||||
|
|
||||||
<div v-if="step === 3" data-vv-scope="step-3">
|
<div v-if="step === 3" data-vv-scope="step-3">
|
||||||
<h1>Select authors, contributors</h1>
|
<h1>Select authors, contributors</h1>
|
||||||
|
|
||||||
<fieldset id="fieldset-general">
|
<fieldset id="fieldset-general">
|
||||||
<legend>Authors</legend>
|
<legend>Authors</legend>
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
|
@ -229,16 +234,31 @@
|
||||||
<br />
|
<br />
|
||||||
<span>Checked Authors: @{{ dataset.checkedAuthors }}</span>
|
<span>Checked Authors: @{{ dataset.checkedAuthors }}</span>
|
||||||
</div>
|
</div>
|
||||||
{{-- <span v-for="(person, index) in persons">
|
|
||||||
<strong>@{{ person.full_name }}</strong>
|
|
||||||
</span> --}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="fieldset-general">
|
<fieldset id="fieldset-general">
|
||||||
<legend>Contributors</legend>
|
<legend>Contributors</legend>
|
||||||
<small id="contributorHelp" class="pure-form-message-inline">will come soon...</small>
|
<div class="pure-g">
|
||||||
|
<div class="pure-u-1 pure-u-md-1-2 pure-div">
|
||||||
|
<my-autocomplete title="searching active person table" @person="onAddContributor"></my-autocomplete>
|
||||||
|
{{--
|
||||||
|
<my-autocomplete :items="[ 'Apple', 'Banana', 'Orange', 'Mango', 'Pear', 'Peach', 'Grape', 'Tangerine', 'Pineapple']"></my-autocomplete> --}}
|
||||||
|
</div>
|
||||||
|
<div class="pure-u-1 pure-u-md-1-2 pure-div">
|
||||||
|
<div class="pure-control-group checkboxlist">
|
||||||
|
<label v-for="(contributor, index) in contributors" :for="contributor.id" class="pure-checkbox">
|
||||||
|
<input type="checkbox" name="contributors" v-bind:value="contributor.id" v-model="dataset.checkedContributors" class="form-check-input" data-vv-scope="step-3">
|
||||||
|
@{{ contributor.full_name }}
|
||||||
|
</label>
|
||||||
|
<br />
|
||||||
|
<span>Checked Contributors: @{{ dataset.checkedContributors }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="fieldset-general">
|
<fieldset id="fieldset-general">
|
||||||
<legend>Submitters</legend>
|
<legend>Submitters</legend>
|
||||||
<small id="submitterHelp" class="pure-form-message-inline">will come soon...</small>
|
<small id="submitterHelp" class="pure-form-message-inline">will come soon...</small>
|
||||||
|
|
|
@ -37,11 +37,12 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{{-- <a class="edit" href="{{ route('settings.document.edit', $dataset->id) }}">
|
@if ($dataset->server_state == "unpublished")
|
||||||
<span>publish</span>
|
<a href="" class="pure-button button-small is-success">Publish</a>
|
||||||
</a> --}}
|
<a href="" class="pure-button button-small is-success">Restrict</a>
|
||||||
<a href="" class="pure-button button-small">Publish</a>
|
@else
|
||||||
<a href="" class="pure-button button-small">Restrict</a>
|
<a href="" class="pure-button button-small is-warning">Finish</a>
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
|
@ -25,6 +25,12 @@
|
||||||
<small id="emailHelp" class="pure-form-message-inline">email is optional.</small>
|
<small id="emailHelp" class="pure-form-message-inline">email is optional.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pure-control-group">
|
||||||
|
{!! Form::label('date_of_birth', 'Date Of Birth..') !!}
|
||||||
|
{!! Form::date('date_of_birth', null, ['placeholder' => date('y-m-d'), 'class' => 'form-control']) !!}
|
||||||
|
<small id="emailHelp" class="pure-form-message-inline">date of birth is optional.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
{!! Form::label('identifier_orcid', 'ORCID..') !!}
|
{!! Form::label('identifier_orcid', 'ORCID..') !!}
|
||||||
{!! Form::text('identifier_orcid', null, ['class' => 'form-control']) !!}
|
{!! Form::text('identifier_orcid', null, ['class' => 'form-control']) !!}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user