publication workflow: review

This commit is contained in:
Arno Kaimbacher 2019-04-11 18:52:10 +02:00
parent 5df9b0beef
commit ad982a1ac5
26 changed files with 724 additions and 161 deletions

View file

@ -0,0 +1,32 @@
// releaseDataset.js
import Vue from 'vue';
import VeeValidate from 'vee-validate';
Vue.use(VeeValidate);
const app = new Vue({
el: '#app1',
data() {
return {
dataset: {
firstName: '',
reviewer_id: ''
},
submitted: false
}
},
methods: {
checkForm(e) {
// Log entire model to console
// console.log(this.dataset);
this.submitted = true;
this.$validator.validate().then(result => {
if (result) {
console.log('From Submitted!');
document.getElementById("approveForm").submit();
return;
}
});
}
}
});

View file

@ -10,7 +10,7 @@ const app = new Vue({
return {
dataset: {
firstName: '',
editor_id: ''
preferred_editor: ''
},
submitted: false
}

View file

@ -14,11 +14,14 @@ return [
*/
'publish' => [
'release' => [
'update_error' => 'There was a problem rleasing this dataset. Please try again.',
'update_error' => 'There was a problem releasing this dataset. Please try again.',
],
'accept' => [
'update_error' => 'There was a problem accepting this dataset. Please try again.',
],
'approve' => [
'update_error' => 'There was a problem approving this dataset. Please try again.',
],
],
'backend' => [

View file

@ -103,8 +103,13 @@
</li>
@endpermission
@permission('dataset-editor-list')
<li class="pure-menu-item {{ Route::is('publish.workflow.editorIndex') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.editorIndex') }}"><i class="fa fa-upload"></i> EDITOR PAGE: Released datasets</a>
<li class="pure-menu-item {{ Route::is('publish.workflow.editor.index') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.editor.index') }}"><i class="fa fa-upload"></i> EDITOR PAGE: Released datasets</a>
</li>
@endpermission
@permission('dataset-review-list')
<li class="pure-menu-item {{ Route::is('publish.workflow.review.index') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review.index') }}"><i class="fa fa-upload"></i> REVIEW PAGE: Approved datasets</a>
</li>
@endpermission
{{-- <li class="pure-menu-item {{ Route::is('publish.workflow.release') ? 'active' : '' }}">

View file

@ -32,9 +32,16 @@
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.10/summernote-lite.js"></script>
{{-- <script src="https://cloud.tinymce.com/5/tinymce.min.js"></script> --}}
<script>
$(document).ready(function() {
$('#desc_markup').summernote();
// tinymce.init({
// selector: "#desc_markup",
// plugins: "code",
// // toolbar: "code",
// menubar: "tools"
// });
});
</script>
@endsection

View file

@ -0,0 +1,137 @@
<fieldset id="fieldset-General">
<legend>General</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('type', 'Type..') !!}
<div class="select pure-u-23-24">
{!! Form::select('type', Lang::get('doctypes'), null, ['id' => 'type', 'placeholder' => '-- select type --']) !!}
</div>
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('server_state', 'Status..') !!}
{{-- {!! Form::select('server_state', Config::get('enums.server_states'), null, ['id' => 'server_state', 'placeholder' => '-- select server state --']) !!} --}}
{!! Form::text('server_state', null, ['class'=>'pure-u-23-24','readonly']) !!}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('project_id', 'Project..') !!}
<div class="select pure-u-23-24">
{!! Form::select('project_id', $projects, null, ['id' => 'project_id', 'placeholder' => '--no project--']) !!}
</div>
<small id="projectHelp" class="pure-form-message-inline">project is optional</small>
</div>
{{-- <div class="pure-control-group">
{!! Form::label('shelf_id', 'Shelf..') !!}
{!! Form::select('shelf_id', $shelves, null, ['id' => 'shelf_id']) !!}
</div> --}}
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('embargo_date', 'Embargo Date') !!}
{!! Form::date('embargo_date', null, ['placeholder' => date('y-m-d'), 'class' => 'pure-u-23-24']) !!}
<small id="projectHelp" class="pure-form-message-inline">embargo_date is optional</small>
</div>
</div>
</fieldset>
<fieldset id="fieldset-titles">
<legend>Title</legend>
<div class="pure-g">
@foreach($dataset->titles as $key => $title)
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('title', 'Title ' .($key+1).':') }}
<!-- Notice this is an array now: -->
{{ Form::text('titles['.$title->id.'][value]', $title->value, ['class' => 'pure-u-23-24']) }}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('language', 'Language..') }}
<div class="select pure-u-23-24">
{{ Form::select('titles['.$title->id.'][language]', $languages, $title->language, ['placeholder' => '--no language--']) }}
</div>
</div>
@endforeach
</div>
</fieldset>
<fieldset id="fieldset-abstracts">
<legend>Abstract</legend>
<div class="pure-g">
@foreach($dataset->abstracts as $key => $abstract)
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('abstract', 'Abstract ' .($key+1).':') }}
<!-- Notice this is an array now: -->
{{ Form::textarea('abstracts['.$abstract->id.'][value]', $abstract->value, ['class' => 'pure-u-23-24', 'size' => '70x6']) }}
</div>
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{{ Form::label('language', 'Language..') }}
<div class="select pure-u-23-24">
{{ Form::select('abstracts['.$abstract->id.'][language]', $languages, $abstract->language, ['placeholder' => '--no language--']) }}
</div>
</div>
@endforeach
</div>
</fieldset>
<fieldset id="fieldset-licenses">
<legend>Licenses</legend>
{{-- <div class="form-group">
{!! Form::label('licenses[]', 'Licenses..') !!}
{!! Form::select('licenses[]', $options, array_pluck($dataset->licenses, 'id'), ['multiple' ]) !!}
</div> --}}
<div class="pure-control-group checkboxlist">
@foreach ($options as $license)
<label for={{"license". $license->id }} class="pure-checkbox">
<input name="licenses[]" value={{ $license->id }} {{ (in_array($license->id, $checkeds)) ? 'checked=checked' : '' }} type="checkbox" class="form-check-input">
{{ $license->name_long }}
</label>
<!--{!! Form::checkbox('licenses[]', $license->id, in_array($license->id, $checkeds) ? true : false) !!}
{!! Form::label('license' . $license->id, $license->name_long) !!}-->
@endforeach
</div>
</fieldset>
<fieldset id="fieldset-abstracts">
<legend>Files</legend>
<table id="items" class="pure-table pure-table-horizontal">
<thead>
<tr>
<th>Path Name</th>
<th>Label</th>
</tr>
</thead>
<tbody>
@foreach($dataset->files as $key => $file)
<tr>
<td>
@if($file->exists() === true)
<a href="{{ route('settings.file.download', ['id' => $file->id]) }}"> {{ $file->path_name }} </a>
@else
<span class="alert">missing file: {{ $file->path_name }}</span>
@endif
</td>
<td> {{ $file->label }} </td>
</tr>
@endforeach
</tbody>
</table>
</fieldset>
<br />
<div class="pure-controls">
<button type="submit" class="pure-button button-small">
<i class="fa fa-save"></i>
<span>{!! $submitButtonText !!}</span>
</button>
</div>

