From 896e9bf6a0fbc55c011898125988fdfe1b9be0a6 Mon Sep 17 00:00:00 2001
From: Justin Miller <16829344+jmilljr24@users.noreply.github.com>
Date: Wed, 15 Jul 2026 14:41:17 -0400
Subject: [PATCH 1/2] add remote search to callout resource selection
---
app/models/resource.rb | 3 ++-
...ration_ticket_callout_resource_fields.html.erb | 15 ++++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/app/models/resource.rb b/app/models/resource.rb
index a840d83ce..540566486 100644
--- a/app/models/resource.rb
+++ b/app/models/resource.rb
@@ -1,5 +1,6 @@
class Resource < ApplicationRecord
- include AuthorCreditable, Featureable, Publishable, TagFilterable, Trendable, WindowsTypeFilterable, RichTextSearchable
+ include AuthorCreditable, Featureable, Publishable, RemoteSearchable, TagFilterable, Trendable, WindowsTypeFilterable, RichTextSearchable
+ remote_searchable_by :title
include Rails.application.routes.url_helpers
include ActionText::Attachable
include Mentionable
diff --git a/app/views/events/_registration_ticket_callout_resource_fields.html.erb b/app/views/events/_registration_ticket_callout_resource_fields.html.erb
index 01fa46d94..b99aaac05 100644
--- a/app/views/events/_registration_ticket_callout_resource_fields.html.erb
+++ b/app/views/events/_registration_ticket_callout_resource_fields.html.erb
@@ -4,9 +4,18 @@
under the title on the resource's own page. %>
- <%= f.collection_select :resource_id, Resource.order(:title), :id, :title,
- { include_blank: "Select a resource…" },
- class: "rounded border-gray-300 bg-white shadow-sm px-2 py-1 text-sm" %>
+ <% resource = f.object.resource %>
+
<%= f.text_field :subtitle, placeholder: "Short one-line",
class: "rounded border-gray-300 bg-white shadow-sm px-2 py-1 text-sm" %>
<%= f.text_area :page_content, rows: 2, placeholder: "Shown under the title",
From ad372f14d91d7cfd08600bd91f38eed04c34283e Mon Sep 17 00:00:00 2001
From: Justin Miller <16829344+jmilljr24@users.noreply.github.com>
Date: Wed, 15 Jul 2026 14:47:05 -0400
Subject: [PATCH 2/2] add resource to search contorller and add policy
---
app/controllers/search_controller.rb | 3 ++-
app/policies/resource_policy.rb | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index b6b90c734..b93644f02 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -59,7 +59,8 @@ def allowed_model(model_param)
"workshop" => Workshop,
"organization" => Organization,
"event" => Event,
- "event_registration" => EventRegistration
+ "event_registration" => EventRegistration,
+ "resource" => Resource
}[model_param]
end
diff --git a/app/policies/resource_policy.rb b/app/policies/resource_policy.rb
index 2cbf485bd..185915611 100644
--- a/app/policies/resource_policy.rb
+++ b/app/policies/resource_policy.rb
@@ -13,6 +13,10 @@ def create?
admin?
end
+ def search?
+ authenticated?
+ end
+
def update?
admin?
end