publication workflow: accept status

This commit is contained in:
Arno Kaimbacher 2019-04-10 10:54:15 +02:00
parent 246577b0b0
commit 19fc0fa872
8 changed files with 56 additions and 20 deletions

View File

@ -29,8 +29,8 @@ class WorkflowController extends Controller
$builder = Dataset::query(); $builder = Dataset::query();
$myDatasets = $builder $myDatasets = $builder
->whereIn('server_state', ['inprogress', 'released']) ->whereIn('server_state', ['inprogress', 'released', 'editor_accepted'])
// ->where('account_id', $user_id) ->where('account_id', $user_id)
->with('user:id,login') ->with('user:id,login')
->get(); ->get();
return view('workflow.index', [ return view('workflow.index', [
@ -120,7 +120,7 @@ class WorkflowController extends Controller
$builder = Dataset::query(); $builder = Dataset::query();
$datasets = $builder $datasets = $builder
//->where('server_state', 'inprogress') //->where('server_state', 'inprogress')
->whereIn('server_state', ['released']) ->whereIn('server_state', ['released', 'editor_accepted'])
->get(); ->get();
return view('workflow.editor_index', compact('datasets')); return view('workflow.editor_index', compact('datasets'));
} }
@ -152,6 +152,17 @@ class WorkflowController extends Controller
public function acceptUpdate(Request $request, $id) public function acceptUpdate(Request $request, $id)
{ {
$dataset = Dataset::findOrFail($id); $dataset = Dataset::findOrFail($id);
try {
$dataset->setServerState("editor_accepted");
$user = Auth::user();
$dataset->editor()->associate($user)->save();
$dataset->save();
return redirect()->back();
//return redirect()->route('settings.review.index');
} catch (Exception $e) {
throw new GeneralException(trans('exceptions.publish.accept.update_error'));
}
} }
// public function release() // public function release()
@ -190,7 +201,7 @@ class WorkflowController extends Controller
session()->flash('flash_message', 'You have puplished 1 dataset!'); session()->flash('flash_message', 'You have puplished 1 dataset!');
} }
$dataset->save(); $dataset->save();
return redirect()->back(); //return redirect()->back();
//return redirect()->route('settings.review.index'); //return redirect()->route('settings.review.index');
} catch (Exception $e) { } catch (Exception $e) {
//return $this->_redirectTo('index', array('failure' => $e->getMessage()), 'documents', 'admin'); //return $this->_redirectTo('index', array('failure' => $e->getMessage()), 'documents', 'admin');

View File

@ -943,6 +943,11 @@ textarea.large, input.large {
.pure-table tr.released { .pure-table tr.released {
background-color: greenyellow; background-color: greenyellow;
} }
.pure-table tr.editor_accepted {
padding: 0.8em;
background-color: lightblue;
}

View File

@ -16,6 +16,9 @@ return [
'release' => [ 'release' => [
'update_error' => 'There was a problem rleasing this dataset. Please try again.', 'update_error' => 'There was a problem rleasing this dataset. Please try again.',
], ],
'accept' => [
'update_error' => 'There was a problem accepting this dataset. Please try again.',
],
], ],
'backend' => [ 'backend' => [

View File

@ -92,15 +92,21 @@
<li class="treeview"> <li class="treeview">
<h2 class="pure-menu-heading">Publish</h2> <h2 class="pure-menu-heading">Publish</h2>
<ul class="pure-menu-list"> <ul class="pure-menu-list">
@permission('dataset-create')
<li class="pure-menu-item {{ Route::is('publish.dataset.create') ? 'active' : '' }}"> <li class="pure-menu-item {{ Route::is('publish.dataset.create') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.dataset.create') }}"><i class="fa fa-upload"></i> Create</a> <a class="pure-menu-link" href="{{ URL::route('publish.dataset.create') }}"><i class="fa fa-upload"></i> Create</a>
</li> </li>
@endpermission
@permission('dataset-list')
<li class="pure-menu-item {{ Route::is('publish.workflow.index') ? 'active' : '' }}"> <li class="pure-menu-item {{ Route::is('publish.workflow.index') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.index') }}"><i class="fa fa-upload"></i> All my datasets</a> <a class="pure-menu-link" href="{{ URL::route('publish.workflow.index') }}"><i class="fa fa-upload"></i> All my datasets</a>
</li> </li>
@endpermission
@permission('dataset-editor-list')
<li class="pure-menu-item {{ Route::is('publish.workflow.editorIndex') ? 'active' : '' }}"> <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> <a class="pure-menu-link" href="{{ URL::route('publish.workflow.editorIndex') }}"><i class="fa fa-upload"></i> EDITOR PAGE: Released datasets</a>
</li> </li>
@endpermission
{{-- <li class="pure-menu-item {{ Route::is('publish.workflow.release') ? 'active' : '' }}"> {{-- <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> <a class="pure-menu-link" href="{{ URL::route('publish.workflow.release') }}"><i class="fa fa-upload"></i> Release pending datasets</a>
</li> </li>

View File

@ -33,7 +33,7 @@
} }
@endphp @endphp
{!! Form::model($dataset, [ 'method' => 'POST', 'id' => 'acceptForm', {!! Form::model($dataset, [ 'method' => 'POST', 'route' => ['publish.workflow.acceptUpdate', $dataset->id], 'id' => 'acceptForm',
'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) !!} 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm']) !!}
<fieldset id="fieldset-General"> <fieldset id="fieldset-General">
<legend>General</legend> <legend>General</legend>
@ -65,7 +65,7 @@
<br /> <br />
<div class="pure-controls"> <div class="pure-controls">
<button :disabled="errors.any()" type="submit" class="pure-button"> <button type="submit" class="pure-button">
<i class="fa fa-share"></i> <i class="fa fa-share"></i>
<span>Accept</span> <span>Accept</span>
</button> </button>
@ -79,11 +79,5 @@
@stop @stop
@section('after-scripts') {{-- @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/releaseDataset.js') }}"></script>
@stop @stop

View File

@ -13,14 +13,23 @@
<thead> <thead>
<th>Dataset Title</th> <th>Dataset Title</th>
<th>ID</th> <th>ID</th>
<th>Server State</th> <th>Server State</th>
<th>Preferred Editor</th> <th>Editor</th>
<th></th> <th></th>
</thead> </thead>
<tbody> <tbody>
@foreach($datasets as $dataset) @foreach($datasets as $dataset)
<tr> @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 class="{{ $rowclass }}">
<td> <td>
@if ($dataset->titles()->first()) @if ($dataset->titles()->first())
{{ $dataset->titles()->first()->value }} {{ $dataset->titles()->first()->value }}
@ -34,7 +43,12 @@
<td> <td>
{{ $dataset->server_state }} {{ $dataset->server_state }}
</td> </td>
<td> {{ optional($dataset->editor)->login }} </td> @if ($dataset->server_state == "released")
<td>Preferred editor: {{ optional($dataset->editor)->login }} </td>
@elseif ($dataset->server_state == "editor_accepted")
<td>in approvement by {{ optional($dataset->editor)->login }} </td>
@endif
<td> <td>
@if ($dataset->server_state == "released") @if ($dataset->server_state == "released")
<a href="{{ URL::route('publish.workflow.accept', $dataset->id) }}" class="pure-button"> <a href="{{ URL::route('publish.workflow.accept', $dataset->id) }}" class="pure-button">

View File

@ -26,7 +26,10 @@
$rowclass = 'inprogress'; $rowclass = 'inprogress';
} elseif ($dataset->server_state == 'released') { } elseif ($dataset->server_state == 'released') {
$rowclass = 'released'; $rowclass = 'released';
} }
elseif ($dataset->server_state == 'editor_accepted') {
$rowclass = 'editor_accepted';
}
@endphp @endphp
<tr class="{{ $rowclass }}"> <tr class="{{ $rowclass }}">
<td> <td>

View File

@ -76,7 +76,7 @@ Route::group(
// ]); // ]);
Route::get('workflow/editor_index', [ Route::get('workflow/editor_index', [
'middleware' => ['permission:dataset-released-list'], 'middleware' => ['permission:dataset-editor-list'],
'as' => 'workflow.editorIndex', 'uses' => 'WorkflowController@editorIndex', 'as' => 'workflow.editorIndex', 'uses' => 'WorkflowController@editorIndex',
]); ]);
Route::get('workflow/accept/{id}', [ Route::get('workflow/accept/{id}', [