mirror of
https://github.com/we-promise/sure.git
synced 2026-04-21 13:04:18 +00:00
Fix selected account and Transaction/Transfer Tabs changes (#1220)
* Fix Dialog selected attribute had no effect * Fix New Transaction/Transfer Dialog * Update transfers_controller.rb --------- Co-authored-by: sokiee <sokysrm@gmail.com>
This commit is contained in:
committed by
Juan José Mata
parent
053d1c0721
commit
334ffc0df4
@@ -35,6 +35,7 @@ class TransfersController < ApplicationController
|
||||
format.turbo_stream { stream_redirect_back_or_to transactions_path, notice: success_message }
|
||||
end
|
||||
else
|
||||
@from_account_id = transfer_params[:from_account_id]
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,12 @@ class StyledFormBuilder < ActionView::Helpers::FormBuilder
|
||||
end
|
||||
|
||||
def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
|
||||
selected_value = @object.public_send(method) if @object.respond_to?(method)
|
||||
selected_value =
|
||||
if options.key?(:selected)
|
||||
options[:selected]
|
||||
elsif @object.respond_to?(method)
|
||||
@object.public_send(method)
|
||||
end
|
||||
placeholder = options[:prompt] || options[:include_blank] || options[:placeholder] || I18n.t("helpers.select.default_label")
|
||||
|
||||
@template.render(
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to new_transfer_path,
|
||||
<%= link_to new_transfer_path(from_account_id: account_id),
|
||||
data: { turbo_frame: :modal },
|
||||
class: "flex-1 min-w-0 flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm #{active_tab == 'transfer' ? 'bg-container text-primary shadow-sm' : 'hover:bg-container text-subdued hover:text-primary hover:shadow-sm'}" do %>
|
||||
<%= icon "arrow-right-left" %>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<% if show_type_tabs %>
|
||||
<section>
|
||||
<%= render "shared/transaction_type_tabs", active_tab: "transfer" %>
|
||||
<%= render "shared/transaction_type_tabs", active_tab: "transfer", account_id: @from_account_id %>
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user