Files
osem/app/views/shared/_select_help_text.html.haml
Andrew Kvalheim 6ed1725b01 Server-side render initial visibility of select help text
Resolves failure to display initial help text of difficulty level.
2023-03-11 13:50:51 -08:00

11 lines
388 B
Plaintext

: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