move publish logic to publish namespace

This commit is contained in:
Arno Kaimbacher 2019-04-03 18:06:10 +02:00
parent 415016a4c2
commit ec127b9457
8 changed files with 69 additions and 156 deletions

View File

@ -366,7 +366,9 @@ class IndexController extends Controller
$title = new Title();
$title->value = $formTitle['value'];
$title->language = $formTitle['language'];
$dataset->addMainTitle($title);
$title->type = 'main';
//$dataset->addMainTitle($title);
$dataset->titles()->save($title);
}
//save additional titles
@ -383,7 +385,9 @@ class IndexController extends Controller
$abstract = new Description();
$abstract->value = $formAbstract['value'];
$abstract->language = $formAbstract['language'];
$dataset->addMainAbstract($abstract);
$abstract->type = 'abstract';
//$dataset->addMainAbstract($abstract);
$dataset->abstracts()->save($abstract);
}
//save additional descriptions
@ -431,8 +435,8 @@ class IndexController extends Controller
$user = Auth::user();
$dataset->user()->associate($user)->save();
$error = 'Always throw this error';
throw new \Exception($error);
// $error = 'Always throw this error';
// throw new \Exception($error);
// all good//commit everything
DB::commit();

View File

@ -1,5 +1,5 @@
<?php
namespace App\Http\Controllers\Settings;
namespace App\Http\Controllers\Publish;
use App\Http\Controllers\Controller;
// use App\Http\Requests\ProjectRequest;

View File

@ -1,70 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Shelf;
use App\Http\Requests\ShelfRequest;
use Illuminate\Http\Request;
class ShelfController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$shelves = Shelf::get();
return view('lms.settings.shelf.shelf', compact('shelves'));
}
public function add()
{
return view('lms.settings.shelf.add');
}
public function store(ShelfRequest $request)
{
$input = $request->all();
$shelf = Shelf::create($input);
//flash messaging
session()->flash('flash_message', 'You have been added 1 shelf!');
return redirect()->route('settings.shelf');
}
public function edit($id)
{
$shelf = Shelf::findOrFail($id);
return view('lms.settings.shelf.edit', compact('shelf'));
}
public function update($id, ShelfRequest $request)
{
$shelf = Shelf::findOrFail($id);
$input = $request->all();
$shelf->update($input);
session()->flash('flash_message', 'You have been updated 1 shelf!');
return redirect()->route('settings.shelf');
}
public function delete($id)
{
$shelf = Shelf::findOrFail($id);
$shelf->delete();
session()->flash('flash_message', 'You have been deleted 1 shelf!');
return redirect()->route('settings.shelf');
}
}

87
composer.lock generated
View File

