mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-21 14:19:39 +02:00
Refresh account on update (#476)
* Refresh account on update
* 🐛 Replace turbo frame on create valuation
This avoids the frame reloading it's src when refreshing.
* Change Action Cable adapater to Postgres
This commit is contained in:
parent
7e324f1b53
commit
e767aca37f
5 changed files with 5 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
class Account < ApplicationRecord
|
class Account < ApplicationRecord
|
||||||
|
broadcasts_refreshes
|
||||||
belongs_to :family
|
belongs_to :family
|
||||||
has_many :balances, class_name: "AccountBalance"
|
has_many :balances, class_name: "AccountBalance"
|
||||||
has_many :valuations
|
has_many :valuations
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<% if is_syncing %>
|
<% if is_syncing %>
|
||||||
<div class="my-4 px-8 py-4 rounded-lg bg-yellow-500/10 flex items-center justify-between">
|
<div class="my-4 px-8 py-4 rounded-lg bg-yellow-500/10 flex items-center justify-between">
|
||||||
<p class="text-gray-900 text-sm">
|
<p class="text-gray-900 text-sm">
|
||||||
Syncing your account balances. Please reload the page to see updated data.
|
Syncing your account balances.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<%= turbo_stream_from @account %>
|
||||||
<% balance_trend_styles = @balance_series.nil? ? {} : trend_styles(@balance_series[:trend]) %>
|
<% balance_trend_styles = @balance_series.nil? ? {} : trend_styles(@balance_series[:trend]) %>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<%= turbo_stream.update Valuation.new, "" %>
|
<%= turbo_stream.replace Valuation.new, body: turbo_frame_tag(dom_id(Valuation.new)) %>
|
||||||
<%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation created" } %>
|
<%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation created" } %>
|
||||||
<%= turbo_stream.replace "valuations_list", partial: "accounts/account_valuation_list", locals: { valuation_series: @account.valuation_series } %>
|
<%= turbo_stream.replace "valuations_list", partial: "accounts/account_valuation_list", locals: { valuation_series: @account.valuation_series } %>
|
||||||
<%= turbo_stream.replace "sync_message", partial: "accounts/sync_message", locals: { is_syncing: true } %>
|
<%= turbo_stream.replace "sync_message", partial: "accounts/sync_message", locals: { is_syncing: true } %>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
development:
|
development:
|
||||||
adapter: redis
|
adapter: postgresql
|
||||||
url: redis://localhost:6379/1
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
adapter: test
|
adapter: test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue