From 807098676300baf19a9c7180699ee8efecf66a1d Mon Sep 17 00:00:00 2001 From: Alex Hatzenbuhler Date: Wed, 21 May 2025 09:28:56 -0500 Subject: [PATCH] Standardize corners, backgrounds, and borders (#2271) * Create shared ruler view * Use collection rendering/spacer templates for rules, and new shared_ruler * Use shared ruler for all the places a ruler is used * Use shared ruler for imports and balance sheet * Fix brakeman by using a static partial with a defined collection * Standardize & improve a bunch of corners, fix some backgrounds, fix merchants for dark mode * Update balance sheet * misc cleanup * Fix import table * Remove middot --- app/views/accounts/index/_account_groups.erb | 2 +- app/views/accounts/show/_activity.html.erb | 14 ++--- .../categories/_category_list_group.html.erb | 4 +- app/views/categories/index.html.erb | 2 +- app/views/entries/_entry_group.html.erb | 2 +- .../_family_merchant.html.erb | 2 +- app/views/family_merchants/index.html.erb | 6 +- app/views/holdings/index.html.erb | 4 +- app/views/imports/_table.html.erb | 62 +++++++++---------- .../pages/dashboard/_balance_sheet.html.erb | 8 +-- app/views/rules/index.html.erb | 4 +- app/views/settings/profiles/show.html.erb | 2 +- app/views/tags/index.html.erb | 6 +- 13 files changed, 57 insertions(+), 61 deletions(-) diff --git a/app/views/accounts/index/_account_groups.erb b/app/views/accounts/index/_account_groups.erb index 51ba4d8b..6c1ba1ed 100644 --- a/app/views/accounts/index/_account_groups.erb +++ b/app/views/accounts/index/_account_groups.erb @@ -11,7 +11,7 @@

<%= totals_by_currency(collection: accounts, money_method: :balance_money) %>

<% end %> -
+
<% accounts.each do |account| %> <%= render account %> <% end %> diff --git a/app/views/accounts/show/_activity.html.erb b/app/views/accounts/show/_activity.html.erb index 704c6789..ab65dd4c 100644 --- a/app/views/accounts/show/_activity.html.erb +++ b/app/views/accounts/show/_activity.html.erb @@ -75,16 +75,14 @@
-
-
- <% calculator = Balance::TrendCalculator.new(@account.balances) %> +
+ <% calculator = Balance::TrendCalculator.new(@account.balances) %> - <%= entries_by_date(@entries) do |entries| %> - <% entries.each_with_index do |entry, index| %> - <%= render entry, balance_trend: index == 0 ? calculator.trend_for(entry.date) : nil, view_ctx: "account" %> - <% end %> + <%= entries_by_date(@entries) do |entries| %> + <% entries.each_with_index do |entry, index| %> + <%= render entry, balance_trend: index == 0 ? calculator.trend_for(entry.date) : nil, view_ctx: "account" %> <% end %> -
+ <% end %>
diff --git a/app/views/categories/_category_list_group.html.erb b/app/views/categories/_category_list_group.html.erb index e7337e45..17482848 100644 --- a/app/views/categories/_category_list_group.html.erb +++ b/app/views/categories/_category_list_group.html.erb @@ -7,8 +7,8 @@

<%= categories.count %>

-
-
+
+
<% Category::Group.for(categories).each_with_index do |group, idx| %> <%= render group.category %> diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb index 5f630e74..e15c0976 100644 --- a/app/views/categories/index.html.erb +++ b/app/views/categories/index.html.erb @@ -22,7 +22,7 @@
-
+
<% if @categories.any? %>
<% if @categories.incomes.any? %> diff --git a/app/views/entries/_entry_group.html.erb b/app/views/entries/_entry_group.html.erb index 36aeb27a..2ee8954c 100644 --- a/app/views/entries/_entry_group.html.erb +++ b/app/views/entries/_entry_group.html.erb @@ -21,7 +21,7 @@
<% end %>
-
+
<%= content %>
diff --git a/app/views/family_merchants/_family_merchant.html.erb b/app/views/family_merchants/_family_merchant.html.erb index f47d64c9..7614699c 100644 --- a/app/views/family_merchants/_family_merchant.html.erb +++ b/app/views/family_merchants/_family_merchant.html.erb @@ -1,6 +1,6 @@ <%# locals: (family_merchant:) %> -
+
<% if family_merchant.logo_url %>
diff --git a/app/views/family_merchants/index.html.erb b/app/views/family_merchants/index.html.erb index e54fc02c..7438aa2b 100644 --- a/app/views/family_merchants/index.html.erb +++ b/app/views/family_merchants/index.html.erb @@ -9,7 +9,7 @@ ) %> -
+
<% if @merchants.any? %>
@@ -18,8 +18,8 @@

