From 19fc0fa872f2da50b1c253bb7e7362c9b4c35780 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 10 Apr 2019 10:54:15 +0200 Subject: [PATCH] publication workflow: accept status --- .../Publish/WorkflowController.php | 19 +++++++++++---- public/backend/style.css | 5 ++++ resources/lang/en/exceptions.php | 3 +++ .../views/settings/layouts/app.blade.php | 6 +++++ resources/views/workflow/accept.blade.php | 12 +++------- .../views/workflow/editor_index.blade.php | 24 +++++++++++++++---- resources/views/workflow/index.blade.php | 5 +++- routes/web.php | 2 +- 8 files changed, 56 insertions(+), 20 deletions(-) diff --git a/app/Http/Controllers/Publish/WorkflowController.php b/app/Http/Controllers/Publish/WorkflowController.php index f5e0f29..911ad0f 100644 --- a/app/Http/Controllers/Publish/WorkflowController.php +++ b/app/Http/Controllers/Publish/WorkflowController.php @@ -29,8 +29,8 @@ class WorkflowController extends Controller $builder = Dataset::query(); $myDatasets = $builder - ->whereIn('server_state', ['inprogress', 'released']) - // ->where('account_id', $user_id) + ->whereIn('server_state', ['inprogress', 'released', 'editor_accepted']) + ->where('account_id', $user_id) ->with('user:id,login') ->get(); return view('workflow.index', [ @@ -120,7 +120,7 @@ class WorkflowController extends Controller $builder = Dataset::query(); $datasets = $builder //->where('server_state', 'inprogress') - ->whereIn('server_state', ['released']) + ->whereIn('server_state', ['released', 'editor_accepted']) ->get(); return view('workflow.editor_index', compact('datasets')); } @@ -152,6 +152,17 @@ class WorkflowController extends Controller public function acceptUpdate(Request $request, $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() @@ -190,7 +201,7 @@ class WorkflowController extends Controller session()->flash('flash_message', 'You have puplished 1 dataset!'); } $dataset->save(); - return redirect()->back(); + //return redirect()->back(); //return redirect()->route('settings.review.index'); } catch (Exception $e) { //return $this->_redirectTo('index', array('failure' => $e->getMessage()), 'documents', 'admin'); diff --git a/public/backend/style.css b/public/backend/style.css index dae2a80..a78b2ea 100644 --- a/public/backend/style.css +++ b/public/backend/style.css @@ -943,6 +943,11 @@ textarea.large, input.large { .pure-table tr.released { background-color: greenyellow; } +.pure-table tr.editor_accepted { + padding: 0.8em; + background-color: lightblue; +} + diff --git a/resources/lang/en/exceptions.php b/resources/lang/en/exceptions.php index 47e496c..7c8621f 100644 --- a/resources/lang/en/exceptions.php +++ b/resources/lang/en/exceptions.php @@ -16,6 +16,9 @@ return [ 'release' => [ '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' => [ diff --git a/resources/views/settings/layouts/app.blade.php b/resources/views/settings/layouts/app.blade.php index 2900447..972a755 100644 --- a/resources/views/settings/layouts/app.blade.php +++ b/resources/views/settings/layouts/app.blade.php @@ -92,15 +92,21 @@
  • Publish