View file

@ -16,21 +16,20 @@
<div class="pure-u-1 pure-u-md-1">
<div>
<a href="{{ route('publish.workflow.editorIndex') }}" class="pure-button button-small">
<a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div id="app1">
@php
//if userid changed from last iteration, store new userid and change color
// $lastid = $detail->payment->userid;
if ($dataset->editor->id == Auth::user()->id) {
$userIsDesiredEditor = true;
} else {
$userIsDesiredEditor = false;
$message = 'you are not the desired editor, but you can still accept the dataset';
}
@php
// if ($dataset->editor->id == Auth::user()->id) {
// $userIsDesiredEditor = true;
// } else {
// $userIsDesiredEditor = false;
// $message = 'you are not the desired editor, but you can still accept the dataset';
// }
$message = 'If you are not the desired editor, you can still accept the dataset!!';
@endphp
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.acceptUpdate', $dataset->id], 'id' => 'acceptForm',
@ -41,10 +40,10 @@
<div class="pure-u-1 pure-u-md-1-1 pure-div">
{!! Form::label('editor_id', 'preferred editor:') !!}
{!! $dataset->editor->login !!}
@if($userIsDesiredEditor == false)
<span class="help is-danger"> {!! $message !!}</span>
@endif
{!! $dataset->preferred_editor !!}
<span class="help is-danger"> {!! $message !!}</span>
{{-- <span class="help is-danger" v-if="errors.has('editor_id')" v-text="errors.first('editor_id')"></span> --}}
</div>

