Server-side render initial visibility of select help text

Resolves failure to display initial help text of difficulty level.
This commit is contained in:
Andrew Kvalheim 2023-03-10 16:51:36 -08:00
parent e5ab9b4db1
commit 6ed1725b01
3 changed files with 18 additions and 9 deletions

View file

@ -0,0 +1,10 @@
:ruby
include_blank ||= false
select_id = field_id(f.object_name, local_assigns[:for])
value = f.object.send(local_assigns[:for])
- options.each_with_index do |option, i|
- selected = value.present? ? option.id == value : !include_blank && i == 0
%span.help-block.select-help-text.collapse{ id: "#{option.id}-help", class: [select_id, ('in' if selected)] }
= yield option