Fix some route names.

This commit is contained in:
James Cole 2015-07-19 12:21:38 +02:00
parent 7bb07d7f55
commit a07c52e0d8
5 changed files with 22 additions and 16 deletions

View File

@ -43,6 +43,12 @@ class AttachmentController extends Controller
$subTitleIcon = 'fa-pencil'; $subTitleIcon = 'fa-pencil';
$subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); $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')); return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));
} }
@ -56,7 +62,7 @@ class AttachmentController extends Controller
$subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]); $subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]);
// put previous url in session // 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('gaEventCategory', 'attachments');
Session::flash('gaEventAction', 'delete-attachment'); Session::flash('gaEventAction', 'delete-attachment');
@ -78,7 +84,7 @@ class AttachmentController extends Controller
Session::flash('success', trans('firefly.attachment_deleted', ['name' => $name])); Session::flash('success', trans('firefly.attachment_deleted', ['name' => $name]));
Preferences::mark(); 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) { if (intval(Input::get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL: // 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. // redirect to previous URL.
return redirect(Session::get('attachment.edit.url')); return redirect(Session::get('attachments.edit.url'));
} }

View File

@ -197,13 +197,13 @@ Route::group(
* Attachment Controller * Attachment Controller
*/ */
Route::post('/attachment/update/{attachment}', ['uses' => 'AttachmentController@update', 'as' => 'attachment.update']); Route::post('/attachment/update/{attachment}', ['uses' => 'AttachmentController@update', 'as' => 'attachments.update']);
Route::post('/attachment/destroy/{attachment}', ['uses' => 'AttachmentController@destroy', 'as' => 'attachment.destroy']); 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/edit/{attachment}', ['uses' => 'AttachmentController@edit', 'as' => 'attachments.edit']);
Route::get('/attachment/delete/{attachment}', ['uses' => 'AttachmentController@delete', 'as' => 'attachment.delete']); Route::get('/attachment/delete/{attachment}', ['uses' => 'AttachmentController@delete', 'as' => 'attachments.delete']);
Route::get('/attachment/show/{attachment}', ['uses' => 'AttachmentController@show', 'as' => 'attachment.show']); Route::get('/attachment/show/{attachment}', ['uses' => 'AttachmentController@show', 'as' => 'attachments.show']);
Route::get('/attachment/download/{attachment}', ['uses' => 'AttachmentController@download', 'as' => 'attachment.download']); Route::get('/attachment/download/{attachment}', ['uses' => 'AttachmentController@download', 'as' => 'attachments.download']);
/** /**

View File

@ -6,7 +6,7 @@
{% block content %} {% 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="row">
<div class="col-lg-6 col-lg-offset-3 col-md-12 col-sm-12"> <div class="col-lg-6 col-lg-offset-3 col-md-12 col-sm-12">
<div class="box box-danger"> <div class="box box-danger">

View File

@ -5,7 +5,7 @@
{% endblock %} {% endblock %}
{% block content %} {% 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="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="id" value="{{ attachment.id }}"/> <input type="hidden" name="id" value="{{ attachment.id }}"/>

View File

@ -87,13 +87,13 @@
<tr> <tr>
<td> <td>
<div class="btn-group btn-group-xs"> <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('attachments.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.delete', att.id) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
</div> </div>
</td> </td>
<td> <td>
<i class="fa {{ att.mime|mimeIcon }}"></i> <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 %} {% if att.title %}
{{ att.title }} {{ att.title }}
{% else %} {% else %}