From ecb3f2726f9be07365253ec7c2c2ce8f3dd39128 Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Fri, 2 Feb 2024 23:41:58 +0000 Subject: [PATCH] Add custom new forms --- app/helpers/application_helper.rb | 4 ++++ app/views/accounts/account/_credit.html.erb | 0 app/views/accounts/account/_depository.html.erb | 4 ++++ app/views/accounts/account/_investment.html.erb | 0 app/views/accounts/account/_loan.html.erb | 0 app/views/accounts/account/_other_asset.html.erb | 0 app/views/accounts/account/_other_liability.html.erb | 0 app/views/accounts/account/_property.html.erb | 0 app/views/accounts/account/_vehicle.html.erb | 0 app/views/accounts/new.html.erb | 2 ++ 10 files changed, 10 insertions(+) create mode 100644 app/views/accounts/account/_credit.html.erb create mode 100644 app/views/accounts/account/_depository.html.erb create mode 100644 app/views/accounts/account/_investment.html.erb create mode 100644 app/views/accounts/account/_loan.html.erb create mode 100644 app/views/accounts/account/_other_asset.html.erb create mode 100644 app/views/accounts/account/_other_liability.html.erb create mode 100644 app/views/accounts/account/_property.html.erb create mode 100644 app/views/accounts/account/_vehicle.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c7719bd9..bd65adc7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,4 +6,8 @@ module ApplicationHelper def header_title(page_title) content_for(:header_title) { page_title } end + + def permitted_accountable_partial(name) + name.underscore + end end diff --git a/app/views/accounts/account/_credit.html.erb b/app/views/accounts/account/_credit.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/account/_depository.html.erb b/app/views/accounts/account/_depository.html.erb new file mode 100644 index 00000000..11933f8d --- /dev/null +++ b/app/views/accounts/account/_depository.html.erb @@ -0,0 +1,4 @@ +
+ + <%= f.select :subtype, options_for_select([["Checking", "checking"], ["Savings", "savings"]], selected: ""), {}, class: "block w-full p-0 mt-1 bg-transparent border-none focus:outline-none focus:ring-0" %> +
diff --git a/app/views/accounts/account/_investment.html.erb b/app/views/accounts/account/_investment.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/account/_loan.html.erb b/app/views/accounts/account/_loan.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/account/_other_asset.html.erb b/app/views/accounts/account/_other_asset.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/account/_other_liability.html.erb b/app/views/accounts/account/_other_liability.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/account/_property.html.erb b/app/views/accounts/account/_property.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/account/_vehicle.html.erb b/app/views/accounts/account/_vehicle.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/app/views/accounts/new.html.erb b/app/views/accounts/new.html.erb index dc12162a..a222244b 100644 --- a/app/views/accounts/new.html.erb +++ b/app/views/accounts/new.html.erb @@ -21,6 +21,8 @@ <%= f.text_field :name, placeholder: "Account name", required: 'required', class: "p-0 mt-1 bg-transparent border-none opacity-50 focus:outline-none focus:ring-0 focus-within:opacity-100" %> + <%= render "accounts/#{permitted_accountable_partial(@account.accountable_type)}", f: f %> +