add contributors to dataset
This commit is contained in:
parent
f906b7eb77
commit
14878a20c8
|
@ -28,7 +28,8 @@ class IndexController extends Controller
|
|||
{
|
||||
$builder = Dataset::query();
|
||||
$datasets = $builder
|
||||
->where('server_state', 'inprogress')
|
||||
//->where('server_state', 'inprogress')
|
||||
->whereIn('server_state', ['inprogress', 'unpublished'])
|
||||
->get();
|
||||
return view('publish.index', compact('datasets'));
|
||||
}
|
||||
|
@ -287,6 +288,14 @@ class IndexController extends Controller
|
|||
}
|
||||
$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:
|
||||
if (isset($data['title_main'])) {
|
||||
$formTitle = $request->input('title_main');
|
||||
|
|
|
@ -9,6 +9,7 @@ class Person extends Model
|
|||
|
||||
protected $fillable = [
|
||||
'academic_title',
|
||||
'date_of_birth',
|
||||
'last_name',
|
||||
'first_name',
|
||||
'email',
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -52,11 +52,12 @@ const app = new Vue({
|
|||
uploadFieldName: 'photos',
|
||||
fileCount: 0,
|
||||
persons: [],
|
||||
contributors: [],
|
||||
|
||||
step: 1,
|
||||
dataset: {
|
||||
type: '',
|
||||
state: 'inprogress',
|
||||
state: '',
|
||||
rights: null,
|
||||
project_id: '',
|
||||
|
||||
|
@ -74,7 +75,8 @@ const app = new Vue({
|
|||
},
|
||||
checkedAuthors: [],
|
||||
checkedLicenses: [],// [],
|
||||
files: []
|
||||
files: [],
|
||||
checkedContributors: [],
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -164,6 +166,9 @@ const app = new Vue({
|
|||
for (var i = 0; i < this.dataset.checkedAuthors.length; 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
|
||||
|
@ -250,6 +255,14 @@ const app = new Vue({
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -95,8 +95,12 @@
|
|||
|
||||
<div class="pure-u-1 pure-u-md-1-2 pure-div">
|
||||
{!! Form::label('State', 'State..') !!}
|
||||
{{ 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']) }}
|
||||
{{-- {{ 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']) }} --}}
|
||||
<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">
|
||||
{!! 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'] ) !!}
|
||||
|
@ -212,6 +216,7 @@
|
|||
|
||||
<div v-if="step === 3" data-vv-scope="step-3">
|
||||
<h1>Select authors, contributors</h1>
|
||||
|
||||
<fieldset id="fieldset-general">
|
||||
<legend>Authors</legend>
|
||||
<div class="pure-g">
|
||||
|
@ -229,16 +234,31 @@
|
|||
<br />
|
||||
<span>Checked Authors: @{{ dataset.checkedAuthors }}</span>
|
||||
</div>
|
||||
{{-- <span v-for="(person, index) in persons">
|
||||
<strong>@{{ person.full_name }}</strong>
|
||||
</span> --}}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="fieldset-general">
|
||||
<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 id="fieldset-general">
|
||||
<legend>Submitters</legend>
|
||||
<small id="submitterHelp" class="pure-form-message-inline">will come soon...</small>
|
||||
|
|
|
@ -37,11 +37,12 @@
|
|||
</td>
|
||||
|
||||
<td>
|
||||
{{-- <a class="edit" href="{{ route('settings.document.edit', $dataset->id) }}">
|
||||
<span>publish</span>
|
||||
</a> --}}
|
||||
<a href="" class="pure-button button-small">Publish</a>
|
||||
<a href="" class="pure-button button-small">Restrict</a>
|
||||
@if ($dataset->server_state == "unpublished")
|
||||
<a href="" class="pure-button button-small is-success">Publish</a>
|
||||
<a href="" class="pure-button button-small is-success">Restrict</a>
|
||||
@else
|
||||
<a href="" class="pure-button button-small is-warning">Finish</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
<small id="emailHelp" class="pure-form-message-inline">email is optional.</small>
|
||||
</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">
|
||||
{!! Form::label('identifier_orcid', 'ORCID..') !!}
|
||||
{!! Form::text('identifier_orcid', null, ['class' => 'form-control']) !!}
|
||||
|
|
Loading…
Reference in New Issue
Block a user