View file

@ -0,0 +1,60 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-share"></i> Approve corrected datasets
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-1">
<div>
<a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div id="app1">
{!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.editor.approveUpdate', $dataset->id], 'id' => 'approveForm',
'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) !!}
<fieldset id="fieldset-General">
<legend>General</legend>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('reviewer_id', 'reviewer:') !!}
<div class="select pure-u-23-24">
{!! Form::select('reviewer_id', $reviewers, null, ['id' => 'reviewer_id', 'placeholder' => '-- select reviewer --', 'v-model' =>
'dataset.reviewer_id', "v-validate" => "'required'"]) !!}
</div>
<span class="help is-danger" v-if="errors.has('reviewer_id')" v-text="errors.first('reviewer_id')"></span>
</div>
</div>
</fieldset>
<br />
<div class="pure-controls">
<button :disabled="errors.any()" type="submit" class="pure-button">
<i class="fa fa-share"></i>
<span>Approve</span>
</button>
</div>
{!! Form::close() !!}
</div>
</div>
</div>
@stop
@section('after-scripts') {{--
<script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{--
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>--}} {{--
<script type="text/javascript" src="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
<script type="text/javascript" src="{{ asset('backend/publish/approveDataset.js') }}"></script>
@stop

View file

@ -0,0 +1,28 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<span>Correct Dataset</span>
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1 pure-u-md-3-3">
<div>
<a href="{{ route('publish.workflow.editor.index') }}" class="pure-button button-small">
<i class="fa fa-chevron-left"></i>
<span>BACK</span>
</a>
</div>
<div>
{!! Form::model($dataset, ['method' => 'POST', 'route' => ['publish.workflow.editor.update', $dataset->id], 'class' => 'pure-form', 'enctype' => 'multipart/form-data' ]) !!}
@include('workflow/editor/_form', ['submitButtonText' => 'Edit Dataset', 'bookLabel' => 'Edit Dataset.'])
@include('errors._errors')
{!! Form::close() !!}
</div>
</div>
</div>
@stop

View file

@ -2,7 +2,7 @@
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-file"></i>EDITOR PAGE: Approve released datasets
<i class="fa fa-file"></i> EDITOR PAGE: Approve released datasets
</h3>
</div>
@ -27,7 +27,7 @@
$rowclass = 'editor_accepted';
} elseif ($dataset->server_state == 'released') {
$rowclass = 'released';
}
}
@endphp
<tr class="{{ $rowclass }}">
<td>
@ -44,7 +44,8 @@
{{ $dataset->server_state }}
</td>
@if ($dataset->server_state == "released")
<td>Preferred editor: {{ optional($dataset->editor)->login }} </td>
{{-- <td>Preferred editor: {{ optional($dataset->editor)->login }} </td> --}}
<td>Preferred editor: {{ $dataset->preferred_editor }} </td>
@elseif ($dataset->server_state == "editor_accepted")
<td>in approvement by {{ optional($dataset->editor)->login }} </td>
@endif
@ -52,14 +53,18 @@
<td>
@if ($dataset->server_state == "released")
<a href="{{ URL::route('publish.workflow.accept', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i>
<i class="fa fa-check"></i>
<span>Accept editor task</span>
</a>
@elseif ($dataset->server_state == "editor_accepted")
<a href="{{ URL::route('publish.workflow.editor.edit', $dataset->id) }}" class="pure-button">
<i class="fa fa-edit"></i>
<span>Improve/Edit</span>
</a>
<a href="{{ URL::route('publish.workflow.editor.approve', $dataset->id) }}" class="pure-button">
<i class="fa fa-share"></i>
<span>Approve</span>
</a>
{{-- <a href="{{ URL::route('publish.workflow.delete', $dataset->id) }}" class="pure-button">
<i class="fa fa-trash"></i>
<span>Reject</span>
</a> --}}
@endif
</td>
{{-- <td>

View file

@ -0,0 +1,71 @@
@extends('settings.layouts.app')
@section('content')
<div class="header">
<h3 class="header-title">
<i class="fa fa-file"></i> REVIEW PAGE: Review approved datasets assigned to you
</h3>
</div>
<div class="pure-g box-content">
<div class="pure-u-1">
<table class="pure-table pure-table-horizontal">
<thead>
<th>Dataset Title</th>
<th>ID</th>
<th>Server State</th>
<th>Editor</th>
<th></th>
</thead>
<tbody>
@foreach($datasets as $dataset)
@php
//if userid changed from last iteration, store new userid and change color
// $lastid = $detail->payment->userid;
if ($dataset->server_state == 'editor_accepted') {
$rowclass = 'editor_accepted';
} elseif ($dataset->server_state == 'released') {
$rowclass = 'released';
}
@endphp
<tr>
<td>
@if ($dataset->titles()->first())
{{ $dataset->titles()->first()->value }}
@else
no title
@endif
</td>
<td>
{{ $dataset->id }}
</td>
<td>
{{ $dataset->server_state }}
</td>
@if ($dataset->server_state == "approved")
<td>editor: {{ optional($dataset->editor)->login }}</td>
@endif
<td>
@if ($dataset->server_state == "approved")
<a class="pure-button">
<i class="fa fa-check"></i>
<span>Review</span>
</a>
@endif
</td>
{{-- <td>
@if ($dataset->server_state == "unpublished")
<a href="{{ URL::route('publish.review.changestate',['id' => $dataset->id, 'targetState' => 'published']) }}" class="pure-button button-small is-success">Publish</a>
@endif
</td> --}}
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@stop

View file

@ -29,7 +29,9 @@
}
elseif ($dataset->server_state == 'editor_accepted') {
$rowclass = 'editor_accepted';
}
} elseif ($dataset->server_state == 'approved') {
$rowclass = 'approved';
}
@endphp
<tr class="{{ $rowclass }}">
<td>

View file

@ -29,12 +29,15 @@
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2 pure-div">
{!! Form::label('editor_id', 'preferred editor:') !!}
<div class="select pure-u-23-24">
{!! Form::select('editor_id', $editors, null, ['id' => 'editor_id', 'placeholder' => '-- select editor --', 'v-model' =>
'dataset.editor_id', "v-validate" => "'required'"]) !!}
</div>
<span class="help is-danger" v-if="errors.has('editor_id')" v-text="errors.first('editor_id')"></span>
{!! Form::label('preferred_editor', 'preferred editor:') !!}
{{-- {!! Form::select('editor_id', $editors, null, ['id' => 'editor_id', 'placeholder' => '-- select editor --', 'v-model' =>
'dataset.editor_id', "v-validate" => "'required'"]) !!} --}}
{!! Form::text('preferred_editor', null, ['id' => 'preferred_editor', 'class'=>'pure-u-23-24',
'placeholder' => '-- enter name of preferred editor --',
'v-model' => 'dataset.preferred_editor', "v-validate" => "'required|min:3|max:20'"]) !!}
<span class="help is-danger" v-if="errors.has('preferred_editor')" v-text="errors.first('preferred_editor')"></span>
</div>
</div>