mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Account:: namespace simplifications and cleanup (#2110)
* Flatten Holding model * Flatten balance model * Entries domain renames * Fix valuations reference * Fix trades stream * Fix brakeman warnings * Fix tests * Replace existing entryable type references in DB
This commit is contained in:
parent
f181ba941f
commit
e657c40d19
172 changed files with 1297 additions and 1258 deletions
20
app/controllers/concerns/stream_extensions.rb
Normal file
20
app/controllers/concerns/stream_extensions.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
module StreamExtensions
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def stream_redirect_to(path, notice: nil, alert: nil)
|
||||
custom_stream_redirect(path, notice: notice, alert: alert)
|
||||
end
|
||||
|
||||
def stream_redirect_back_or_to(path, notice: nil, alert: nil)
|
||||
custom_stream_redirect(path, redirect_back: true, notice: notice, alert: alert)
|
||||
end
|
||||
|
||||
private
|
||||
def custom_stream_redirect(path, redirect_back: false, notice: nil, alert: nil)
|
||||
flash[:notice] = notice if notice.present?
|
||||
flash[:alert] = alert if alert.present?
|
||||
|
||||
redirect_target_url = redirect_back ? request.referer : path
|
||||
render turbo_stream: turbo_stream.action(:redirect, redirect_target_url)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue