edit references in editor edit view
This commit is contained in:
parent
4d6664ce3a
commit
03bcbab560
|
@ -10,6 +10,7 @@ use App\Models\License;
|
|||
use App\Models\User;
|
||||
use App\Models\Title;
|
||||
use App\Models\Description;
|
||||
use App\Models\DatasetReference;
|
||||
use App\Models\Subject;
|
||||
use App\Models\File;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
@ -91,7 +92,7 @@ class EditorController extends Controller
|
|||
public function edit($id): View
|
||||
{
|
||||
$dataset = Dataset::findOrFail($id);
|
||||
$dataset->load('licenses', 'titles', 'abstracts', 'files', 'coverage', 'subjects');
|
||||
$dataset->load('licenses', 'titles', 'abstracts', 'files', 'coverage', 'subjects', 'references');
|
||||
|
||||
$projects = Project::pluck('label', 'id');
|
||||
|
||||
|
@ -111,10 +112,27 @@ class EditorController extends Controller
|
|||
$checkeds = $dataset->licenses->pluck('id')->toArray();
|
||||
$keywordTypes = ['uncontrolled' => 'uncontrolled', 'swd' => 'swd'];
|
||||
|
||||
$referenceTypes = ["rdr-id", "arXiv", "bibcode", "DOI", "EAN13", "EISSN", "Handle", "IGSN", "ISBN", "ISSN", "ISTC", "LISSN", "LSID", "PMID", "PURL", "UPC", "URL", "URN"];
|
||||
$referenceTypes = array_combine($referenceTypes, $referenceTypes);
|
||||
|
||||
$relationTypes = ["IsCitedBy", "Cites", "IsSupplementTo", "IsSupplementedBy", "IsContinuedBy", "Continues", "HasMetadata", "IsMetadataFor","IsNewVersionOf", "IsPreviousVersionOf", "IsPartOf", "HasPart", "IsReferencedBy", "References"];
|
||||
// "IsDocumentedBy", "Documents", "IsCompiledBy", "Compiles", "IsVariantFormOf", "IsOriginalFormOf", "IsIdenticalTo", "IsReviewedBy", "Reviews", "IsDerivedFrom", "IsSourceOf"];
|
||||
$relationTypes = array_combine($relationTypes, $relationTypes);
|
||||
|
||||
|
||||
return view(
|
||||
'workflow.editor.edit',
|
||||
compact('dataset', 'projects', 'options', 'checkeds', 'years', 'languages', 'keywordTypes')
|
||||
compact(
|
||||
'dataset',
|
||||
'projects',
|
||||
'options',
|
||||
'checkeds',
|
||||
'years',
|
||||
'languages',
|
||||
'keywordTypes',
|
||||
'referenceTypes',
|
||||
'relationTypes'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -180,6 +198,19 @@ class EditorController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
//save the references:
|
||||
$references = $request->input('references');
|
||||
if (is_array($references) && count($references) > 0) {
|
||||
foreach ($references as $key => $formReference) {
|
||||
$reference = DatasetReference::findOrFail($key);
|
||||
$reference->value = $formReference['value'];
|
||||
$reference->label = $formReference['label'];
|
||||
$reference->type = $formReference['type'];
|
||||
$reference->relation = $formReference['relation'];
|
||||
$reference->save();
|
||||
}
|
||||
}
|
||||
|
||||
//save the keywords:
|
||||
$keywords = $request->input('keywords');
|
||||
if (is_array($keywords) && count($keywords) > 0) {
|
||||
|
@ -314,4 +345,42 @@ class EditorController extends Controller
|
|||
}
|
||||
throw new GeneralException(trans('exceptions.publish.review.update_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified dataset for publishing.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function publish($id): View
|
||||
{
|
||||
$dataset = Dataset::query()
|
||||
->with([
|
||||
'titles',
|
||||
'persons' => function ($query) {
|
||||
$query->wherePivot('role', 'author');
|
||||
}
|
||||
])->findOrFail($id);
|
||||
|
||||
return view('workflow.editor.publish', [
|
||||
'dataset' => $dataset,
|
||||
]);
|
||||
}
|
||||
|
||||
public function publishUpdate(Request $request, $id)
|
||||
{
|
||||
$dataset = Dataset::findOrFail($id);
|
||||
$input = $request->all();
|
||||
$input['server_state'] = 'published';
|
||||
$time = new \Illuminate\Support\Carbon();
|
||||
$input['server_date_published'] = $time;
|
||||
|
||||
if ($dataset->update($input)) {
|
||||
// event(new PageUpdated($page));
|
||||
return redirect()
|
||||
->route('publish.workflow.publish.index')
|
||||
->with('flash_message', 'You have successfully published the dataset!');
|
||||
}
|
||||
throw new GeneralException(trans('exceptions.publish.publish.update_error'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,42 +34,4 @@ class PublishController extends Controller
|
|||
'datasets' => $datasets,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified dataset for publishing.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function publish($id): View
|
||||
{
|
||||
$dataset = Dataset::query()
|
||||
->with([
|
||||
'titles',
|
||||
'persons' => function ($query) {
|
||||
$query->wherePivot('role', 'author');
|
||||
}
|
||||
])->findOrFail($id);
|
||||
|
||||
return view('workflow.publish.publish', [
|
||||
'dataset' => $dataset,
|
||||
]);
|
||||
}
|
||||
|
||||
public function publishUpdate(Request $request, $id)
|
||||
{
|
||||
$dataset = Dataset::findOrFail($id);
|
||||
$input = $request->all();
|
||||
$input['server_state'] = 'published';
|
||||
$time = new \Illuminate\Support\Carbon();
|
||||
$input['server_date_published'] = $time;
|
||||
|
||||
if ($dataset->update($input)) {
|
||||
// event(new PageUpdated($page));
|
||||
return redirect()
|
||||
->route('publish.workflow.publish.index')
|
||||
->with('flash_message', 'You have successfully published the dataset!');
|
||||
}
|
||||
throw new GeneralException(trans('exceptions.publish.publish.update_error'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,9 @@ class SubmitController extends Controller
|
|||
if ($dataset->reject_editor_note != null) {
|
||||
$input['reject_editor_note'] = null;
|
||||
}
|
||||
if ($dataset->reject_reviewer_note != null) {
|
||||
$input['reject_reviewer_note'] = null;
|
||||
}
|
||||
|
||||
if ($dataset->update($input)) {
|
||||
// event(new PageUpdated($page));
|
||||
|
|
|
@ -41,7 +41,8 @@ class Dataset extends Model
|
|||
'preferred_reviewer_email',
|
||||
'reviewer_id',
|
||||
'reject_reviewer_note',
|
||||
'reject_editor_note'
|
||||
'reject_editor_note',
|
||||
'reviewer_note_visible'
|
||||
];
|
||||
//protected $guarded = [];
|
||||
/**
|
||||
|
@ -301,4 +302,14 @@ class Dataset extends Model
|
|||
|
||||
return ($embargoDate->gt($now) == true);
|
||||
}
|
||||
|
||||
public function getRemainingTimeAttribute()
|
||||
{
|
||||
$dateDiff =$this->server_date_modified->addDays(14);
|
||||
if ($this->server_state == "approved") {
|
||||
return Carbon::now()->diffInDays($dateDiff, false);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,17 +113,11 @@
|
|||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review.index') }}"><i class="fas fa-list"></i> REVIEW PAGE: Approved datasets</a>
|
||||
</li>
|
||||
@endpermission
|
||||
@permission('dataset-publish-list')
|
||||
{{-- @permission('dataset-publish-list')
|
||||
<li class="pure-menu-item {{ Route::is('publish.workflow.publish*') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.publish.index') }}"><i class="fas fa-list"></i> Publish PAGE: Reviewed datasets</a>
|
||||
</li>
|
||||
@endpermission
|
||||
{{-- <li class="pure-menu-item {{ Route::is('publish.workflow.release') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.release') }}"><i class="fa fa-upload"></i> Release pending datasets</a>
|
||||
</li>
|
||||
<li class="pure-menu-item {{ Route::is('publish.workflow.review') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review') }}"><i class="fa fa-upload"></i> Review/Publish unpublished datasets</a>
|
||||
</li> --}}
|
||||
@endpermission --}}
|
||||
</ul>
|
||||
</li>
|
||||
@endrole
|
||||
|
|
|
@ -186,6 +186,50 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="fieldset-references">
|
||||
<legend>Dataset References</legend>
|
||||
{{-- <table class="table table-hover" v-if="dataset.keywords.length"> --}}
|
||||
@if ($dataset->references->count() > 0)
|
||||
<table id="references" class="pure-table pure-table-horizontal">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20px;">Reference value</th>
|
||||
<th style="width: 20px;">Label</th>
|
||||
<th>Type</th>
|
||||
<th>Relation</th>
|
||||
<th style="width: 130px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{-- <tr v-for="(item, index) in dataset.keywords"> --}}
|
||||
@foreach($dataset->references as $key => $reference)
|
||||
<tr>
|
||||
<td>
|
||||
{{ Form::text('references['.$reference->id.'][value]', $reference->value, ['class' => 'form-control', 'placeholder' => '[REFERENCE VALUE]']) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::text('references['.$reference->id.'][label]', $reference->label, ['class' => 'form-control', 'placeholder' => '[REFERENCE LABEL]']) }}
|
||||
</td>
|
||||
<td>
|
||||
{!! Form::select('references['.$reference->id.'][type]', $referenceTypes, $reference->type, ['placeholder' => '[reference type]', 'v-model' =>
|
||||
'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
|
||||
</td>
|
||||
<td>
|
||||
{!! Form::select('references['.$reference->id.'][relation]', $relationTypes, $reference->relation, ['placeholder' => '[relation type]', 'v-model' =>
|
||||
'item.relation', "v-validate" => "'required'", 'data-vv-scope' => 'step-2']) !!}
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@else
|
||||
<span>...there are no references</span>
|
||||
@endif
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="fieldset-keywords">
|
||||
<legend>Dataset Keywords</legend>
|
||||
{{-- <table class="table table-hover" v-if="dataset.keywords.length"> --}}
|
||||
|
@ -219,7 +263,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
@else
|
||||
<span>...ther are no keywords</span>
|
||||
<span>...there are no keywords</span>
|
||||
@endif
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<span>Reject</span>
|
||||
</a>
|
||||
@elseif ($dataset->server_state == "reviewed")
|
||||
<a href="{{ URL::route('publish.workflow.publish.publishUpdate', $dataset->id) }}" class="pure-button">
|
||||
<a href="{{ URL::route('publish.workflow.editor.publishUpdate', $dataset->id) }}" class="pure-button">
|
||||
<i class="fa fa-edit"></i>
|
||||
<span>Publish</span>
|
||||
</a>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
@section('content')
|
||||
<div class="header">
|
||||
<h3 class="header-title">
|
||||
<i class="fa fa-share"></i> Review approved dataset
|
||||
<i class="fa fa-share"></i> Publish reviewed dataset
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
</div>
|
||||
<div id="app1">
|
||||
|
||||
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.publish.publishUpdate', $dataset->id],
|
||||
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.publishUpdate', $dataset->id],
|
||||
'id' => 'publishForm', 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm'])
|
||||
!!}
|
||||
<fieldset id="fieldset-General">
|
||||
|
@ -47,7 +47,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<div class="instruction">
|
||||
Are you sure you want to accept the selected dataset?
|
||||
Are you sure you want to publish the selected dataset?
|
||||
</div>
|
||||
<table>
|
||||
<tbody><tr>
|
|
@ -37,7 +37,6 @@
|
|||
<div class="pure-u-1 pure-u-md-1-1 pure-div">
|
||||
{!! Form::label('server_state', 'Status..') !!}
|
||||
{!! Form::text('server_state', 'rejected_editor', ['class'=>'pure-u-23-24','readonly']) !!}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1 pure-u-md-1-1 pure-div">
|
||||
|
@ -46,10 +45,26 @@
|
|||
'placeholder' => '-- reject note for submitter --', 'size' => '70x6',
|
||||
'v-model' => 'dataset.reject_editor_note', "v-validate" => "'required|min:10|max:255'"]) !!}
|
||||
<em>*</em>
|
||||
|
||||
<span class="help is-danger" v-if="errors.has('reject_editor_note')" v-text="errors.first('reject_editor_note')"></span>
|
||||
|
||||
</div>
|
||||
|
||||
@if ($dataset->reject_reviewer_note != null)
|
||||
<div class="pure-u-1 pure-u-md-1-1">
|
||||
{!! Form::label('reject_reviewer_note', 'Reviewer reject note..') !!}
|
||||
{!! Form::text('reject_reviewer_note', null, ['class'=>'pure-u-23-24','readonly']) !!}
|
||||
</div>
|
||||
<div class="pure-u-1 pure-u-md-1-1">
|
||||
<label for="BelongsToBibliography" class="pure-checkbox">
|
||||
<input type="hidden" name="reviewer_note_visible" value="0">
|
||||
<input name="reviewer_note_visible" value="1" type="checkbox" class="form-check-input">
|
||||
should reviewer note be visible to submitter?
|
||||
</label>
|
||||
</div>
|
||||
@else
|
||||
<div class="pure-u-1 pure-u-md-1-1">
|
||||
<span class="help is-info">There is no reject note from the reviewer</span>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
<td>
|
||||
@if ($dataset->server_state == "reviewed")
|
||||
<a href="{{ URL::route('publish.workflow.publish.publish', $dataset->id) }}" class="pure-button">
|
||||
<a href="{{ URL::route('publish.workflow.editor.publish', $dataset->id) }}" class="pure-button">
|
||||
<i class="fa fa-check"></i>
|
||||
<span>Publish</span>
|
||||
</a>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<th>ID</th>
|
||||
<th>Server State</th>
|
||||
<th>Editor</th>
|
||||
<th>remaining time</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
|
||||
|
@ -43,9 +44,15 @@
|
|||
<td>
|
||||
{{ $dataset->server_state }}
|
||||
</td>
|
||||
@if ($dataset->server_state == "approved")
|
||||
<td>editor: {{ optional($dataset->editor)->login }}</td>
|
||||
@endif
|
||||
<td>
|
||||
{{-- @php
|
||||
$dateDiff = $dataset['server_date_modified']->addDays(14);
|
||||
$remainingDays = Carbon\Carbon::now()->diffInDays($dateDiff, false);
|
||||
@endphp --}}
|
||||
|
||||
{{ $dataset->remaining_time . ' days' }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@if ($dataset->server_state == "approved")
|
||||
|
|
|
@ -109,6 +109,14 @@ Route::group(
|
|||
'middleware' => ['permission:dataset-editor-reject'],
|
||||
'as' => 'workflow.editor.rejectUpdate', 'uses' => 'EditorController@rejectUpdate',
|
||||
]);
|
||||
Route::get('workflow/editor/publish/{id}', [
|
||||
'middleware' => ['permission:dataset-publish'],
|
||||
'as' => 'workflow.editor.publish', 'uses' => 'EditorController@publish',
|
||||
]);
|
||||
Route::post('workflow/editor/publish/{id}', [
|
||||
'middleware' => ['permission:dataset-publish'],
|
||||
'as' => 'workflow.editor.publishUpdate', 'uses' => 'EditorController@publishUpdate',
|
||||
]);
|
||||
|
||||
//reviewer
|
||||
Route::get('workflow/review/index', [
|
||||
|
@ -137,14 +145,14 @@ Route::group(
|
|||
'middleware' => ['permission:dataset-publish-list'],
|
||||
'as' => 'workflow.publish.index', 'uses' => 'PublishController@index',
|
||||
]);
|
||||
Route::get('workflow/publish/{id}', [
|
||||
'middleware' => ['permission:dataset-publish'],
|
||||
'as' => 'workflow.publish.publish', 'uses' => 'PublishController@publish',
|
||||
]);
|
||||
Route::post('workflow/publish/{id}', [
|
||||
'middleware' => ['permission:dataset-publish'],
|
||||
'as' => 'workflow.publish.publishUpdate', 'uses' => 'PublishController@publishUpdate',
|
||||
]);
|
||||
// Route::get('workflow/publish/{id}', [
|
||||
// 'middleware' => ['permission:dataset-publish'],
|
||||
// 'as' => 'workflow.publish.publish', 'uses' => 'PublishController@publish',
|
||||
// ]);
|
||||
// Route::post('workflow/publish/{id}', [
|
||||
// 'middleware' => ['permission:dataset-publish'],
|
||||
// 'as' => 'workflow.publish.publishUpdate', 'uses' => 'PublishController@publishUpdate',
|
||||
// ]);
|
||||
|
||||
Route::get('workflow/changestate/{id}/changestate/{targetState}', [
|
||||
'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
|
||||
|
|
Loading…
Reference in New Issue
Block a user