The personal finance app for everyone (by everyone)
Ruby
Link a transaction's merchant to its page from the row (#4640)
Dov Benyomin Sohacheski796be13ea386
diff --git a/app/views/transactions/_transaction.html.erb b/app/views/transactions/_transaction.html.erbindex 4123be9952..428bf0ef1e 100644--- a/app/views/transactions/_transaction.html.erb+++ b/app/views/transactions/_transaction.html.erb@@ -15,7 +15,7 @@end %><%= turbo_frame_tag dom_id(entry) do %><%= turbo_frame_tag dom_id(transaction) do %>- <div class="group flex lg:grid lg:grid-cols-12 items-center text-primary text-sm font-medium p-3 lg:p-4 <%= "pl-8 lg:pl-12" if in_split_group %>"+ <div class="group group/transaction flex lg:grid lg:grid-cols-12 items-center text-primary text-sm font-medium p-3 lg:p-4 <%= "pl-8 lg:pl-12" if in_split_group %>"data-controller="clickable-row"data-action="click->clickable-row#open">@@ -172,7 +172,14 @@</span><% else %><% if transaction.merchant&.present? %>- <span class="hidden lg:inline truncate"><%= transaction.merchant.name %> • </span>+ <span class="hidden lg:inline truncate">+ <%= transaction.merchant.name %><%= link_to merchant_path(transaction.merchant),+ data: { turbo_frame: "_top" },+ class: "opacity-0 group-hover/transaction:opacity-100 focus-visible:opacity-100 transition-opacity inline-flex align-middle hover:text-primary",+ title: t("transactions.transaction.view_merchant") do %>+ <%= icon "arrow-up-right", size: "xs", color: "current" %>+ <% end %> •+ </span><% end %><span class="text-secondary hidden lg:inline"><%= link_to entry.account.name,diff --git a/config/locales/views/transactions/en.yml b/config/locales/views/transactions/en.ymlindex 366a990c3e..0d1623f3b0 100644--- a/config/locales/views/transactions/en.yml+++ b/config/locales/views/transactions/en.yml@@ -189,6 +189,7 @@ en:transfer_hint: Transfer?transfer_hint_dismiss: Not a transfertransfer_hint_tooltip: A matching transaction in another account looks like the other side of a transfer — click to match them+ view_merchant: View merchantmerge_duplicate:success: Transactions merged successfullyfailure: Could not merge transactionsdiff --git a/test/controllers/transactions_controller_test.rb b/test/controllers/transactions_controller_test.rbindex 35052e60c0..89697b69e5 100644--- a/test/controllers/transactions_controller_test.rb+++ b/test/controllers/transactions_controller_test.rb@@ -106,6 +106,16 @@ class TransactionsControllerTest < ActionDispatch::IntegrationTestassert_select "##{dom_id(outflow.transaction, :transfer_hint)} form[action='#{transaction_transfer_match_path(outflow)}'] input[name=_method][value=delete]"end+ test "index links a transaction's merchant to its page" do+ merchant = merchants(:netflix)+ create_transaction(account: accounts(:depository), name: "Netflix", merchant: merchant, date: Date.current)++ get transactions_url++ assert_response :success+ assert_select "a[href='#{merchant_path(merchant)}'][data-turbo-frame=_top][title=?]", I18n.t("transactions.transaction.view_merchant")+ end+test "the investment activity badge shows translated labels" do@user.update!(locale: "ru")accounts(:investment).entries.create!(