diff --git a/app/views/shared/_sponsor.html.haml b/app/views/shared/_sponsor.html.haml new file mode 100644 index 000000000..af0c40eec --- /dev/null +++ b/app/views/shared/_sponsor.html.haml @@ -0,0 +1,2 @@ +.col-4.col-md-3.col-lg-2.mt-4.d-flex.justify-content-center + = link_to image_tag(sponsor.avatar.url, alt: sponsor.name, class: 'small-image mw-100'), sponsor.website, title: sponsor.name, class: 'border-0 mw-100' diff --git a/app/views/shared/_sponsors.html.haml b/app/views/shared/_sponsors.html.haml index eaddf46b9..8d72c6ed3 100644 --- a/app/views/shared/_sponsors.html.haml +++ b/app/views/shared/_sponsors.html.haml @@ -1,4 +1,2 @@ .row.d-flex.align-items-center.justify-content-center - - sponsors.each do |sponsor| - .col-4.col-md-3.col-lg-2.mt-4.d-flex.justify-content-center - = link_to image_tag(sponsor.avatar.url, alt: sponsor.name, class: 'small-image mw-100'), sponsor.website, title: sponsor.name, class: 'border-0 mw-100' + = render partial: 'shared/sponsor', collection: sponsors, as: :sponsor, cached: true diff --git a/db/migrate/20260810091618_add_indexes_to_sponsors_for_active_and_search.rb b/db/migrate/20260810091618_add_indexes_to_sponsors_for_active_and_search.rb new file mode 100644 index 000000000..e657639fa --- /dev/null +++ b/db/migrate/20260810091618_add_indexes_to_sponsors_for_active_and_search.rb @@ -0,0 +1,15 @@ +class AddIndexesToSponsorsForActiveAndSearch < ActiveRecord::Migration[8.1] + disable_ddl_transaction! + + def change + add_index :sponsors, :updated_at, + order: { updated_at: :desc }, + where: 'level <> 0', + algorithm: :concurrently, + if_not_exists: true + + add_index :sponsors, 'lower(name)', + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 6820b6fcd..c4263bba3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.1].define(version: 2026_08_06_000000) do +ActiveRecord::Schema[8.1].define(version: 2026_08_10_091618) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -512,6 +512,8 @@ t.integer "seats", default: 15 t.datetime "updated_at", precision: nil t.string "website" + t.index "lower((name)::text)", name: "index_sponsors_on_lower_name" + t.index ["updated_at"], name: "index_sponsors_on_updated_at", order: :desc, where: "(level <> 0)" end create_table "sponsorships", id: :serial, force: :cascade do |t|