Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Add custom new forms

Rob Zolkosecb3f2726f9b
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 @@
+<div class="relative p-4 border border-gray-100 bg-offwhite rounded-xl focus-within:bg-white focus-within:shadow focus-within:opacity-100">
+ <label for="account_name" class="block text-sm font-medium opacity-50 focus-within:opacity-100">Type</label>
+ <%= 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" %>
+ </div>
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" %>
</div>
+ <%= render "accounts/#{permitted_accountable_partial(@account.accountable_type)}", f: f %>
+
<div class="relative p-4 border border-gray-100 bg-offwhite rounded-xl focus-within:bg-white focus-within:shadow focus-within:opacity-100">
<label for="account_name" class="block text-sm font-medium opacity-50 focus-within:opacity-100">Balance</label>
<div class="flex">