From aceaf5f8917a7f3b435cd73e1f59a96a2216c44e Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 19 Mar 2020 08:56:00 +0100 Subject: [PATCH] Add attachment thing to views #2828 --- resources/views/v1/accounts/create.twig | 3 ++- resources/views/v1/accounts/edit.twig | 10 ++++++++-- resources/views/v1/budgets/create.twig | 3 ++- resources/views/v1/budgets/edit.twig | 3 ++- resources/views/v1/categories/create.twig | 14 ++++++++++++-- resources/views/v1/categories/edit.twig | 14 ++++++++++++-- resources/views/v1/piggy-banks/create.twig | 3 ++- resources/views/v1/piggy-banks/edit.twig | 3 ++- resources/views/v1/tags/create.twig | 3 ++- resources/views/v1/tags/edit.twig | 3 ++- 10 files changed, 46 insertions(+), 13 deletions(-) diff --git a/resources/views/v1/accounts/create.twig b/resources/views/v1/accounts/create.twig index 228f70233c..2d73dc1ac2 100644 --- a/resources/views/v1/accounts/create.twig +++ b/resources/views/v1/accounts/create.twig @@ -9,7 +9,7 @@ var mapboxToken = "{{ config('firefly.mapbox_api_key') }}"; -
+ @@ -58,6 +58,7 @@ {{ ExpandedForm.checkbox('include_net_worth', 1) }} {{ ExpandedForm.textarea('notes',null,{helpText: trans('firefly.field_supports_markdown')}) }} {{ ExpandedForm.location('location', null, {locations: locations}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} diff --git a/resources/views/v1/accounts/edit.twig b/resources/views/v1/accounts/edit.twig index 109e3a0a68..d9c6ea2e5f 100644 --- a/resources/views/v1/accounts/edit.twig +++ b/resources/views/v1/accounts/edit.twig @@ -11,8 +11,12 @@ var mapboxToken = "{{ config('firefly.mapbox_api_key') }}"; - {{ Form.model(account, {'class' : 'form-horizontal','id' : 'update','url' : route('accounts.update',account.id) } ) }} - + {{ Form.model(account, { + 'class': 'form-horizontal', + 'id': 'update', + 'url': route('accounts.update',account.id), + 'enctype': 'multipart/form-data' + } ) }} @@ -70,6 +74,8 @@ {# only correct way to do active checkbox #} {{ ExpandedForm.location('location', null, {locations: locations}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} + diff --git a/resources/views/v1/budgets/create.twig b/resources/views/v1/budgets/create.twig index 7af530501a..4253694a13 100644 --- a/resources/views/v1/budgets/create.twig +++ b/resources/views/v1/budgets/create.twig @@ -6,7 +6,7 @@ {% block content %} - + @@ -32,6 +32,7 @@ {{ CurrencyForm.currencyList('auto_budget_currency_id') }} {{ ExpandedForm.amountNoCurrency('auto_budget_amount') }} {{ ExpandedForm.select('auto_budget_period', autoBudgetPeriods, null) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} diff --git a/resources/views/v1/budgets/edit.twig b/resources/views/v1/budgets/edit.twig index 659cf3b419..7dd3478980 100644 --- a/resources/views/v1/budgets/edit.twig +++ b/resources/views/v1/budgets/edit.twig @@ -5,7 +5,7 @@ {% endblock %} {% block content %} - {{ Form.model(budget, {'class' : 'form-horizontal','id' : 'update','url' : route('budgets.update',budget.id) } ) }} + {{ Form.model(budget, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('budgets.update',budget.id) } ) }}
@@ -32,6 +32,7 @@ {{ CurrencyForm.currencyList('auto_budget_currency_id', autoBudget.transaction_currency_id) }} {{ ExpandedForm.amountNoCurrency('auto_budget_amount', preFilled.auto_budget_amount) }} {{ ExpandedForm.select('auto_budget_period', autoBudgetPeriods, autoBudget.period) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
diff --git a/resources/views/v1/categories/create.twig b/resources/views/v1/categories/create.twig index 770e93106e..c8b6fc8d49 100644 --- a/resources/views/v1/categories/create.twig +++ b/resources/views/v1/categories/create.twig @@ -6,7 +6,7 @@ {% block content %} - +
@@ -19,10 +19,20 @@
+
+ {# panel for optional fields#} +
+
+

{{ 'optionalFields'|_ }}

+
+
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} +
+
+
- {# panel for options #}
diff --git a/resources/views/v1/categories/edit.twig b/resources/views/v1/categories/edit.twig index 2d7f2c5ac6..ff2478a09d 100644 --- a/resources/views/v1/categories/edit.twig +++ b/resources/views/v1/categories/edit.twig @@ -5,7 +5,7 @@ {% endblock %} {% block content %} - {{ Form.model(category, {'class' : 'form-horizontal','id' : 'update','url' : route('categories.update',category.id)}) }} + {{ Form.model(category, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('categories.update',category.id)}) }}
@@ -17,7 +17,17 @@ {{ ExpandedForm.text('name') }}
- +
+
+ {# panel for optional fields#} +
+
+

{{ 'optionalFields'|_ }}

+
+
+ {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }} +
+
diff --git a/resources/views/v1/piggy-banks/create.twig b/resources/views/v1/piggy-banks/create.twig index 8466c12749..b994ba52a6 100644 --- a/resources/views/v1/piggy-banks/create.twig +++ b/resources/views/v1/piggy-banks/create.twig @@ -6,7 +6,7 @@ {% block content %} - +
@@ -32,6 +32,7 @@
{{ ExpandedForm.date('targetdate') }} {{ ExpandedForm.textarea('notes', null, {helpText: trans('firefly.field_supports_markdown')} ) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
diff --git a/resources/views/v1/piggy-banks/edit.twig b/resources/views/v1/piggy-banks/edit.twig index 8dda406b0c..397fea13eb 100644 --- a/resources/views/v1/piggy-banks/edit.twig +++ b/resources/views/v1/piggy-banks/edit.twig @@ -5,7 +5,7 @@ {% endblock %} {% block content %} - {{ Form.model(piggyBank, {'class' : 'form-horizontal','id' : 'update','url' : route('piggy-banks.update',piggyBank.id)}) }} + {{ Form.model(piggyBank, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('piggy-banks.update',piggyBank.id)}) }} @@ -35,6 +35,7 @@ {{ ExpandedForm.date('startdate') }} {{ ExpandedForm.date('targetdate') }} {{ ExpandedForm.textarea('notes', null, {helpText: trans('firefly.field_supports_markdown')}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
diff --git a/resources/views/v1/tags/create.twig b/resources/views/v1/tags/create.twig index 30f5a4ce51..96805de641 100644 --- a/resources/views/v1/tags/create.twig +++ b/resources/views/v1/tags/create.twig @@ -10,7 +10,7 @@ var locations = {{ locations|json_encode|raw }}; var mapboxToken = "{{ config('firefly.mapbox_api_key') }}"; - +
@@ -34,6 +34,7 @@ {{ ExpandedForm.date('date') }} {{ ExpandedForm.textarea('description') }} {{ ExpandedForm.location('location', null, {locations: locations}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}
diff --git a/resources/views/v1/tags/edit.twig b/resources/views/v1/tags/edit.twig index e69ddfc3bd..cc1bb5d50b 100644 --- a/resources/views/v1/tags/edit.twig +++ b/resources/views/v1/tags/edit.twig @@ -11,7 +11,7 @@ var mapboxToken = "{{ config('firefly.mapbox_api_key') }}"; - {{ Form.model(tag, {'class' : 'form-horizontal','id' : 'update','url' : route('tags.update',tag.id)}) }} + {{ Form.model(tag, {'class' : 'form-horizontal','enctype': 'multipart/form-data','id' : 'update','url' : route('tags.update',tag.id)}) }} @@ -37,6 +37,7 @@ {{ ExpandedForm.date('date', tag.date.format('Y-m-d')) }} {{ ExpandedForm.textarea('description', tag.description) }} {{ ExpandedForm.location('location', null, {locations: locations}) }} + {{ ExpandedForm.file('attachments[]', {'multiple': 'multiple','helpText': trans('firefly.upload_max_file_size', {'size': uploadSize|filesize}) }) }}