@ -392,16 +392,16 @@
},
{
"name": "erusev/parsedown",
"version": "v1.7.2",
"version": "1.7.3",
"source": {
"type": "git",
"url": "https://github.com/erusev/parsedown.git",
"reference": "d60bcdc46978357759ecb13cb4b078da783f8faf"
"reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/d60bcdc46978357759ecb13cb4b078da783f8faf",
"reference": "d60bcdc46978357759ecb13cb4b078da783f8faf",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/6d893938171a817f4e9bc9e86f2da1e370b7bcd7",
"reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7",
"shasum": ""
},
"require": {
@ -434,7 +434,7 @@
"markdown",
"parser"
],
"time": "2019-03-17T17:19:46+00:00"
"time": "2019-03-17T18:48:37+00:00"
},
{
"name": "felixkiss/uniquewith-validator",
@ -1759,16 +1759,16 @@
},
{
"name": "symfony/console",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "9dc2299a016497f9ee620be94524e6c0af0280a9"
"reference": "24206aff3efe6962593297e57ef697ebb220e384"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9",
"reference": "9dc2299a016497f9ee620be94524e6c0af0280a9",
"url": "https://api.github.com/repos/symfony/console/zipball/24206aff3efe6962593297e57ef697ebb220e384",
"reference": "24206aff3efe6962593297e57ef697ebb220e384",
"shasum": ""
},
"require": {
@ -1827,7 +1827,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-02-23T15:17:42+00:00"
"time": "2019-04-01T07:32:59+00:00"
},
{
"name": "symfony/contracts",
@ -1899,7 +1899,7 @@
},
{
"name": "symfony/css-selector",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -1952,16 +1952,16 @@
},
{
"name": "symfony/debug",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "de73f48977b8eaf7ce22814d66e43a1662cc864f"
"reference": "43ce8ab34c734dcc8a4af576cb86711daab964c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/de73f48977b8eaf7ce22814d66e43a1662cc864f",
"reference": "de73f48977b8eaf7ce22814d66e43a1662cc864f",
"url": "https://api.github.com/repos/symfony/debug/zipball/43ce8ab34c734dcc8a4af576cb86711daab964c5",
"reference": "43ce8ab34c734dcc8a4af576cb86711daab964c5",
"shasum": ""
},
"require": {
@ -2004,20 +2004,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2019-03-03T18:11:24+00:00"
"time": "2019-03-10T17:09:50+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.4.23",
"version": "v3.4.24",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "ec625e2fff7f584eeb91754821807317b2e79236"
"reference": "a088aafcefb4eef2520a290ed82e4374092a6dff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ec625e2fff7f584eeb91754821807317b2e79236",
"reference": "ec625e2fff7f584eeb91754821807317b2e79236",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a088aafcefb4eef2520a290ed82e4374092a6dff",
"reference": "a088aafcefb4eef2520a290ed82e4374092a6dff",
"shasum": ""
},
"require": {
@ -2067,11 +2067,11 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2019-02-23T15:06:07+00:00"
"time": "2019-04-02T08:51:52+00:00"
},
{
"name": "symfony/finder",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@ -2120,16 +2120,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "850a667d6254ccf6c61d853407b16f21c4579c77"
"reference": "5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/850a667d6254ccf6c61d853407b16f21c4579c77",
"reference": "850a667d6254ccf6c61d853407b16f21c4579c77",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1",
"reference": "5b7ab6beaa5b053b8d3c9b13367ada9b292e12e1",
"shasum": ""
},
"require": {
@ -2170,7 +2170,7 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2019-02-26T08:03:39+00:00"
"time": "2019-03-30T15:58:42+00:00"
},
{
"name": "symfony/http-kernel",
@ -2554,16 +2554,16 @@
},
{
"name": "symfony/process",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "6c05edb11fbeff9e2b324b4270ecb17911a8b7ad"
"reference": "1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/6c05edb11fbeff9e2b324b4270ecb17911a8b7ad",
"reference": "6c05edb11fbeff9e2b324b4270ecb17911a8b7ad",
"url": "https://api.github.com/repos/symfony/process/zipball/1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6",
"reference": "1e6cbb41dadcaf29e0db034d6ad0d039a9df06e6",
"shasum": ""
},
"require": {
@ -2599,20 +2599,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2019-01-24T22:05:03+00:00"
"time": "2019-03-10T20:07:02+00:00"
},
{
"name": "symfony/routing",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "ff03eae644e6b1e26d4a04b2385fe3a1a7f04e42"
"reference": "319f600c1ea0f981f6bdc2f042cfc1690957c0e0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/ff03eae644e6b1e26d4a04b2385fe3a1a7f04e42",
"reference": "ff03eae644e6b1e26d4a04b2385fe3a1a7f04e42",
"url": "https://api.github.com/repos/symfony/routing/zipball/319f600c1ea0f981f6bdc2f042cfc1690957c0e0",
"reference": "319f600c1ea0f981f6bdc2f042cfc1690957c0e0",
"shasum": ""
},
"require": {
@ -2635,7 +2635,6 @@
"suggest": {
"doctrine/annotations": "For using the annotation loader",
"symfony/config": "For using the all-in-one router or any loader",
"symfony/dependency-injection": "For loading routes from a service",
"symfony/expression-language": "For using expression matching",
"symfony/http-foundation": "For using a Symfony Request object",
"symfony/yaml": "For using the YAML loader"
@ -2676,20 +2675,20 @@
"uri",
"url"
],
"time": "2019-02-23T15:17:42+00:00"
"time": "2019-03-30T15:58:42+00:00"
},
{
"name": "symfony/translation",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "748464177a77011f8f4cdd076773862ce4915f8f"
"reference": "e46933cc31b68f51f7fc5470fb55550407520f56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/748464177a77011f8f4cdd076773862ce4915f8f",
"reference": "748464177a77011f8f4cdd076773862ce4915f8f",
"url": "https://api.github.com/repos/symfony/translation/zipball/e46933cc31b68f51f7fc5470fb55550407520f56",
"reference": "e46933cc31b68f51f7fc5470fb55550407520f56",
"shasum": ""
},
"require": {
@ -2749,11 +2748,11 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2019-02-27T03:31:50+00:00"
"time": "2019-04-01T14:13:08+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v4.2.4",
"version": "v4.2.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",

View File

@ -95,11 +95,11 @@
<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>
</li>
<li class="pure-menu-item {{ Route::is('settings.workflow.release') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('settings.workflow.release') }}"><i class="fa fa-upload"></i> Release pending datasets</a>
<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>
</li>
<li class="pure-menu-item {{ Route::is('settings.workflow.review') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('settings.workflow.review') }}"><i class="fa fa-upload"></i> Review/Publish unpublished datasets</a>
<li class="pure-menu-item {{ Route::is('publish.workflow.review') ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ URL::route('publish.workflow.review') }}"><i class="fa fa-upload"></i> Review/Publish unpublished datasets</a>
</li>
</ul>
</li>

View File

@ -36,7 +36,7 @@
<td>
@if ($dataset->server_state == "inprogress")
<a href="{{ URL::route('settings.review.changestate',['id' => $dataset->id, 'targetState' => 'unpublished']) }}" class="pure-button button-small is-success">Release</a>
<a href="{{ URL::route('publish.review.changestate',['id' => $dataset->id, 'targetState' => 'unpublished']) }}" class="pure-button button-small is-success">Release</a>
{{-- <a href="" class="pure-button button-small is-success">Restrict</a> --}}
@endif
</td>

View File

@ -36,7 +36,7 @@
<td>
@if ($dataset->server_state == "unpublished")
<a href="{{ URL::route('settings.review.changestate',['id' => $dataset->id, 'targetState' => 'published']) }}" class="pure-button button-small is-success">Publish</a>
<a href="{{ URL::route('publish.review.changestate',['id' => $dataset->id, 'targetState' => 'published']) }}" class="pure-button button-small is-success">Publish</a>
{{-- <a href="" class="pure-button button-small is-success">Restrict</a> --}}
@endif
</td>

View File

@ -45,6 +45,16 @@ Route::group(
// Route::get('dataset/create-step3', ['as' => 'dataset.create3', 'uses' => 'IndexController@createStep3']);
Route::post('dataset/store', ['as' => 'dataset.store', 'uses' => 'IndexController@store']);
Route::get('workflow/review', [
'as' => 'workflow.review', 'uses' => 'WorkflowController@review',
]);
Route::get('workflow/release', [
'as' => 'workflow.release', 'uses' => 'WorkflowController@release',
]);
Route::get('workflow/changestate/{id}/changestate/{targetState}', [
'as' => 'review.changestate', 'uses' => 'WorkflowController@changestate',
]);
}
);
@ -120,15 +130,6 @@ Route::group(
// //For DataTables
Route::get('pages/get', ['uses' => 'PagesTableController@get'])->name('page.get');
Route::get('workflow/review', [
'as' => 'workflow.review', 'uses' => 'WorkflowController@review',
]);
Route::get('workflow/release', [
'as' => 'workflow.release', 'uses' => 'WorkflowController@release',
]);
Route::get('workflow/changestate/{id}/changestate/{targetState}', [
'as' => 'review.changestate', 'uses' => 'WorkflowController@changestate',
]);
}
);
@ -375,27 +376,6 @@ Route::get('history', [
'as' => 'borrow.history', 'uses' => 'BorrowController@histori',
]);
//==================================================================================================================
//=================================================setting shelf====================================================
Route::get('/settings/shelf', [
'as' => 'settings.shelf', 'uses' => 'ShelfController@index',
]);
Route::get('/settings/shelf/add', [
'as' => 'settings.shelf.add', 'uses' => 'ShelfController@add',
]);
Route::post('settings/shelf/add', [
'as' => 'settings.shelf.post', 'uses' => 'ShelfController@store',
]);
Route::get('settings/shelf/edit/{id}', [
'as' => 'settings.shelf.edit', 'uses' => 'ShelfController@edit',
]);
Route::patch('settings/shelf/edit/{id}', [
'as' => 'settings.shelf.update', 'uses' => 'ShelfController@update',
]);
Route::get('settings/shelf/delete/{id}', [
'as' => 'settings.shelf.delete', 'uses' => 'ShelfController@delete',
]);
//=========================================================================================================
//=================================================setting periode=========================================
Route::get('/settings/periode', [