publish view
This commit is contained in:
parent
5193e4f5b5
commit
f7673e33e0
8 changed files with 262 additions and 8 deletions
|
@ -41,7 +41,9 @@ class EditorController extends Controller
|
|||
->orWhere(function ($query) use ($user_id) {
|
||||
$query->where('server_state', 'editor_accepted')
|
||||
->where('editor_id', $user_id);
|
||||
})->get();
|
||||
})
|
||||
->orderBy('server_state')
|
||||
->get();
|
||||
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;
|
||||
$value = "<ul>";
|
||||
foreach ($attributes as $property_name => $subValue) {
|
||||
// $fieldName = $property_name;
|
||||
// $fieldval = $subValue;
|
||||
$value = $value . "<li>" . $property_name . " : " . $subValue . "</li>";
|
||||
}
|
||||
$value = $value . "</ul>";
|
||||
|
@ -118,9 +116,6 @@ class ReviewController extends Controller
|
|||
public function reviewUpdate(Request $request, $id)
|
||||
{
|
||||
$dataset = Dataset::findOrFail($id);
|
||||
|
||||
|
||||
|
||||
$input = $request->all();
|
||||
$input['server_state'] = 'reviewed';
|
||||
|
||||
|
@ -134,7 +129,7 @@ class ReviewController extends Controller
|
|||
}
|
||||
|
||||
//snakeToCamel
|
||||
public static function convertColumnToFieldname($columnname)
|
||||
private static function convertColumnToFieldname($columnname)
|
||||
{
|
||||
//return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $columnname))));
|
||||
return ucwords(str_replace(['-', '_'], ' ', $columnname));
|
||||
|
|
|
@ -25,7 +25,7 @@ class SubmitController extends Controller
|
|||
|
||||
$builder = Dataset::query();
|
||||
$myDatasets = $builder
|
||||
->orderBy('server_state')
|
||||
->orderBy('server_state')
|
||||
->whereIn('server_state', ['inprogress', 'released', 'editor_accepted', 'approved', 'reviewed'])
|
||||
->where('account_id', $user_id)
|
||||
->with('user:id,login')
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue