diff --git a/app/controllers/events/public_registrations_controller.rb b/app/controllers/events/public_forms_controller.rb
similarity index 91%
rename from app/controllers/events/public_registrations_controller.rb
rename to app/controllers/events/public_forms_controller.rb
index 84c9a489f..a08b2bb7a 100644
--- a/app/controllers/events/public_registrations_controller.rb
+++ b/app/controllers/events/public_forms_controller.rb
@@ -1,16 +1,23 @@
module Events
- class PublicRegistrationsController < ApplicationController
+ class PublicFormsController < ApplicationController
+ HEADINGS = {
+ "registration" => "Registration",
+ "scholarship" => "Scholarship application",
+ "bulk_payment" => "Bulk payment",
+ "ce_credit" => "Continuing education credit"
+ }.freeze
+
skip_before_action :authenticate_user!, only: [ :new, :create, :show ]
before_action :set_event
before_action :ensure_registerable, only: [ :new, :create ]
rescue_from ActionController::InvalidAuthenticityToken do
flash[:alert] = "Your session has expired. Please try submitting the form again."
- redirect_to new_event_public_registration_path(@event)
+ redirect_to public_form_new_path
end
def new
- authorize! :public_registration, to: :new?
+ authorize! :public_form, to: :new?
@form = registration_form
unless @form
@@ -25,10 +32,10 @@ def new
end
def create
- authorize! :public_registration, to: :create?
+ authorize! :public_form, to: :create?
if params[:public_registration][:website_url].present?
- redirect_to new_event_public_registration_path(@event)
+ redirect_to public_form_new_path
return
end
@@ -76,7 +83,7 @@ def create
end
def show
- authorize! :public_registration, to: :show?
+ authorize! :public_form, to: :show?
if params[:reg].present?
registration = EventRegistration.find_by!(slug: params[:reg], event_id: @event.id)
@@ -148,9 +155,31 @@ def registration_form
@event.registration_form
end
+ def form_role
+ EventForm::ROLES.include?(params[:form_role]) ? params[:form_role] : "registration"
+ end
+ helper_method :form_role
+
def scholarship_mode?
- params[:scholarship_requested] == "true"
+ if form_role == "scholarship"
+ params[:scholarship_requested] != "false"
+ else
+ params[:scholarship_requested] == "true"
+ end
+ end
+
+ def public_form_new_path
+ send("new_event_#{form_role}_form_path", @event)
+ end
+
+ def public_form_submit_path
+ send("event_#{form_role}_form_path", @event)
+ end
+
+ def public_form_heading
+ HEADINGS.fetch(form_role)
end
+ helper_method :public_form_new_path, :public_form_submit_path, :public_form_heading
def split_form_params(all_params)
reg_field_ids = @form.form_fields.pluck(:id).map(&:to_s)
diff --git a/app/models/event.rb b/app/models/event.rb
index 9247c816d..8790a98f6 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -59,12 +59,12 @@ def self.search_by_params(params)
stories
end
- def registration_form
- forms.find_by(event_forms: { role: "registration" })
+ def form_for_role(role)
+ forms.find_by(event_forms: { role: role.to_s })
end
- def scholarship_form
- forms.find_by(event_forms: { role: "scholarship" })
+ EventForm::ROLES.each do |role_name|
+ define_method("#{role_name}_form") { form_for_role(role_name) }
end
def active_registration_for(person)
diff --git a/app/models/event_form.rb b/app/models/event_form.rb
index 8be270b05..469e360c2 100644
--- a/app/models/event_form.rb
+++ b/app/models/event_form.rb
@@ -2,11 +2,12 @@ class EventForm < ApplicationRecord
belongs_to :event
belongs_to :form
- ROLES = %w[registration scholarship].freeze
+ ROLES = %w[registration scholarship bulk_payment ce_credit].freeze
validates :role, presence: true, inclusion: { in: ROLES }
validates :form_id, uniqueness: { scope: [ :event_id, :role ] }
- scope :registration, -> { where(role: "registration") }
- scope :scholarship, -> { where(role: "scholarship") }
+ ROLES.each do |role_name|
+ scope role_name, -> { where(role: role_name) }
+ end
end
diff --git a/app/policies/events/public_registration_policy.rb b/app/policies/events/public_form_policy.rb
similarity index 59%
rename from app/policies/events/public_registration_policy.rb
rename to app/policies/events/public_form_policy.rb
index d00c40519..4b2d43dcb 100644
--- a/app/policies/events/public_registration_policy.rb
+++ b/app/policies/events/public_form_policy.rb
@@ -1,4 +1,4 @@
-class Events::PublicRegistrationPolicy < ApplicationPolicy
+class Events::PublicFormPolicy < ApplicationPolicy
def new?
true
end
diff --git a/app/views/event_registrations/_form.html.erb b/app/views/event_registrations/_form.html.erb
index 41617883f..56486c629 100644
--- a/app/views/event_registrations/_form.html.erb
+++ b/app/views/event_registrations/_form.html.erb
@@ -120,7 +120,7 @@
<% end %>
<% submissions.each_with_index do |(form_name, ts), i| %>
- <%= link_to event_public_registration_path(f.object.event, **form_show_params),
+ <%= link_to event_registration_form_path(f.object.event, **form_show_params),
class: "group inline-flex items-center gap-1.5 font-medium #{DomainTheme.text_class_for(:event_registrations, intensity: 600)} hover:underline",
target: "_blank",
title: "#{form_name} — submitted #{ts.strftime('%b %-d, %Y')}",
diff --git a/app/views/event_registrations/_ticket.html.erb b/app/views/event_registrations/_ticket.html.erb
index a96c4b4a9..82d3c2055 100644
--- a/app/views/event_registrations/_ticket.html.erb
+++ b/app/views/event_registrations/_ticket.html.erb
@@ -136,7 +136,7 @@
<% registration_form = event_registration.event.registration_form %>
<% if registration_form && registration_form.form_submissions.exists?(person: event_registration.registrant) %>
<%= link_to "View registration details",
- event_public_registration_path(event_registration.event, reg: event_registration.slug),
+ event_registration_form_path(event_registration.event, reg: event_registration.slug),
class: "text-xs text-gray-400 hover:text-blue-600 underline" %>
<% end %>
<%= button_to "Resend confirmation email",
diff --git a/app/views/events/_card.html.erb b/app/views/events/_card.html.erb
index 7f2ca4ef4..8919a0751 100644
--- a/app/views/events/_card.html.erb
+++ b/app/views/events/_card.html.erb
@@ -77,7 +77,7 @@
<% if user_signed_in? %>
<% if event.object.registration_form&.form_fields&.any? %>
<%= link_to "Register",
- new_event_public_registration_path(event),
+ new_event_registration_form_path(event),
data: { turbo_frame: "_top" },
class: "btn px-3 py-2 text-xs uppercase leading-tight font-telefon text-accent border-2 border-accent hover:text-white hover:bg-orange-700" %>
<% else %>
@@ -88,7 +88,7 @@
<% end %>
<% elsif event.object.public_registration_enabled? && event.object.event_forms.registration.exists? %>
<%= link_to "Register",
- new_event_public_registration_path(event),
+ new_event_registration_form_path(event),
data: { turbo_frame: "_top" },
class: "btn px-3 py-2 text-xs uppercase leading-tight font-telefon text-accent border-2 border-accent hover:text-white hover:bg-orange-700" %>
<% end %>
diff --git a/app/views/events/_form.html.erb b/app/views/events/_form.html.erb
index 92949df98..69f0d3df1 100644
--- a/app/views/events/_form.html.erb
+++ b/app/views/events/_form.html.erb
@@ -353,7 +353,7 @@
<% if @event.event_forms.registration.exists? %>
<%= link_to "View public registration page",
- new_event_public_registration_path(@event),
+ new_event_registration_form_path(@event),
class: "text-sm text-blue-700 hover:text-blue-900 underline",
target: "_blank" %>
<% end %>
diff --git a/app/views/events/_form_actions_menu.html.erb b/app/views/events/_form_actions_menu.html.erb
index 0b1a35776..b374d82e5 100644
--- a/app/views/events/_form_actions_menu.html.erb
+++ b/app/views/events/_form_actions_menu.html.erb
@@ -14,10 +14,11 @@
class="hidden absolute right-0 z-10 mt-1 bg-white border border-gray-200 rounded-md shadow-lg py-1 min-w-[180px]">
<% if @event.event_forms.registration.exists? || @event.scholarship_form %>
<% if @event.event_forms.registration.exists? %>
- <%= link_to "Public registration", new_event_public_registration_path(@event, as_visitor: true), class: item_class, target: "_blank", rel: "noopener noreferrer" %>
+ <%= link_to "Public registration", new_event_registration_form_path(@event, as_visitor: true), class: item_class, target: "_blank", rel: "noopener noreferrer" %>
+ <%= link_to "Bulk payment", new_event_bulk_payment_form_path(@event, as_visitor: true), class: item_class, target: "_blank", rel: "noopener noreferrer" %>
<% end %>
<% if @event.scholarship_form %>
- <%= link_to "Scholarship version", new_event_public_registration_path(@event, scholarship_requested: true, as_visitor: true), class: item_class, target: "_blank", rel: "noopener noreferrer" %>
+ <%= link_to "Scholarship version", new_event_scholarship_form_path(@event, as_visitor: true), class: item_class, target: "_blank", rel: "noopener noreferrer" %>
<% end %>
<%= link_to "Change base form", edit_event_path(@event, anchor: "registration_form_section"), class: item_class %>
diff --git a/app/views/events/_registrants_results.html.erb b/app/views/events/_registrants_results.html.erb
index b7015edaf..179ceb568 100644
--- a/app/views/events/_registrants_results.html.erb
+++ b/app/views/events/_registrants_results.html.erb
@@ -58,7 +58,7 @@
<% form_show_params = registration.slug.present? ? { reg: registration.slug } : { person_id: person.id } %>
<% tooltip_parts = submissions.map { |name, ts| "#{name} — Submitted #{ts.strftime('%B %d, %Y at %l:%M %P')}" } %>
<% tooltip_parts << "Scholarship requested" if registration.scholarship_requested? %>
- <%= link_to event_public_registration_path(@event, **form_show_params),
+ <%= link_to event_registration_form_path(@event, **form_show_params),
class: "text-green-600 hover:text-green-800",
title: tooltip_parts.join("\n"),
target: "_blank",
diff --git a/app/views/events/_registration_section.html.erb b/app/views/events/_registration_section.html.erb
index d4939d806..cb0b1e802 100644
--- a/app/views/events/_registration_section.html.erb
+++ b/app/views/events/_registration_section.html.erb
@@ -23,7 +23,7 @@
<% if user_signed_in? %>
<% if event.object.registration_form&.form_fields&.any? %>
<%= link_to button_text,
- new_event_public_registration_path(event),
+ new_event_registration_form_path(event),
class: "btn px-10 py-2 text-2xl uppercase text-white hover:bg-white event-register-btn",
style: "font-family: 'Telefon Bold', sans-serif; background-color: rgb(170, 46, 0); border: 3px solid rgb(170, 46, 0);" %>
<% else %>
@@ -35,7 +35,7 @@
<% end %>
<% elsif event.object.public_registration_enabled? && event.object.event_forms.registration.exists? %>
<%= link_to button_text,
- new_event_public_registration_path(event),
+ new_event_registration_form_path(event),
class: "btn px-10 py-2 text-2xl uppercase text-white hover:bg-white event-register-btn",
style: "font-family: 'Telefon Bold', sans-serif; background-color: rgb(170, 46, 0); border: 3px solid rgb(170, 46, 0);" %>
<% end %>
diff --git a/app/views/events/public_registrations/_form_field.html.erb b/app/views/events/public_forms/_form_field.html.erb
similarity index 100%
rename from app/views/events/public_registrations/_form_field.html.erb
rename to app/views/events/public_forms/_form_field.html.erb
diff --git a/app/views/events/public_registrations/new.html.erb b/app/views/events/public_forms/new.html.erb
similarity index 93%
rename from app/views/events/public_registrations/new.html.erb
rename to app/views/events/public_forms/new.html.erb
index 12f94a052..0976240da 100644
--- a/app/views/events/public_registrations/new.html.erb
+++ b/app/views/events/public_forms/new.html.erb
@@ -53,7 +53,7 @@
<%= image_tag("logo.png", alt: "Organization logo", class: "h-9 w-auto") %>
-
Registration
+
<%= public_form_heading %>
Reserve your spot — it only takes a minute.
@@ -69,7 +69,7 @@
<% end %>
- <%= form_with url: event_public_registration_path(@event), method: :post, local: true, class: "space-y-2", data: { turbo: !@event.cost_cents.to_i.positive? } do |f| %>
+ <%= form_with url: public_form_submit_path, method: :post, local: true, class: "space-y-2", data: { turbo: !@event.cost_cents.to_i.positive? } do |f| %>
<% if @scholarship %>
@@ -145,16 +145,16 @@
<% label_override = email_label_overrides[key] %>
<% if span %>
- <%= render "events/public_registrations/form_field", field: row_field, value: submitted_value, label: label_override %>
+ <%= render "events/public_forms/form_field", field: row_field, value: submitted_value, label: label_override %>
<% else %>
- <%= render "events/public_registrations/form_field", field: row_field, value: submitted_value, label: label_override %>
+ <%= render "events/public_forms/form_field", field: row_field, value: submitted_value, label: label_override %>
<% end %>
<% end %>
<% else %>
<% submitted_value = params.dig(:public_registration, :form_fields, field.id.to_s) %>
- <%= render "events/public_registrations/form_field", field: field, value: submitted_value %>
+ <%= render "events/public_forms/form_field", field: field, value: submitted_value %>
<% end %>
<% end %>
@@ -167,7 +167,7 @@
<% @scholarship_form.form_fields.reorder(position: :asc).each do |field| %>
<% next if field.group_header? %>
<% submitted_value = params.dig(:public_registration, :form_fields, field.id.to_s) %>
- <%= render "events/public_registrations/form_field", field: field, value: submitted_value %>
+ <%= render "events/public_forms/form_field", field: field, value: submitted_value %>
<% end %>
diff --git a/app/views/events/public_registrations/show.html.erb b/app/views/events/public_forms/show.html.erb
similarity index 100%
rename from app/views/events/public_registrations/show.html.erb
rename to app/views/events/public_forms/show.html.erb
diff --git a/app/views/forms/show.html.erb b/app/views/forms/show.html.erb
index 7289c78d7..02b75a592 100644
--- a/app/views/forms/show.html.erb
+++ b/app/views/forms/show.html.erb
@@ -127,15 +127,15 @@
<% label_override = email_label_overrides[key] %>
<% if span %>
- <%= render "events/public_registrations/form_field", field: row_field, value: nil, label: label_override %>
+ <%= render "events/public_forms/form_field", field: row_field, value: nil, label: label_override %>
<% else %>
- <%= render "events/public_registrations/form_field", field: row_field, value: nil, label: label_override %>
+ <%= render "events/public_forms/form_field", field: row_field, value: nil, label: label_override %>
<% end %>
<% end %>
<% else %>
- <%= render "events/public_registrations/form_field", field: field, value: nil %>
+ <%= render "events/public_forms/form_field", field: field, value: nil %>
<% end %>
<% end %>
diff --git a/app/views/scholarships/_form_submission.html.erb b/app/views/scholarships/_form_submission.html.erb
index c4f5a9919..ad7829e57 100644
--- a/app/views/scholarships/_form_submission.html.erb
+++ b/app/views/scholarships/_form_submission.html.erb
@@ -10,7 +10,7 @@
Form submission
<% if @form_submission %>
- <%= link_to event_public_registration_path(@event, **submission_params),
+ <%= link_to event_registration_form_path(@event, **submission_params),
class: "ml-auto inline-flex items-center gap-1.5 text-xs font-medium text-gray-500 hover:text-gray-700 hover:underline",
target: "_blank", rel: "noopener" do %>
View full submission
diff --git a/config/routes.rb b/config/routes.rb
index 0783a9c75..e93f398a6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -130,7 +130,12 @@
post :send_reminder
end
resource :registrations, only: %i[ create destroy ], module: :events, as: :registrant_registration
- resource :public_registration, only: [ :new, :create, :show ], module: :events
+ EventForm::ROLES.each do |form_role|
+ actions = form_role == "registration" ? %i[ new create show ] : %i[ new create ]
+ resource :"#{form_role}_form", only: actions,
+ controller: "public_forms", module: :events,
+ defaults: { form_role: form_role }
+ end
end
resources :people do
collection do
diff --git a/spec/factories/event_forms.rb b/spec/factories/event_forms.rb
index 3f17a9fb1..cb0f611a5 100644
--- a/spec/factories/event_forms.rb
+++ b/spec/factories/event_forms.rb
@@ -11,5 +11,13 @@
trait :scholarship do
role { "scholarship" }
end
+
+ trait :bulk_payment do
+ role { "bulk_payment" }
+ end
+
+ trait :ce_credit do
+ role { "ce_credit" }
+ end
end
end
diff --git a/spec/models/event_form_spec.rb b/spec/models/event_form_spec.rb
index 61350192f..cb0103115 100644
--- a/spec/models/event_form_spec.rb
+++ b/spec/models/event_form_spec.rb
@@ -35,6 +35,8 @@
describe "scopes" do
let!(:registration) { create(:event_form, role: "registration") }
let!(:scholarship) { create(:event_form, role: "scholarship") }
+ let!(:bulk_payment) { create(:event_form, role: "bulk_payment") }
+ let!(:ce_credit) { create(:event_form, role: "ce_credit") }
it ".registration returns only registration records" do
expect(EventForm.registration).to contain_exactly(registration)
@@ -43,5 +45,13 @@
it ".scholarship returns only scholarship records" do
expect(EventForm.scholarship).to contain_exactly(scholarship)
end
+
+ it ".bulk_payment returns only bulk_payment records" do
+ expect(EventForm.bulk_payment).to contain_exactly(bulk_payment)
+ end
+
+ it ".ce_credit returns only ce_credit records" do
+ expect(EventForm.ce_credit).to contain_exactly(ce_credit)
+ end
end
end
diff --git a/spec/requests/events/registrations_spec.rb b/spec/requests/events/registrations_spec.rb
index c07611a39..480fe6571 100644
--- a/spec/requests/events/registrations_spec.rb
+++ b/spec/requests/events/registrations_spec.rb
@@ -147,7 +147,7 @@
end
end
- describe "GET /events/:event_id/public_registration (show)" do
+ describe "GET /events/:event_id/registration_form (show)" do
let!(:registration) { create(:event_registration, event: event, registrant: user.person) }
before do
@@ -161,12 +161,12 @@
end
it "allows access with a valid slug" do
- get event_public_registration_path(event, reg: registration.slug)
+ get event_registration_form_path(event, reg: registration.slug)
expect(response).to have_http_status(:success)
end
it "returns 404 with an invalid slug" do
- get event_public_registration_path(event, reg: "bogus-slug")
+ get event_registration_form_path(event, reg: "bogus-slug")
expect(response).to have_http_status(:not_found)
end
@@ -174,7 +174,7 @@
other_event = create(:event)
other_registration = create(:event_registration, event: other_event, registrant: user.person)
- get event_public_registration_path(event, reg: other_registration.slug)
+ get event_registration_form_path(event, reg: other_registration.slug)
expect(response).to have_http_status(:not_found)
end
@@ -182,7 +182,7 @@
before { sign_out user }
it "allows access with a valid slug" do
- get event_public_registration_path(event, reg: registration.slug)
+ get event_registration_form_path(event, reg: registration.slug)
expect(response).to have_http_status(:success)
end
end
diff --git a/spec/requests/scholarships_spec.rb b/spec/requests/scholarships_spec.rb
index def9404a0..93ef8ec51 100644
--- a/spec/requests/scholarships_spec.rb
+++ b/spec/requests/scholarships_spec.rb
@@ -50,7 +50,7 @@
expect(response.body).to include("Why do you need a scholarship?")
expect(response.body).to include("Limited budget")
expect(response.body).to include("View full submission")
- expect(response.body).to include(event_public_registration_path(event, reg: registration.slug))
+ expect(response.body).to include(event_registration_form_path(event, reg: registration.slug))
end
it "renders the shared event header: event link, training date, and a profile-linked recipient" do
diff --git a/spec/routing/public_forms_routing_spec.rb b/spec/routing/public_forms_routing_spec.rb
new file mode 100644
index 000000000..ec6cc36e4
--- /dev/null
+++ b/spec/routing/public_forms_routing_spec.rb
@@ -0,0 +1,71 @@
+require "rails_helper"
+
+RSpec.describe Events::PublicFormsController, type: :routing do
+ describe "registration_form" do
+ it "routes new" do
+ expect(get: "/events/1/registration_form/new").to route_to(
+ "events/public_forms#new", event_id: "1", form_role: "registration"
+ )
+ end
+
+ it "routes create" do
+ expect(post: "/events/1/registration_form").to route_to(
+ "events/public_forms#create", event_id: "1", form_role: "registration"
+ )
+ end
+
+ it "routes show" do
+ expect(get: "/events/1/registration_form").to route_to(
+ "events/public_forms#show", event_id: "1", form_role: "registration"
+ )
+ end
+ end
+
+ describe "scholarship_form" do
+ it "routes new" do
+ expect(get: "/events/1/scholarship_form/new").to route_to(
+ "events/public_forms#new", event_id: "1", form_role: "scholarship"
+ )
+ end
+
+ it "routes create" do
+ expect(post: "/events/1/scholarship_form").to route_to(
+ "events/public_forms#create", event_id: "1", form_role: "scholarship"
+ )
+ end
+ end
+
+ describe "bulk_payment_form" do
+ it "routes new" do
+ expect(get: "/events/1/bulk_payment_form/new").to route_to(
+ "events/public_forms#new", event_id: "1", form_role: "bulk_payment"
+ )
+ end
+
+ it "routes create" do
+ expect(post: "/events/1/bulk_payment_form").to route_to(
+ "events/public_forms#create", event_id: "1", form_role: "bulk_payment"
+ )
+ end
+ end
+
+ describe "ce_credit_form" do
+ it "routes new" do
+ expect(get: "/events/1/ce_credit_form/new").to route_to(
+ "events/public_forms#new", event_id: "1", form_role: "ce_credit"
+ )
+ end
+
+ it "routes create" do
+ expect(post: "/events/1/ce_credit_form").to route_to(
+ "events/public_forms#create", event_id: "1", form_role: "ce_credit"
+ )
+ end
+ end
+
+ it "does not collide with the registrant registrations route" do
+ expect(post: "/events/1/registrations").to route_to(
+ "events/registrations#create", event_id: "1"
+ )
+ end
+end
diff --git a/spec/system/event_registration_show_spec.rb b/spec/system/event_registration_show_spec.rb
index 830a1c31f..c121cc669 100644
--- a/spec/system/event_registration_show_spec.rb
+++ b/spec/system/event_registration_show_spec.rb
@@ -61,7 +61,7 @@
visit registration_ticket_path(registration.slug)
expect(page).to have_link("View registration details",
- href: event_public_registration_path(event, reg: registration.slug))
+ href: event_registration_form_path(event, reg: registration.slug))
end
end
diff --git a/spec/system/events_show_spec.rb b/spec/system/events_show_spec.rb
index fcb563e1c..42b7117d0 100644
--- a/spec/system/events_show_spec.rb
+++ b/spec/system/events_show_spec.rb
@@ -50,7 +50,7 @@
it "shows register link to public registration" do
visit event_path(event)
- expect(page).to have_link("Register", href: new_event_public_registration_path(event))
+ expect(page).to have_link("Register", href: new_event_registration_form_path(event))
end
end
diff --git a/spec/system/public_forms_new_spec.rb b/spec/system/public_forms_new_spec.rb
new file mode 100644
index 000000000..4eeaac942
--- /dev/null
+++ b/spec/system/public_forms_new_spec.rb
@@ -0,0 +1,98 @@
+require "rails_helper"
+
+RSpec.describe "Public form pages", type: :system do
+ let(:event) do
+ create(
+ :event,
+ :published,
+ :publicly_visible,
+ title: "My Event",
+ start_date: 2.days.from_now.change(hour: 10),
+ end_date: 2.days.from_now.change(hour: 12)
+ )
+ end
+
+ before do
+ driven_by(:rack_test)
+ form = FormBuilderService.new(
+ name: "Extended Event Registration",
+ sections: %i[person_identifier person_contact_info person_background professional_info marketing scholarship payment consent]
+ ).call
+ EventForm.create!(event: event, form: form, role: "registration")
+ end
+
+ def add_scholarship_form
+ EventForm.create!(event: event, form: create(:form, :with_fields), role: "scholarship")
+ end
+
+ shared_examples "an event-linked public form" do |path_helper|
+ it "shows a back link to the event page" do
+ visit public_send(path_helper, event)
+ expect(page).to have_link("Back to event", href: event_path(event))
+ end
+
+ it "links the event title back to the event page" do
+ visit public_send(path_helper, event)
+ within("h1") do
+ expect(page).to have_link(event.title, href: event_path(event))
+ end
+ end
+ end
+
+ describe "registration_form" do
+ it_behaves_like "an event-linked public form", :new_event_registration_form_path
+
+ it "uses the Registration heading and submits to its own endpoint" do
+ visit new_event_registration_form_path(event)
+
+ expect(page).to have_css("h2", text: "Registration")
+ expect(page).to have_css("form[action='#{event_registration_form_path(event)}']")
+ end
+
+ context "with a scholarship form available" do
+ before { add_scholarship_form }
+
+ it "hides the scholarship section by default" do
+ visit new_event_registration_form_path(event)
+
+ expect(page).to have_no_css("h3", text: "Scholarship application")
+ end
+
+ it "shows the scholarship section when scholarship_requested=true" do
+ visit new_event_registration_form_path(event, scholarship_requested: true)
+
+ expect(page).to have_css("h3", text: "Scholarship application")
+ end
+ end
+ end
+
+ describe "scholarship_form" do
+ before { add_scholarship_form }
+
+ it_behaves_like "an event-linked public form", :new_event_scholarship_form_path
+
+ it "uses the Scholarship application heading and submits to its own endpoint" do
+ visit new_event_scholarship_form_path(event)
+
+ expect(page).to have_css("h2", text: "Scholarship application")
+ expect(page).to have_css("form[action='#{event_scholarship_form_path(event)}']")
+ end
+
+ it "shows the scholarship section by default" do
+ visit new_event_scholarship_form_path(event)
+
+ expect(page).to have_css("h3", text: "Scholarship application")
+ end
+ end
+
+ describe "bulk_payment_form" do
+ it_behaves_like "an event-linked public form", :new_event_bulk_payment_form_path
+
+ it "uses the Bulk payment heading and submits to its own endpoint" do
+ visit new_event_bulk_payment_form_path(event)
+
+ expect(page).to have_css("h2", text: "Bulk payment")
+ expect(page).to have_css("form[action='#{event_bulk_payment_form_path(event)}']")
+ end
+ end
+end
diff --git a/spec/system/public_registration_new_spec.rb b/spec/system/public_registration_new_spec.rb
deleted file mode 100644
index d2ede23d5..000000000
--- a/spec/system/public_registration_new_spec.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require "rails_helper"
-
-RSpec.describe "Public registration new page", type: :system do
- let(:event) do
- create(
- :event,
- :published,
- :publicly_visible,
- title: "My Event",
- start_date: 2.days.from_now.change(hour: 10),
- end_date: 2.days.from_now.change(hour: 12)
- )
- end
-
- before do
- driven_by(:rack_test)
- form = FormBuilderService.new(
- name: "Extended Event Registration",
- sections: %i[person_identifier person_contact_info person_background professional_info marketing scholarship payment consent]
- ).call
- EventForm.create!(event: event, form: form, role: "registration")
- end
-
- describe "back to event link" do
- it "shows a back link to the event page" do
- visit new_event_public_registration_path(event)
-
- expect(page).to have_link("Back to event", href: event_path(event))
- end
- end
-
- describe "event title link" do
- it "links the event title back to the event page" do
- visit new_event_public_registration_path(event)
-
- within("h1") do
- expect(page).to have_link(event.title, href: event_path(event))
- end
- end
- end
-end
diff --git a/spec/views/page_bg_class_alignment_spec.rb b/spec/views/page_bg_class_alignment_spec.rb
index 9b4218234..e771bd87c 100644
--- a/spec/views/page_bg_class_alignment_spec.rb
+++ b/spec/views/page_bg_class_alignment_spec.rb
@@ -180,8 +180,8 @@
"app/views/workshops/edit.html.erb" => "admin-only bg-blue-100",
# ─── public registration / slug-based views ───
- "app/views/events/public_registrations/new.html.erb" => "public",
- "app/views/events/public_registrations/show.html.erb" => "public",
+ "app/views/events/public_forms/new.html.erb" => "public",
+ "app/views/events/public_forms/show.html.erb" => "public",
"app/views/events/registrations/show.html.erb" => "public",
# ─── admin-only confirm/interstitial ───