Skip to content

Commit d965b90

Browse files
maebealeclaude
andcommitted
Check admin param before @Workshop in variation form workshop conditional
Ensures admin users with ?admin=true can change the workshop even when @Workshop is set, rather than always hiding the dropdown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b553bd0 commit d965b90

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/views/workshop_variations/_form.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
<!-- Workshop selection / reference -->
88
<div class="mb-6">
9-
<% if @workshop %>
10-
<%= f.hidden_field :workshop_id, value: @workshop.id %>
11-
<% elsif params[:admin] == "true" %>
9+
<% if params[:admin] == "true" %>
1210
<%= f.input :workshop_id,
13-
collection: f.object.workshop.present? ? [[ f.object.workshop.title, f.object.workshop.id]] : [],
11+
collection: f.object.workshop.present? ? [[ f.object.workshop.remote_search_label[:label], f.object.workshop.id]] : [],
1412
include_blank: true,
1513
required: true,
1614
input_html: {
@@ -22,6 +20,8 @@
2220
prompt: "Search by title",
2321
label: "Workshop",
2422
label_html: { class: "block text-sm font-medium text-gray-700 mb-1 " } %>
23+
<% elsif @workshop %>
24+
<%= f.hidden_field :workshop_id, value: @workshop.id %>
2525
<% elsif f.object.workshop_id.present? %>
2626
<%= f.hidden_field :workshop_id, value: f.object.workshop_id %>
2727
<% end %>

0 commit comments

Comments
 (0)