mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 22:45:20 +02:00
Add Live Data to Account Page (#464)
* Add trends, time series, seed data * Remove test data * Replace old view values with helpers * Fix tooltip bugs in D3 chart * Fix tests * Fix smoke test * Add CRUD actions for valuations * Scaffold out inline editing with Turbo
This commit is contained in:
parent
298b50a909
commit
b5b2d335fd
28 changed files with 512 additions and 167 deletions
15
app/views/valuations/_form_row.html.erb
Normal file
15
app/views/valuations/_form_row.html.erb
Normal file
|
@ -0,0 +1,15 @@
|
|||
<%#
|
||||
Locals:
|
||||
- f: form object for valuation
|
||||
- form_icon: string representing the icon to be displayed
|
||||
- submit_button_text: string representing the text on the submit button
|
||||
%>
|
||||
<div class="p-4 flex items-center justify-between w-full">
|
||||
<div class="shrink-0 w-8 h-8 rounded-full p-1.5 flex items-center justify-center bg-gray-500/5">
|
||||
<%= lucide_icon(form_icon, class: "w-4 h-4 text-gray-500") %>
|
||||
</div>
|
||||
<%= f.date_field :date, class: "border border-alpha-black-200 bg-white rounded-lg shadow-xs min-w-[200px] px-3 py-1.5" %>
|
||||
<%= f.number_field :value, step: :any, placeholder: number_to_currency(0), in: 0.00..100000000.00, required: 'required', class: "bg-white border border-alpha-black-200 rounded-lg shadow-xs px-3 py-1.5" %>
|
||||
<%= link_to "Cancel", account_path(@valuation.account), class: "text-sm text-gray-900 hover:text-gray-800 font-medium px-3 py-1.5" %>
|
||||
<%= f.submit submit_button_text, class: "bg-gray-50 rounded-lg font-medium px-3 py-1.5 cursor-pointer hover:bg-gray-100 text-sm" %>
|
||||
</div>
|
4
app/views/valuations/create.html.erb
Normal file
4
app/views/valuations/create.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div>
|
||||
<h1 class="font-bold text-4xl">Valuations#create</h1>
|
||||
<p>Find me in app/views/valuations/create.html.erb</p>
|
||||
</div>
|
3
app/views/valuations/create.turbo_stream.erb
Normal file
3
app/views/valuations/create.turbo_stream.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%# TODO: We need a way to determine the order the new valuation needs to be in the array, calculate the trend, and append it to the right spot %>
|
||||
<%= turbo_stream.update Valuation.new, "" %>
|
||||
<%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation created" } %>
|
4
app/views/valuations/destroy.html.erb
Normal file
4
app/views/valuations/destroy.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div>
|
||||
<h1 class="font-bold text-4xl">Valuations#destroy</h1>
|
||||
<p>Find me in app/views/valuations/destroy.html.erb</p>
|
||||
</div>
|
2
app/views/valuations/destroy.turbo_stream.erb
Normal file
2
app/views/valuations/destroy.turbo_stream.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<%= turbo_stream.remove @valuation %>
|
||||
<%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation deleted" } %>
|
8
app/views/valuations/edit.html.erb
Normal file
8
app/views/valuations/edit.html.erb
Normal file
|
@ -0,0 +1,8 @@
|
|||
<div>
|
||||
<h1 class="font-bold text-4xl">Edit Valuation: <%= @valuation.type %></h1>
|
||||
<%= turbo_frame_tag dom_id(@valuation) do %>
|
||||
<%= form_with model: @valuation, url: valuation_path(@valuation), scope: :valuation do |f| %>
|
||||
<%= render 'form_row', f: f, form_icon: "pencil-line", submit_button_text: "Update" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
8
app/views/valuations/new.html.erb
Normal file
8
app/views/valuations/new.html.erb
Normal file
|
@ -0,0 +1,8 @@
|
|||
<div>
|
||||
<h1 class="font-bold text-4xl">Add Valuation: <%= @account.name %></h1>
|
||||
<%= turbo_frame_tag dom_id(Valuation.new) do %>
|
||||
<%= form_with model: [@account, @valuation], url: account_valuations_path(@account), scope: :valuation do |f| %>
|
||||
<%= render 'form_row', f: f, form_icon: "plus", submit_button_text: "Add" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
4
app/views/valuations/show.html.erb
Normal file
4
app/views/valuations/show.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div>
|
||||
<h1 class="font-bold text-4xl">Valuation: <%= @valuation.type %></h1>
|
||||
<p>Find me in app/views/valuations/show.html.erb</p>
|
||||
</div>
|
4
app/views/valuations/update.html.erb
Normal file
4
app/views/valuations/update.html.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div>
|
||||
<h1 class="font-bold text-4xl">Valuations#update</h1>
|
||||
<p>Find me in app/views/valuations/update.html.erb</p>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue