Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/admin/schedule_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def safe_return_to
# config/schedule.yml items and should never be set by hand.
def schedule_item_params
attrs = params.require(:schedule_item).permit(
:day, :time_label, :sort_time, :title, :host,
:day, :time_label, :sort_time, :title, :host, :host_url,
:location, :map_url, :description, :kind, :flexible, :is_public, :audience,
:offers_new_passport, :offers_stamping, :offers_passport_pickup,
:new_passport_capacity, :stamping_capacity, :passport_pickup_capacity,
Expand Down
10 changes: 10 additions & 0 deletions app/views/admin/schedule_items/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@
class: "select" %>
</div>

<div>
<%= f.label :host_url, "Speaker profile URL", class: "label" %>
<%= f.url_field :host_url, class: "input",
placeholder: "https://blueridgeruby.com/speakers/..." %>
<p class="text-muted text-sm mt-1">
Optional. If set, the speaker's name links to this URL on /schedule and /plan.
Update this whenever you change the host so the link points to the right person.
</p>
</div>

<div>
<%= f.label :location, class: "label" %>
<%= f.text_field :location, class: "input" %>
Expand Down
31 changes: 31 additions & 0 deletions test/controllers/admin/schedule_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,37 @@ def valid_form_params(overrides = {})
end
end

test "admin edit form exposes a host_url field so name and link stay paired" do
item = ScheduleItem.create!(
day: "thu", title: "Keynote", host: "John Athayde",
host_url: "https://blueridgeruby.com/speakers/john-athayde/",
kind: :talk, is_public: true
)
sign_in_as users(:jeremy)
get edit_admin_schedule_item_path(item)

assert_select "input[name='schedule_item[host_url]'][value=?]",
"https://blueridgeruby.com/speakers/john-athayde/"
end

test "admin update persists host_url alongside host" do
item = ScheduleItem.create!(
day: "thu", title: "Keynote", host: "John Athayde",
host_url: "https://blueridgeruby.com/speakers/john-athayde/",
kind: :talk, is_public: true
)
sign_in_as users(:jeremy)

patch admin_schedule_item_path(item), params: valid_form_params(
title: "Keynote", host: "Joël Quenneville",
host_url: "https://blueridgeruby.com/speakers/joel-quenneville/"
)

item.reload
assert_equal "Joël Quenneville", item.host
assert_equal "https://blueridgeruby.com/speakers/joel-quenneville/", item.host_url
end

test "admin can create a volunteers_only public item" do
sign_in_as users(:jeremy)
post admin_schedule_items_path, params: valid_form_params(
Expand Down
Loading