|
32 | 32 | {}, |
33 | 33 | class: "text-xs rounded-full border px-2 py-0.5 cursor-pointer", |
34 | 34 | data: { controller: "chip-select", chip_select_styles_value: visibility_styles, action: "change->chip-select#update" } %> |
35 | | - <span class="text-lg font-semibold text-gray-800"><%= field.question %></span> |
36 | | - <%= f.hidden_field :question %> |
| 35 | + <%= f.text_field :question, class: "flex-1 text-lg font-semibold text-gray-800 rounded border-gray-300 shadow-sm px-2 py-1" %> |
37 | 36 | <div class="ml-auto"> |
38 | 37 | <%= link_to_remove_association "Remove", f, |
39 | 38 | class: "text-sm text-gray-400 hover:text-red-600 underline" %> |
40 | 39 | </div> |
41 | 40 | </div> |
42 | 41 | <% else %> |
43 | | - <div class="flex-1 grid grid-cols-12 gap-3 items-center"> |
44 | | - <div class="col-span-5 flex items-center gap-2"> |
45 | | - <%= f.select :visibility, visibility_options, |
46 | | - {}, |
47 | | - class: "text-xs rounded-full border px-2 py-0.5 shrink-0 cursor-pointer", |
48 | | - data: { controller: "chip-select", chip_select_styles_value: visibility_styles, action: "change->chip-select#update" } %> |
49 | | - <%= f.text_field :question, class: "w-full rounded border-gray-300 shadow-sm px-2 py-1 text-sm" %> |
50 | | - </div> |
51 | | - <div class="col-span-3"> |
52 | | - <% |
53 | | - type_order = %w[free_form_input_one_line free_form_input_paragraph multiple_choice_radio multiple_choice_checkbox no_user_input group_header] |
54 | | - type_labels = { |
55 | | - "group_header" => "Section header", |
56 | | - "free_form_input_one_line" => "One line", |
57 | | - "free_form_input_paragraph" => "Paragraph", |
58 | | - "multiple_choice_radio" => "Multiple choice radio", |
59 | | - "multiple_choice_checkbox" => "Multiple choice checkbox", |
60 | | - "no_user_input" => "Informational-only" |
61 | | - } |
62 | | - type_options = type_order.map { |t| [ type_labels[t] || t.titleize.gsub("_", " "), t ] } |
63 | | - %> |
64 | | - <%= f.select :answer_type, type_options, |
65 | | - {}, |
66 | | - class: "w-full rounded border-gray-300 shadow-sm px-2 py-1 text-sm" %> |
67 | | - </div> |
68 | | - <div class="col-span-2"> |
69 | | - <label class="flex items-center gap-1 text-sm text-gray-600"> |
70 | | - <%= f.check_box :is_required, class: "rounded border-gray-300 text-blue-600" %> |
71 | | - Required |
72 | | - </label> |
73 | | - </div> |
74 | | - <div class="col-span-2 text-right"> |
75 | | - <%= link_to_remove_association "Remove", f, |
76 | | - class: "text-sm text-gray-400 hover:text-red-600 underline" %> |
77 | | - </div> |
| 42 | + <div class="flex-1 flex flex-wrap items-center gap-2"> |
| 43 | + <%= f.select :visibility, visibility_options, |
| 44 | + {}, |
| 45 | + class: "text-xs rounded-full border px-2 py-0.5 shrink-0 cursor-pointer", |
| 46 | + data: { controller: "chip-select", chip_select_styles_value: visibility_styles, action: "change->chip-select#update" } %> |
| 47 | + <%= f.text_field :question, class: "min-w-0 flex-[3_1_10rem] rounded border-gray-300 shadow-sm px-2 py-1 text-sm" %> |
| 48 | + <% |
| 49 | + type_order = %w[free_form_input_one_line free_form_input_paragraph multiple_choice_radio multiple_choice_checkbox no_user_input group_header] |
| 50 | + type_labels = { |
| 51 | + "group_header" => "Section header", |
| 52 | + "free_form_input_one_line" => "One line", |
| 53 | + "free_form_input_paragraph" => "Paragraph", |
| 54 | + "multiple_choice_radio" => "Multiple choice radio", |
| 55 | + "multiple_choice_checkbox" => "Multiple choice checkbox", |
| 56 | + "no_user_input" => "Informational-only" |
| 57 | + } |
| 58 | + type_options = type_order.map { |t| [ type_labels[t] || t.titleize.gsub("_", " "), t ] } |
| 59 | + %> |
| 60 | + <%= f.select :answer_type, type_options, |
| 61 | + {}, |
| 62 | + class: "flex-[2_1_11rem] rounded border-gray-300 shadow-sm px-2 py-1 text-sm" %> |
| 63 | + <label class="flex items-center gap-1 text-sm text-gray-600 shrink-0"> |
| 64 | + <%= f.check_box :is_required, class: "rounded border-gray-300 text-blue-600" %> |
| 65 | + Required |
| 66 | + </label> |
| 67 | + <label class="flex items-center gap-1 text-sm text-gray-600 shrink-0" title="Hide if already answered on any form (not just this event)"> |
| 68 | + <%= f.check_box :one_time, class: "rounded border-gray-300 text-amber-600" %> |
| 69 | + One-time |
| 70 | + </label> |
| 71 | + <%= link_to_remove_association "Remove", f, |
| 72 | + class: "text-sm text-gray-400 hover:text-red-600 underline shrink-0 ml-auto" %> |
78 | 73 | </div> |
79 | 74 | <% end %> |
80 | 75 | </div> |
0 commit comments