The personal finance app for everyone (by everyone)
Ruby
Render remaining literal-colored badges with DS::Pill (#4685)
GFReebff5f6636a
diff --git a/app/views/admin/sso_providers/index.html.erb b/app/views/admin/sso_providers/index.html.erbindex 8ea545eb50..fb40e2aef1 100644--- a/app/views/admin/sso_providers/index.html.erb+++ b/app/views/admin/sso_providers/index.html.erb@@ -26,13 +26,9 @@</div><div class="flex items-center gap-2"><% if provider.enabled? %>- <span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800 theme-dark:bg-green-tint-10 theme-dark:text-green-200">- <%= t(".enabled") %>- </span>+ <%= render DS::Pill.new(label: t(".enabled"), tone: :success, marker: false) %><% else %>- <span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-surface text-secondary">- <%= t(".disabled") %>- </span>+ <%= render DS::Pill.new(label: t(".disabled"), tone: :neutral, marker: false) %><% end %><%= link_to edit_admin_sso_provider_path(provider), class: "p-1 text-secondary hover:text-primary", title: t(".edit") do %><%= icon "pencil", class: "w-4 h-4" %>@@ -101,13 +97,9 @@<p class="text-sm text-secondary"><%= t(".db_backed_providers_description") %></p></div><% if FeatureFlags.db_sso_providers? %>- <span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">- <%= t(".enabled") %>- </span>+ <%= render DS::Pill.new(label: t(".enabled"), tone: :success, marker: false) %><% else %>- <span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-surface text-secondary">- <%= t(".disabled") %>- </span>+ <%= render DS::Pill.new(label: t(".disabled"), tone: :neutral, marker: false) %><% end %></div><p class="text-sm text-secondary">diff --git a/app/views/rules/index.html.erb b/app/views/rules/index.html.erbindex 0593aafca2..09a15d84f6 100644--- a/app/views/rules/index.html.erb+++ b/app/views/rules/index.html.erb@@ -153,9 +153,7 @@<%= run.executed_at.strftime("%b %d, %Y %I:%M %p") %></td><td class="px-4 py-3 text-sm text-primary text-center">- <span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium <%= run.execution_type == "manual" ? "bg-blue-50 text-blue-700 theme-dark:bg-blue-950/30 theme-dark:text-blue-400" : "bg-purple-50 text-purple-700 theme-dark:bg-purple-950/30 theme-dark:text-purple-400" %>">- <%= t("rules.recent_runs.execution_types.#{run.execution_type}") %>- </span>+ <%= render DS::Pill.new(label: t("rules.recent_runs.execution_types.#{run.execution_type}"), tone: run.execution_type == "manual" ? :indigo : :violet, marker: false) %></td><td class="px-4 py-3 text-sm text-center"><div class="flex items-center justify-center gap-2">diff --git a/app/views/transactions/categorizes/_group_title.html.erb b/app/views/transactions/categorizes/_group_title.html.erbindex a23ab19618..ef73d5801d 100644--- a/app/views/transactions/categorizes/_group_title.html.erb+++ b/app/views/transactions/categorizes/_group_title.html.erb@@ -2,9 +2,9 @@<div class="flex items-center gap-2"><h2 class="text-lg font-semibold text-primary"><%= display_name %></h2><% if transaction_type == "income" %>- <span class="text-xs font-medium px-1.5 py-0.5 rounded-full bg-green-100 text-green-700 theme-dark:bg-green-tint-10 theme-dark:text-green-200"><%= t("transactions.categorizes.show.type_income") %></span>+ <%= render DS::Pill.new(label: t("transactions.categorizes.show.type_income"), tone: :success, marker: false) %><% elsif transaction_type == "expense" %>- <span class="text-xs font-medium px-1.5 py-0.5 rounded-full bg-surface text-secondary border border-primary"><%= t("transactions.categorizes.show.type_expense") %></span>+ <%= render DS::Pill.new(label: t("transactions.categorizes.show.type_expense"), tone: :neutral, marker: false) %><% end %></div><% end %>diff --git a/test/controllers/admin/sso_providers_controller_test.rb b/test/controllers/admin/sso_providers_controller_test.rbindex d6caf5e8f9..d0980b518a 100644--- a/test/controllers/admin/sso_providers_controller_test.rb+++ b/test/controllers/admin/sso_providers_controller_test.rb@@ -16,6 +16,25 @@ class Admin::SsoProvidersControllerTest < ActionDispatch::IntegrationTest)end+ test "index renders provider status badges with design-system tones" do+ SsoProvider.create!(+ strategy: "openid_connect",+ name: "oidc_disabled_test",+ label: "Disabled OIDC",+ enabled: false,+ client_id: "client-id",+ client_secret: "secret",+ issuer: "https://issuer.example.com"+ )++ get admin_sso_providers_path++ assert_response :success+ assert_select "span.rounded-full[style*='--color-green-50']", text: I18n.t("admin.sso_providers.index.enabled")+ assert_select "span.rounded-full[style*='--color-gray-100']", text: I18n.t("admin.sso_providers.index.disabled")+ assert_no_match(/\bbg-green-100\b/, response.body)+ end+test "edit form posts nested settings and optional client secret" doget edit_admin_sso_provider_path(@provider)diff --git a/test/controllers/rules_controller_test.rb b/test/controllers/rules_controller_test.rbindex 2a0ccdb7eb..260f856d6e 100644--- a/test/controllers/rules_controller_test.rb+++ b/test/controllers/rules_controller_test.rb@@ -461,6 +461,20 @@ class RulesControllerTest < ActionDispatch::IntegrationTestassert_select "td", text: "10 / 7 / 4 / 3"end+ test "index renders recent run execution types with design-system tones" do+ RuleRun.create!(rule: rules(:one), execution_type: "manual", status: "success", transactions_queued: 1,+ transactions_processed: 1, transactions_modified: 1, pending_jobs_count: 0, executed_at: Time.current)+ RuleRun.create!(rule: rules(:one), execution_type: "scheduled", status: "success", transactions_queued: 1,+ transactions_processed: 1, transactions_modified: 1, pending_jobs_count: 0, executed_at: 1.minute.ago)++ get rules_url++ assert_response :success+ assert_select "span.rounded-full[style*='--color-indigo-50']", text: I18n.t("rules.recent_runs.execution_types.manual")+ assert_select "span.rounded-full[style*='--color-violet-50']", text: I18n.t("rules.recent_runs.execution_types.scheduled")+ assert_no_match(/\bbg-(blue|purple)-50\b/, response.body)+ end+# The confirmation screen used to hardcode :openai, so it quoted a provider# that would not run — an Anthropic install saw the OpenAI model, and a family# on Jev saw whichever LLM model happened to be configured.diff --git a/test/controllers/transactions/categorizes_controller_test.rb b/test/controllers/transactions/categorizes_controller_test.rbindex 1f7069c14a..025d661a42 100644--- a/test/controllers/transactions/categorizes_controller_test.rb+++ b/test/controllers/transactions/categorizes_controller_test.rb@@ -63,6 +63,16 @@ class Transactions::CategorizesControllerTest < ActionDispatch::IntegrationTestassert_includes child_pill.text, categories(:subcategory).display_name_with_parentend+ test "show renders the income type badge with a design-system tone" do+ create_transaction(account: @account, name: "Payroll", amount: -500)++ get transactions_categorize_url++ assert_response :success+ assert_select "span.rounded-full[style*='--color-green-50']", text: I18n.t("transactions.categorizes.show.type_income")+ assert_no_match(/\bbg-green-100\b/, response.body)+ end+test "show renders full dates so multi-year lists are unambiguous" docreate_transaction(account: @account, name: "Starbucks", date: Date.new(2024, 7, 8))