<%= @merchants.count %>

-
-
+
+
<%= render partial: "family_merchants/family_merchant", collection: @merchants, spacer_template: "shared/ruler" %>
diff --git a/app/views/holdings/index.html.erb b/app/views/holdings/index.html.erb index fe098f8b..d200e54f 100644 --- a/app/views/holdings/index.html.erb +++ b/app/views/holdings/index.html.erb @@ -13,7 +13,7 @@ <% end %>
-
+
<%= tag.p t(".name"), class: "col-span-4" %> <%= tag.p t(".weight"), class: "col-span-2 justify-self-end" %> @@ -22,7 +22,7 @@ <%= tag.p t(".return"), class: "col-span-2 justify-self-end" %>
-
+
<%= render "holdings/cash", account: @account %> <%= render "shared/ruler" %> diff --git a/app/views/imports/_table.html.erb b/app/views/imports/_table.html.erb index 4b7c32f5..5cc3a49c 100644 --- a/app/views/imports/_table.html.erb +++ b/app/views/imports/_table.html.erb @@ -1,5 +1,5 @@ <%# locals: (headers: [], rows: [], caption: nil) %> -
+
<% if caption %>
@@ -8,40 +8,38 @@

<%= caption %>

<% end %> -
-
- - +
+
+ + + <% headers.each_with_index do |header, index| %> + + <% end %> + + + + <% rows.each_with_index do |row, row_index| %> - <% headers.each_with_index do |header, index| %> - <% end %> - - - <% rows.each_with_index do |row, row_index| %> - - <% row.each_with_index do |(header, value), col_index| %> - - <% end %> - - <% end %> - -
+ <%= index == headers.length - 1 ? "rounded-tr-lg" : "" %> + <%= index < headers.length - 1 ? "border-r border-r-alpha-black-200" : "" %> + "> + <%= header %> +
- <%= index == headers.length - 1 ? "rounded-tr-md" : "" %> - <%= index < headers.length - 1 ? "border-r border-r-alpha-black-200" : "" %> + <% row.each_with_index do |(header, value), col_index| %> + + <%= !caption && row_index == rows.length - 1 && col_index == 0 ? "rounded-bl-md" : "" %> + <%= !caption && row_index == rows.length - 1 && col_index == row.length - 1 ? "rounded-br-md" : "" %> "> - <%= header %> - + <%= value %> +
- <%= !caption && row_index == rows.length - 1 && col_index == 0 ? "rounded-bl-md" : "" %> - <%= !caption && row_index == rows.length - 1 && col_index == row.length - 1 ? "rounded-br-md" : "" %> - "> - <%= value %> -
-
+ <% end %> + +
diff --git a/app/views/pages/dashboard/_balance_sheet.html.erb b/app/views/pages/dashboard/_balance_sheet.html.erb index d79c566d..a73e6a03 100644 --- a/app/views/pages/dashboard/_balance_sheet.html.erb +++ b/app/views/pages/dashboard/_balance_sheet.html.erb @@ -58,10 +58,10 @@
-
+
<% classification_group.account_groups.each do |account_group| %> -
- +
+
<%= icon("chevron-right", class: "group-open:rotate-90") %> @@ -93,7 +93,7 @@
<% account_group.accounts.each_with_index do |account, idx| %> -
+
<%= render "accounts/logo", account: account, size: "sm", color: account_group.color %> diff --git a/app/views/rules/index.html.erb b/app/views/rules/index.html.erb index 59961714..dc6e97aa 100644 --- a/app/views/rules/index.html.erb +++ b/app/views/rules/index.html.erb @@ -29,7 +29,7 @@

<% end %> -
+
<% if @rules.any? %>
@@ -58,7 +58,7 @@
-
+
<%= render partial: "rule", collection: @rules, spacer_template: "shared/ruler" %>
diff --git a/app/views/settings/profiles/show.html.erb b/app/views/settings/profiles/show.html.erb index fa97c57e..0819252b 100644 --- a/app/views/settings/profiles/show.html.erb +++ b/app/views/settings/profiles/show.html.erb @@ -41,7 +41,7 @@

<%= Current.family.name %> · <%= Current.family.users.size %>

<% @users.each do |user| %> -
+
<%= render "settings/user_avatar", avatar_url: user.profile_image&.variant(:small)&.url, initials: user.initials %>
diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb index cc4a8459..39b21b1e 100644 --- a/app/views/tags/index.html.erb +++ b/app/views/tags/index.html.erb @@ -24,7 +24,7 @@ -
+
<% if @tags.any? %>
@@ -33,8 +33,8 @@

<%= @tags.count %>

-
-
+
+
<%= render partial: @tags, spacer_template: "shared/ruler" %>