Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Attachment controller basic index.
James Colecabe90b2dd99
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.phpindex 775df201fe..cbeee4d671 100644--- a/app/Http/Controllers/AttachmentController.php+++ b/app/Http/Controllers/AttachmentController.php@@ -147,6 +147,24 @@ class AttachmentController extends Controllerreturn view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));}+ /**+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View+ */+ public function index()+ {+ $set = $this->repository->get();+ $set = $set->each(+ function (Attachment $attachment) {+ $attachment->file_exists = $this->repository->exists($attachment);++ return $attachment;+ }+ );+++ return view('attachments.index', compact('set'));+ }+/*** @param AttachmentFormRequest $request* @param Attachment $attachmentdiff --git a/resources/views/attachments/index.twig b/resources/views/attachments/index.twignew file mode 100644index 0000000000..120c2ddb08--- /dev/null+++ b/resources/views/attachments/index.twig@@ -0,0 +1,64 @@+{% extends "./layout/default" %}++{% block breadcrumbs %}+ {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}+{% endblock %}++{% block content %}+ <div class="row">+ <div class="col-lg-12 col-md-12 col-sm-12">+ <div class="box">+ <div class="box-header with-border">+ <h3 class="box-title">+ List of all attachments+ </h3>+ </div>+ <div class="box-body no-padding">+ <table class="table table-striped">+ <thead>+ <tr>+ <th colspan="2">File name</th>+ <th>Size of file</th>+ <th>Type of file</th>+ <th>Attached to</th>+ <th>Exists?</th>+ </tr>+ </thead>+ <tbody>+ {% for att in set %}+ <tr>+ <td>++ </td>+ <td>{{ att.filename }}</td>+ <td>{{ att.size|filesize }}</td>+ <td>{{ att.mime }}</td>+ <td>+ {% if att.attachable_type == 'FireflyIII\\Models\\TransactionJournal' %}+ <a href="{{ route('transactions.show', [att.attachable_id]) }}">+ {{ att.attachable.description }}+ </a>+ {% endif %}+ </td>+ <td>+ {% if att.file_exists %}+ <i class="fa fa-check text-success"></i>+ {% else %}+ <i class="fa fa-warning text-danger"></i>+ {% endif %}+ </td>+ </tr>+ {% endfor %}+ </tbody>+ </table>+ </div>+ </div>+ </div>+ </div>+{% endblock %}++{% block styles %}+{% endblock %}++{% block scripts %}+{% endblock %}diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.phpindex a8a498b0e2..78a2be3167 100644--- a/routes/breadcrumbs.php+++ b/routes/breadcrumbs.php@@ -248,6 +248,14 @@ Breadcrumbs::register();// ATTACHMENTS+Breadcrumbs::register(+ 'attachments.index',+ function (BreadCrumbsGenerator $breadcrumbs) {+ $breadcrumbs->parent('home');+ $breadcrumbs->push(trans('firefly.attachments'), route('attachments.index'));+ }+);+Breadcrumbs::register('attachments.edit',function (BreadCrumbsGenerator $breadcrumbs, Attachment $attachment) {diff --git a/routes/web.php b/routes/web.phpindex d50b243549..53d0f5054e 100755--- a/routes/web.php+++ b/routes/web.php@@ -140,6 +140,7 @@ Route::group(*/Route::group(['middleware' => 'user-full-auth', 'namespace' => 'FireflyIII\Http\Controllers', 'prefix' => 'attachments', 'as' => 'attachments.'], function () {+ Route::get('', ['uses' => 'AttachmentController@index', 'as' => 'index']);Route::get('edit/{attachment}', ['uses' => 'AttachmentController@edit', 'as' => 'edit']);Route::get('delete/{attachment}', ['uses' => 'AttachmentController@delete', 'as' => 'delete']);Route::get('download/{attachment}', ['uses' => 'AttachmentController@download', 'as' => 'download']);