From f8e9ce0d52404596359456a32cf33a3b08175359 Mon Sep 17 00:00:00 2001
From: James Cole
Date: Fri, 1 May 2015 23:35:35 +0200
Subject: [PATCH] Can edit as well.
---
app/Providers/ConfigServiceProvider.php | 4 +--
resources/twig/accounts/create.twig | 2 +-
resources/twig/accounts/edit.twig | 41 ++++++++++++-------------
resources/twig/form/checkbox.twig | 11 +++++++
4 files changed, 34 insertions(+), 24 deletions(-)
create mode 100644 resources/twig/form/checkbox.twig
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
index 0af1c058c7..a23a061d87 100644
--- a/app/Providers/ConfigServiceProvider.php
+++ b/app/Providers/ConfigServiceProvider.php
@@ -165,12 +165,12 @@ class ConfigServiceProvider extends ServiceProvider
'Config',
'ExpandedForm' => [
'is_safe' => [
- 'date','text','select','balance','optionsList'
+ 'date','text','select','balance','optionsList','checkbox'
]
],
'Form' => [
'is_safe' => [
- 'input','select','checkbox'
+ 'input','select','checkbox','model'
]
],
],
diff --git a/resources/twig/accounts/create.twig b/resources/twig/accounts/create.twig
index 20da44b186..6ed1f2dfaf 100644
--- a/resources/twig/accounts/create.twig
+++ b/resources/twig/accounts/create.twig
@@ -28,7 +28,7 @@
{{ ExpandedForm.balance('openingBalance') }}
{{ ExpandedForm.date('openingBalanceDate', phpdate('Y-m-d')) }}
- {{ ExpandedForm.select('accountRole') }}
+ {{ ExpandedForm.select('accountRole', Config.get('firefly.accountRoles'),null,{'helpText' : 'Any extra options resulting from your choice can be set later.'}) }}
{{ ExpandedForm.balance('virtualBalance') }}
diff --git a/resources/twig/accounts/edit.twig b/resources/twig/accounts/edit.twig
index 0ecfceb939..19968766f8 100644
--- a/resources/twig/accounts/edit.twig
+++ b/resources/twig/accounts/edit.twig
@@ -1,18 +1,18 @@
{% extends "./layout/default.twig" %}
{% block content %}
-{!! Breadcrumbs::renderIfExists(Route::getCurrentRoute()->getName(), $account) !!}
-{!! Form::model($account, ['class' => 'form-horizontal','id' => 'update','url' => route('accounts.update',$account->id)]) !!}
+{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute().getName(), account) }}
+{{ Form.model(account, {'class' : 'form-horizontal','id' : 'update','url' : route('accounts.update',account.id) } ) }}
-
+
- Mandatory fields
+ Mandatory fields
- {!! ExpandedForm::text('name') !!}
+ {{ ExpandedForm.text('name') }}
@@ -23,37 +23,37 @@
Optional fields
- @if($account->accounttype->type == 'Default account' || $account->accounttype->type == 'Asset account')
- {!! ExpandedForm::balance('openingBalance',null, ['currency' => $openingBalance ? $openingBalance->transactionCurrency : null]) !!}
- {!! ExpandedForm::date('openingBalanceDate') !!}
- {!! ExpandedForm::select('accountRole',Config::get('firefly.accountRoles')) !!}
- {!! ExpandedForm::balance('virtualBalance',null) !!}
- {!! Form::hidden('id',$account->id) !!}
- @endif
- {!! ExpandedForm::checkbox('active','1') !!}
+ {% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
+ {{ ExpandedForm.balance('openingBalance',null, {'currency' : openingBalance ? openingBalance.transactionCurrency : null}) }}
+ {{ ExpandedForm.date('openingBalanceDate') }}
+ {{ ExpandedForm.select('accountRole',Config.get('firefly.accountRoles')) }}
+ {{ ExpandedForm.balance('virtualBalance',null) }}
+
+ {% endif %}
+ {{ ExpandedForm.checkbox('active','1') }}
- @if(Session::get('preFilled')['accountRole'] == 'ccAsset')
+ {% if Session.get('preFilled').accountRole == 'ccAsset' %}
Credit card options
- {!! ExpandedForm::select('ccType',Config::get('firefly.ccTypes')) !!}
- {!! ExpandedForm::date('ccMonthlyPaymentDate',null,['helpText' => 'Select any year and any month, it will be ignored anway. Only the day of the month is relevant.']) !!}
+ {{ ExpandedForm.select('ccType',Config.get('firefly.ccTypes')) }}
+ {{ ExpandedForm.date('ccMonthlyPaymentDate',null,{'helpText' : 'Select any year and any month, it will be ignored anway. Only the day of the month is relevant.'}) }}
- @endif
+ {% endif %}
-
+
Options
- {!! ExpandedForm::optionsList('update','account') !!}
+ {{ ExpandedForm.optionsList('update','account') }}
@@ -67,6 +67,5 @@
-
-{!! Form::close() !!}
+
{% endblock %}
diff --git a/resources/twig/form/checkbox.twig b/resources/twig/form/checkbox.twig
new file mode 100644
index 0000000000..21d8e59177
--- /dev/null
+++ b/resources/twig/form/checkbox.twig
@@ -0,0 +1,11 @@
+
+
{{ label }}
+
+
+
+ {{ Form.checkbox(name, value, options.checked, options) }}
+
+
+ {% include 'form/feedback.twig' %}
+
+