From 9a02b949129209a31bb44ec637139a4c7df96e34 Mon Sep 17 00:00:00 2001 From: NamHT4Devlop Date: Thu, 11 Jun 2026 00:10:35 +0700 Subject: [PATCH 1/2] Move Date column to first position in Donations table (#5591) The Date column was positioned after Source, which made the table harder to scan. Moving it to be the first column. Also fixed malformed td nesting in _donation_row partial (the date and comment cells were never closed, nesting subsequent cells). --- app/views/donations/_donation_row.html.erb | 22 ++++++++++------------ app/views/donations/index.html.erb | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/views/donations/_donation_row.html.erb b/app/views/donations/_donation_row.html.erb index b9fcf04868..935b63089e 100644 --- a/app/views/donations/_donation_row.html.erb +++ b/app/views/donations/_donation_row.html.erb @@ -1,16 +1,14 @@ + <%= donation_row.issued_at.strftime("%F") %> <%= donation_row.source %> - <%= donation_row.issued_at.strftime("%F") %> - <%= donation_row.details %> - <%= donation_row.storage_location.name %> - <%= donation_row.line_items.total %> - <%= dollar_value(donation_row.money_raised.to_i) %> - <%= dollar_value(donation_row.value_per_itemizable) %> - <%= truncate donation_row.comment, length: 140, separator: /\w+/ %> - - <%= view_button_to donation_path(donation_row) %> - <%= print_button_to print_donation_path(donation_row, format: :pdf) %> - - + <%= donation_row.details %> + <%= donation_row.storage_location.name %> + <%= donation_row.line_items.total %> + <%= dollar_value(donation_row.money_raised.to_i) %> + <%= dollar_value(donation_row.value_per_itemizable) %> + <%= truncate donation_row.comment, length: 140, separator: /\w+/ %> + + <%= view_button_to donation_path(donation_row) %> + <%= print_button_to print_donation_path(donation_row, format: :pdf) %> diff --git a/app/views/donations/index.html.erb b/app/views/donations/index.html.erb index c3347ebe4c..f128e67b9d 100644 --- a/app/views/donations/index.html.erb +++ b/app/views/donations/index.html.erb @@ -137,8 +137,8 @@ - + From f2c92488a8398b50961597b3bf91be4ab7b5e8e2 Mon Sep 17 00:00:00 2001 From: NamHT4Devlop Date: Thu, 11 Jun 2026 00:27:23 +0700 Subject: [PATCH 2/2] Make misc donation comment spec meaningful The assertion that the full comment is absent from the page only passed because the Comments ' could never appear. With valid markup, a comment shorter than the 140-character truncation limit is shown in full (as designed). Use a 200-character comment so truncation actually occurs and the assertion tests real behavior. --- spec/requests/donations_requests_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/requests/donations_requests_spec.rb b/spec/requests/donations_requests_spec.rb index fe12b80fcf..29e42717a9 100644 --- a/spec/requests/donations_requests_spec.rb +++ b/spec/requests/donations_requests_spec.rb @@ -69,7 +69,9 @@ end context "when given a misc donation" do - let(:full_comment) { Faker::Lorem.paragraph } + # Comment must be longer than the 140 characters the Comments column + # truncates at, so that asserting the full comment is absent is meaningful. + let(:full_comment) { Faker::Lorem.paragraph_by_chars(number: 200) } let(:donation) { create(:donation, source: "Misc. Donation", comment: full_comment) } it "should display Misc Donation and a truncated comment" do
Source DateSource Details Storage Location Quantity of Items was previously unclosed, so the string 'comment