From 7e181982ff990e2279bc539a9850efb78bb44a10 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 24 Sep 2026 16:09:38 +1200 Subject: [PATCH] Upgrade Font Awesome to 6.7.2 (#4846) * Restore the Ruby 4.0.6 upgrade PR #4831 committed a stale Gemfile.lock over the newer one, taking .ruby-version back to 3.2.3 and rolling back active_median, dalli, parallel, rbs and selenium-webdriver. Dockerfile and .devcontainer/Dockerfile still build on Ruby 4, so the Gemfile's version check fails against the image. Restores both files to what they were before that merge. Co-Authored-By: Claude Opus 5 * Upgrade Font Awesome from 5.15.1 to 6.7.2 Font names have moved on twice since this was pinned: the codebase still carried Font Awesome 4 names that render as an empty box, and FA6 icons such as fa-ellipsis-vertical were unavailable. The 6.x gem no longer ships _font-awesome-sprockets.scss, but its @font-face rules still call fa-font-path(), so application.scss defines that against Sprockets' font-path helper. Its fonts live under assets/fonts/font-awesome, which is already in the precompile list. Icon names: - The bare "fa" prefix is not a style in 6. Every "fa fa-" becomes "fas fa-" (38 call sites, all solid; the one brands icon already used fab). - fa-sun-o was a Font Awesome 4 name and had been rendering as a box; now fa-sun. - fa-pencil was likewise broken under 5, where it was fa-pencil-alt. It exists again in 6, so the existing name now works. - activity_icon asked for 'fa-truck-pickup' through a helper that already adds the prefix, so it emitted "fa-fa-truck-pickup". Verified that the solid, regular and brands fonts all resolve through the asset pipeline. Co-Authored-By: Claude Opus 5 * couple more places to upgrade font awesome --------- Co-authored-by: Claude Opus 5 --- Gemfile | 2 +- Gemfile.lock | 6 +++--- app/assets/stylesheets/_garden_cards.scss | 7 +++++-- app/assets/stylesheets/application.scss | 9 +++++++-- app/helpers/icons_helper.rb | 2 +- app/javascript/components/AddPhotoModal.jsx | 10 +++++----- app/javascript/components/CropPicker.jsx | 6 +++--- app/javascript/components/EditGardenModal.jsx | 4 ++-- app/javascript/components/EditPlantingModal.jsx | 6 +++--- app/javascript/components/GardenCard.jsx | 4 ++-- app/javascript/components/GardenCards.jsx | 2 +- app/javascript/components/MarkFinishedModal.jsx | 4 ++-- app/javascript/components/PlantPartPicker.jsx | 4 ++-- app/javascript/components/PlantSomethingModal.jsx | 6 +++--- app/javascript/components/PlantedDate.jsx | 6 +++--- app/javascript/components/PlantingRow.jsx | 2 +- app/javascript/components/RecordHarvestModal.jsx | 12 ++++++------ app/javascript/components/SaveSeedsModal.jsx | 10 +++++----- app/javascript/components/StarRating.jsx | 2 +- app/javascript/components/Steps.jsx | 2 +- app/views/crops/_predictions.html.haml | 2 +- 21 files changed, 58 insertions(+), 50 deletions(-) diff --git a/Gemfile b/Gemfile index 635433d2f..522a0c158 100644 --- a/Gemfile +++ b/Gemfile @@ -33,7 +33,7 @@ gem "bootstrap", ">= 5.0.0" gem 'material_icons' # icons -gem 'font-awesome-sass' +gem 'font-awesome-sass', '~> 6.7' gem 'terser' diff --git a/Gemfile.lock b/Gemfile.lock index 229b3dcc9..9763e67ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -276,8 +276,8 @@ GEM ffi (1.17.4) ffi (1.17.4-x86_64-linux-gnu) flickraw (0.9.10) - font-awesome-sass (5.15.1) - sassc (>= 1.11) + font-awesome-sass (6.7.2) + sassc (~> 2.0) friendly_id (5.7.0) activerecord (>= 4.0.0) gbifrb (0.2.0) @@ -793,7 +793,7 @@ DEPENDENCIES faker faraday flickraw - font-awesome-sass + font-awesome-sass (~> 6.7) friendly_id gbifrb geocoder diff --git a/app/assets/stylesheets/_garden_cards.scss b/app/assets/stylesheets/_garden_cards.scss index 097bc60e0..e3fb60c3c 100644 --- a/app/assets/stylesheets/_garden_cards.scss +++ b/app/assets/stylesheets/_garden_cards.scss @@ -120,7 +120,10 @@ $garden-card-line: #e6e6e6; background: none; cursor: pointer; - .fa { + // The icon, whatever style prefix it carries. Keyed on the element rather + // than .fa, which stopped matching when Font Awesome 6 dropped the bare + // prefix and every icon became .fas, .far or .fab. + i { margin-left: 0.35rem; opacity: 0.5; } @@ -129,7 +132,7 @@ $garden-card-line: #e6e6e6; &:focus-visible { color: var(--bs-link-color, #0a58ca); - .fa { + i { opacity: 1; } } diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 209a832da..8fe464074 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -9,8 +9,13 @@ @import "leaflet.markercluster/dist/MarkerCluster"; @import "leaflet.markercluster/dist/MarkerCluster.Default"; -// Font Awesome -@import "font-awesome-sprockets"; +// Font Awesome. The 6.x gem dropped its _font-awesome-sprockets.scss but its +// @font-face rules still call fa-font-path(), so we define it here against +// Sprockets' font-path helper. Its fonts live under assets/fonts/font-awesome. +@function fa-font-path($path) { + @return font-path("font-awesome/#{$path}"); +} + @import "font-awesome"; @import "material_icons"; @import "rails_bootstrap_forms"; diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 80c118d00..e51f398a8 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -76,7 +76,7 @@ module IconsHelper end def activity_icon - icon('fas', 'fa-truck-pickup') + icon('fas', 'truck-pickup') end def post_icon diff --git a/app/javascript/components/AddPhotoModal.jsx b/app/javascript/components/AddPhotoModal.jsx index c8e8f4590..60288a36e 100644 --- a/app/javascript/components/AddPhotoModal.jsx +++ b/app/javascript/components/AddPhotoModal.jsx @@ -141,7 +141,7 @@ export default function AddPhotoModal({label, newUrl, iconUrl, onClose, onAdded} )} {!loadError && !data && ( -