publish view
This commit is contained in:
parent
5193e4f5b5
commit
f7673e33e0
|
@ -41,7 +41,9 @@ class EditorController extends Controller
|
||||||
->orWhere(function ($query) use ($user_id) {
|
->orWhere(function ($query) use ($user_id) {
|
||||||
$query->where('server_state', 'editor_accepted')
|
$query->where('server_state', 'editor_accepted')
|
||||||
->where('editor_id', $user_id);
|
->where('editor_id', $user_id);
|
||||||
})->get();
|
})
|
||||||
|
->orderBy('server_state')
|
||||||
|
->get();
|
||||||
return view('workflow.editor.index', compact('datasets'));
|
return view('workflow.editor.index', compact('datasets'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
75
app/Http/Controllers/Publish/PublishController.php
Normal file
75
app/Http/Controllers/Publish/PublishController.php
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers\Publish;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Dataset;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PublishController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//$this->middleware('auth');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a listing of released and accepted datasets.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
$userId = $user->id;
|
||||||
|
|
||||||
|
$builder = Dataset::query();
|
||||||
|
//"select * from [documents] where [server_state] in (?) or ([server_state] = ? and [editor_id] = ?)"
|
||||||
|
$datasets = $builder
|
||||||
|
->where('server_state', 'reviewed')
|
||||||
|
|
||||||
|
->get();
|
||||||
|
return view('workflow.publish.index', [
|
||||||
|
'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'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -95,8 +95,6 @@ class ReviewController extends Controller
|
||||||
$attributes = $fieldValue;
|
$attributes = $fieldValue;
|
||||||
$value = "<ul>";
|
$value = "<ul>";
|
||||||
foreach ($attributes as $property_name => $subValue) {
|
foreach ($attributes as $property_name => $subValue) {
|
||||||
// $fieldName = $property_name;
|
|
||||||
// $fieldval = $subValue;
|
|
||||||
$value = $value . "<li>" . $property_name . " : " . $subValue . "</li>";
|
$value = $value . "<li>" . $property_name . " : " . $subValue . "</li>";
|
||||||
}
|
}
|
||||||
$value = $value . "</ul>";
|
$value = $value . "</ul>";
|
||||||
|
@ -118,9 +116,6 @@ class ReviewController extends Controller
|
||||||
public function reviewUpdate(Request $request, $id)
|
public function reviewUpdate(Request $request, $id)
|
||||||
{
|
{
|
||||||
$dataset = Dataset::findOrFail($id);
|
$dataset = Dataset::findOrFail($id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$input = $request->all();
|
$input = $request->all();
|
||||||
$input['server_state'] = 'reviewed';
|
$input['server_state'] = 'reviewed';
|
||||||
|
|
||||||
|
@ -134,7 +129,7 @@ class ReviewController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
//snakeToCamel
|
//snakeToCamel
|
||||||
public static function convertColumnToFieldname($columnname)
|
private static function convertColumnToFieldname($columnname)
|
||||||
{
|
{
|
||||||
//return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $columnname))));
|
//return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $columnname))));
|
||||||
return ucwords(str_replace(['-', '_'], ' ', $columnname));
|
return ucwords(str_replace(['-', '_'], ' ', $columnname));
|
||||||
|
|
|
@ -113,6 +113,11 @@
|
||||||
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review.index') }}"><i class="fa fa-upload"></i> REVIEW PAGE: Approved datasets</a>
|
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review.index') }}"><i class="fa fa-upload"></i> REVIEW PAGE: Approved datasets</a>
|
||||||
</li>
|
</li>
|
||||||
@endpermission
|
@endpermission
|
||||||
|
@permission('dataset-publish-list')
|
||||||
|
<li class="pure-menu-item {{ Route::is('publish.workflow.publish.index') ? 'active' : '' }}">
|
||||||
|
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.publish.index') }}"><i class="fa fa-upload"></i> Publish PAGE: Reviewed datasets</a>
|
||||||
|
</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>
|
||||||
|
|
78
resources/views/workflow/publish/index.blade.php
Normal file
78
resources/views/workflow/publish/index.blade.php
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
@extends('settings.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="header">
|
||||||
|
<h3 class="header-title">
|
||||||
|
<i class="fa fa-file"></i> PUBLISH PAGE: Publish reviewed datasets
|
||||||
|
</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>Reviewer</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>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ optional($dataset->editor)->login }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
{{ optional($dataset->reviewer)->login }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
@if ($dataset->server_state == "reviewed")
|
||||||
|
<a href="{{ URL::route('publish.workflow.publish.publish', $dataset->id) }}" class="pure-button">
|
||||||
|
<i class="fa fa-check"></i>
|
||||||
|
<span>Publish</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
|
85
resources/views/workflow/publish/publish.blade.php
Normal file
85
resources/views/workflow/publish/publish.blade.php
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
@extends('settings.layouts.app')
|
||||||
|
@section('content')
|
||||||
|
<div class="header">
|
||||||
|
<h3 class="header-title">
|
||||||
|
<i class="fa fa-share"></i> Review approved dataset
|
||||||
|
</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.publish.publishUpdate', $dataset->id],
|
||||||
|
'id' => 'publishForm', 'class' => 'pure-form', 'enctype' => 'multipart/form-data', 'v-on:submit.prevent' => 'checkForm'])
|
||||||
|
!!}
|
||||||
|
<fieldset id="fieldset-General">
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Selected Dataset</h3>
|
||||||
|
<table style="margin-left: 2em">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align: top; padding-right: 1em">{{ $dataset->id }}</td>
|
||||||
|
<td>
|
||||||
|
@foreach($dataset->titles as $title)
|
||||||
|
<div class="title" style="font-weight: bold">
|
||||||
|
{{ $title->value }}
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
<div class="authors">
|
||||||
|
@foreach($dataset->persons as $author)
|
||||||
|
|
||||||
|
{{ $author->full_name }}
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="selected[]" value="49">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="instruction">
|
||||||
|
Are you sure you want to accept the selected dataset?
|
||||||
|
</div>
|
||||||
|
<table>
|
||||||
|
<tbody><tr>
|
||||||
|
<td> </td>
|
||||||
|
<td>
|
||||||
|
<button type="submit" class="pure-button">
|
||||||
|
<i class="fa fa-share"></i>
|
||||||
|
<span>Set published</span>
|
||||||
|
</button>
|
||||||
|
{{-- <input type="submit" name="sureno" value="No"> --}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
{{-- <div class="pure-controls">
|
||||||
|
<button type="submit" class="pure-button">
|
||||||
|
<i class="fa fa-share"></i>
|
||||||
|
<span>Set published</span>
|
||||||
|
</button>
|
||||||
|
</div> --}}
|
||||||
|
|
||||||
|
{!! Form::close() !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@stop
|
||||||
|
@section('after-scripts')
|
||||||
|
@stop
|
|
@ -116,6 +116,20 @@ Route::group(
|
||||||
'as' => 'workflow.review.reviewUpdate', 'uses' => 'ReviewController@reviewUpdate',
|
'as' => 'workflow.review.reviewUpdate', 'uses' => 'ReviewController@reviewUpdate',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
//publisher
|
||||||
|
Route::get('workflow/publish/index', [
|
||||||
|
'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/review/{id}', [
|
||||||
|
'middleware' => ['permission:dataset-publish'],
|
||||||
|
'as' => 'workflow.publish.publishUpdate', 'uses' => 'PublishController@publishUpdate',
|
||||||
|
]);
|
||||||
|
|
||||||
Route::get('workflow/changestate/{id}/changestate/{targetState}', [
|
Route::get('workflow/changestate/{id}/changestate/{targetState}', [
|
||||||
'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
|
'as' => 'review.changestate', 'uses' => 'SubmitController@changestate',
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user