1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Currency Dropdown (#415)

* Initial dropdown setup and styles

* Allow form field to pass through block content and update dropdown posititon

* add currency to accounts params

* Add repositionDropdown function and carry over dropdown controller

* remove block context from form builder in favour of using form tag directly

* Hide currency input and set checks for input and label before updating

* align currency button with balance

* revert form_field_tag changes

* remove margin on currency button, looks cleaner

---------

Signed-off-by: Josh Pigford <josh@joshpigford.com>
Co-authored-by: Josh Pigford <josh@joshpigford.com>
This commit is contained in:
Cristiano Crolla 2024-02-11 19:02:27 +00:00 committed by GitHub
parent b2fdf78101
commit 96debfaeda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 86 additions and 3 deletions

View file

@ -76,10 +76,16 @@
<%= render "accounts/#{permitted_accountable_partial(@account.accountable_type)}", f: f %>
<%= f.number_field :original_balance, step: :any, placeholder: 0.00, in: 0.00..100000000.00, required: 'required', label: true %>
<%= f.collection_select :original_currency, Currency.all, :iso_code, :iso_code, { prompt: "Choose a currency", selected: Current.family.currency }, { required: 'required', label: "Base Currency" } %>
<%= form_field_tag do %>
<%= f.label :original_balance, class: "form-field__label" %>
<%= f.number_field :original_balance, step: :any, placeholder: number_to_currency(0), in: 0.00..100000000.00, required: 'required', class: 'form-field__input max-w-[80%]' %>
<%= currency_dropdown(f: f, options: ['USD', 'EUR', 'JPY', 'GBP', 'AUD', 'CAD', 'CNY', 'BTC', 'ETH']) %>
<% end %>
</div>
<%#= f.collection_select :original_currency, Currency.all, :iso_code, :iso_code, { prompt: "Choose a currency", selected: Current.family.currency }, { required: 'required', label: "Base Currency" } %>
<%= f.submit "Add #{@account.accountable.model_name.human.downcase}" %>
<% end %>
<% end %>