Skip to content

Firefly III: a personal finances manager

Fix some route names.

James Colea07c52e0d829
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)}) }}
<div class="row">
<div class="col-lg-6 col-lg-offset-3 col-md-12 col-sm-12">
<div class="box box-danger">
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 %}
- <form method="POST" action="{{ route('attachment.update', attachment.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update">
+ <form method="POST" action="{{ route('attachments.update', attachment.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="id" value="{{ attachment.id }}"/>
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 @@
<tr>
<td>
<div class="btn-group btn-group-xs">
- <a href="{{ route('attachment.edit', att.id) }}" class="btn btn-default"><i class="fa fa-pencil"></i></a>
- <a href="{{ route('attachment.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
+ <a href="{{ route('attachments.edit', att.id) }}" class="btn btn-default"><i class="fa fa-pencil"></i></a>
+ <a href="{{ route('attachments.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
</div>
</td>
<td>
<i class="fa {{ att.mime|mimeIcon }}"></i>
- <a href="{{ route('attachment.download', att.id) }}" title="{{ att.filename }}">
+ <a href="{{ route('attachments.download', att.id) }}" title="{{ att.filename }}">
{% if att.title %}
{{ att.title }}
{% else %}