From a07c52e0d8290135d5545380ae7c26ad253d6169 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 19 Jul 2015 12:21:38 +0200 Subject: [PATCH] Fix some route names. --- app/Http/Controllers/AttachmentController.php | 16 +++++++++++----- app/Http/routes.php | 12 ++++++------ resources/twig/attachments/delete.twig | 2 +- resources/twig/attachments/edit.twig | 2 +- resources/twig/transactions/show.twig | 6 +++--- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index ebeda10cb0..533fa6f9c1 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -43,6 +43,12 @@ class AttachmentController extends Controller $subTitleIcon = 'fa-pencil'; $subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); + // put previous url in session if not redirect from store (not "return_to_edit"). + if (Session::get('attachments.edit.fromUpdate') !== true) { + Session::put('attachments.edit.url', URL::previous()); + } + Session::forget('attachments.edit.fromUpdate'); + return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle')); } @@ -56,7 +62,7 @@ class AttachmentController extends Controller $subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]); // put previous url in session - Session::put('attachment.delete.url', URL::previous()); + Session::put('attachments.delete.url', URL::previous()); Session::flash('gaEventCategory', 'attachments'); Session::flash('gaEventAction', 'delete-attachment'); @@ -78,7 +84,7 @@ class AttachmentController extends Controller Session::flash('success', trans('firefly.attachment_deleted', ['name' => $name])); Preferences::mark(); - return redirect(Session::get('attachment.delete.url')); + return redirect(Session::get('attachments.delete.url')); } /** @@ -133,13 +139,13 @@ class AttachmentController extends Controller if (intval(Input::get('return_to_edit')) === 1) { // set value so edit routine will not overwrite URL: - Session::put('attachment.edit.fromUpdate', true); + Session::put('attachments.edit.fromUpdate', true); - return redirect(route('attachment.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]); + return redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]); } // redirect to previous URL. - return redirect(Session::get('attachment.edit.url')); + return redirect(Session::get('attachments.edit.url')); } diff --git a/app/Http/routes.php b/app/Http/routes.php index d8c4af2f4f..5dcd842cd2 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -197,13 +197,13 @@ Route::group( * Attachment Controller */ - Route::post('/attachment/update/{attachment}', ['uses' => 'AttachmentController@update', 'as' => 'attachment.update']); - Route::post('/attachment/destroy/{attachment}', ['uses' => 'AttachmentController@destroy', 'as' => 'attachment.destroy']); + Route::post('/attachment/update/{attachment}', ['uses' => 'AttachmentController@update', 'as' => 'attachments.update']); + Route::post('/attachment/destroy/{attachment}', ['uses' => 'AttachmentController@destroy', 'as' => 'attachments.destroy']); - Route::get('/attachment/edit/{attachment}', ['uses' => 'AttachmentController@edit', 'as' => 'attachment.edit']); - Route::get('/attachment/delete/{attachment}', ['uses' => 'AttachmentController@delete', 'as' => 'attachment.delete']); - Route::get('/attachment/show/{attachment}', ['uses' => 'AttachmentController@show', 'as' => 'attachment.show']); - Route::get('/attachment/download/{attachment}', ['uses' => 'AttachmentController@download', 'as' => 'attachment.download']); + Route::get('/attachment/edit/{attachment}', ['uses' => 'AttachmentController@edit', 'as' => 'attachments.edit']); + Route::get('/attachment/delete/{attachment}', ['uses' => 'AttachmentController@delete', 'as' => 'attachments.delete']); + Route::get('/attachment/show/{attachment}', ['uses' => 'AttachmentController@show', 'as' => 'attachments.show']); + Route::get('/attachment/download/{attachment}', ['uses' => 'AttachmentController@download', 'as' => 'attachments.download']); /** diff --git a/resources/twig/attachments/delete.twig b/resources/twig/attachments/delete.twig index 3f8a7bb077..3b7d412b32 100644 --- a/resources/twig/attachments/delete.twig +++ b/resources/twig/attachments/delete.twig @@ -6,7 +6,7 @@ {% block content %} - {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('attachment.destroy',attachment.id)}) }} + {{ Form.open({'class' : 'form-horizontal','id' : 'destroy','url' : route('attachments.destroy',attachment.id)}) }}
diff --git a/resources/twig/attachments/edit.twig b/resources/twig/attachments/edit.twig index 600f6b4e3a..515168b2ab 100644 --- a/resources/twig/attachments/edit.twig +++ b/resources/twig/attachments/edit.twig @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -
+ diff --git a/resources/twig/transactions/show.twig b/resources/twig/transactions/show.twig index 3c5421b656..9cb115f2c7 100644 --- a/resources/twig/transactions/show.twig +++ b/resources/twig/transactions/show.twig @@ -87,13 +87,13 @@
- - + +
- + {% if att.title %} {{ att.title }} {% else %}