diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 8ff0106b3d..56a8ccfe79 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -3,9 +3,11 @@ namespace FireflyIII\Http\Controllers; +use Crypt; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Models\Attachment; -use Crypt; +use View; + /** * Class AttachmentController * @@ -14,6 +16,30 @@ use Crypt; class AttachmentController extends Controller { + /** + * @codeCoverageIgnore + */ + public function __construct() + { + parent::__construct(); + View::share('mainTitleIcon', 'fa-paperclip'); + View::share('title', trans('firefly.attachments')); + } + + + /** + * @param Attachment $attachment + * + * @return \Illuminate\View\View + */ + public function edit(Attachment $attachment) + { + $subTitleIcon = 'fa-pencil'; + $subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]); + + return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle')); + } + /** * @param Attachment $attachment */ diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index dd68cfd198..59e3db0fb5 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -20,6 +20,25 @@ use Session; class ExpandedForm { + /** + * @param $name + * @param null $value + * @param array $options + * + * @return string + */ + public function staticText($name, $value, array $options = []) + { + $label = $this->label($name, $options); + $options = $this->expandOptionArray($name, $label, $options); + $classes = $this->getHolderClasses($name); + $value = $this->fillFieldValue($name, $value); + $html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render(); + + return $html; + + } + /** * @param $name * @param null $value diff --git a/config/twigbridge.php b/config/twigbridge.php index dd60091875..ee32836a9e 100644 --- a/config/twigbridge.php +++ b/config/twigbridge.php @@ -145,7 +145,7 @@ return [ 'ExpandedForm' => [ 'is_safe' => [ 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location', - 'multiRadio','file','multiCheckbox' + 'multiRadio','file','multiCheckbox','staticText' ] ], 'Form' => [ diff --git a/resources/lang/en/firefly.php b/resources/lang/en/firefly.php index 35b9f7599d..bfd130b1ab 100644 --- a/resources/lang/en/firefly.php +++ b/resources/lang/en/firefly.php @@ -18,8 +18,12 @@ return [ 'showEverything' => 'Show everything', 'never' => 'Never', 'search_results_for' => 'Search results for ":query"', + + // attachments 'nr_of_attachments' => 'One attachment|:count attachments', 'attachments' => 'Attachments', + 'edit_attachment' => 'Edit attachment ":name"', + 'update_attachment' => 'Update attachment', // tour: 'prev' => 'Prev', diff --git a/resources/lang/en/form.php b/resources/lang/en/form.php index 4a962baa67..1822182400 100644 --- a/resources/lang/en/form.php +++ b/resources/lang/en/form.php @@ -61,6 +61,11 @@ return [ 'add_new_transfer' => 'Add a new transfer', 'noPiggybank' => '(no piggy bank)', 'noBudget' => '(no budget)', + 'title' => 'Title', + 'notes' => 'Notes', + 'filename' => 'File name', + 'mime' => 'Mime type', + 'size' => 'Size', 'delete_account' => 'Delete account ":name"', 'delete_bill' => 'Delete bill ":name"', diff --git a/resources/twig/attachments/edit.twig b/resources/twig/attachments/edit.twig new file mode 100644 index 0000000000..9aaa0a84d1 --- /dev/null +++ b/resources/twig/attachments/edit.twig @@ -0,0 +1,60 @@ +{% extends "./layout/default.twig" %} + +{% block breadcrumbs %} + {{ Breadcrumbs.renderIfExists(Route.getCurrentRoute().getName(), attachment) }} +{% endblock %} + +{% block content %} +
+{% endblock %} diff --git a/resources/twig/form/static.twig b/resources/twig/form/static.twig new file mode 100644 index 0000000000..e70ba496ba --- /dev/null +++ b/resources/twig/form/static.twig @@ -0,0 +1,7 @@ +{{ value }}
+