From ec127b9457c19e769c72f48e0f9df428c5d4ca03 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 3 Apr 2019 18:06:10 +0200 Subject: [PATCH] move publish logic to publish namespace --- .../Controllers/Publish/IndexController.php | 12 ++- .../WorkflowController.php | 2 +- app/Http/Controllers/ShelfController.php | 70 --------------- composer.lock | 87 +++++++++---------- .../views/settings/layouts/app.blade.php | 8 +- resources/views/workflow/release.blade.php | 2 +- resources/views/workflow/review.blade.php | 2 +- routes/web.php | 42 +++------ 8 files changed, 69 insertions(+), 156 deletions(-) rename app/Http/Controllers/{Settings => Publish}/WorkflowController.php (98%) delete mode 100755 app/Http/Controllers/ShelfController.php diff --git a/app/Http/Controllers/Publish/IndexController.php b/app/Http/Controllers/Publish/IndexController.php index 3d4cf5f..460b2d6 100644 --- a/app/Http/Controllers/Publish/IndexController.php +++ b/app/Http/Controllers/Publish/IndexController.php @@ -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(); diff --git a/app/Http/Controllers/Settings/WorkflowController.php b/app/Http/Controllers/Publish/WorkflowController.php similarity index 98% rename from app/Http/Controllers/Settings/WorkflowController.php rename to app/Http/Controllers/Publish/WorkflowController.php index ac92e8a..19a4039 100644 --- a/app/Http/Controllers/Settings/WorkflowController.php +++ b/app/Http/Controllers/Publish/WorkflowController.php @@ -1,5 +1,5 @@ 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'); - } -} diff --git a/composer.lock b/composer.lock index 7917f2e..9fe7a12 100755 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/resources/views/settings/layouts/app.blade.php b/resources/views/settings/layouts/app.blade.php index 556ef39..b185828 100644 --- a/resources/views/settings/layouts/app.blade.php +++ b/resources/views/settings/layouts/app.blade.php @@ -95,11 +95,11 @@
  • Create
  • -
  • - Release pending datasets +
  • + Release pending datasets
  • -
  • - Review/Publish unpublished datasets +
  • + Review/Publish unpublished datasets
  • diff --git a/resources/views/workflow/release.blade.php b/resources/views/workflow/release.blade.php index 66a325d..9ae5c3c 100644 --- a/resources/views/workflow/release.blade.php +++ b/resources/views/workflow/release.blade.php @@ -36,7 +36,7 @@ @if ($dataset->server_state == "inprogress") - Release + Release {{-- Restrict --}} @endif diff --git a/resources/views/workflow/review.blade.php b/resources/views/workflow/review.blade.php index fa7706b..2384f09 100644 --- a/resources/views/workflow/review.blade.php +++ b/resources/views/workflow/review.blade.php @@ -36,7 +36,7 @@ @if ($dataset->server_state == "unpublished") - Publish + Publish {{-- Restrict --}} @endif diff --git a/routes/web.php b/routes/web.php index 0e8b75a..e547170 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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', + ]); } ); @@ -119,16 +129,7 @@ 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', [