Skip to content

Commit

Permalink
fixed obs unit selector to include selected to be expanded if present #…
Browse files Browse the repository at this point in the history
  • Loading branch information
stuzart committed Oct 28, 2024
1 parent 6b430d3 commit 2d99efe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/helpers/observation_units_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ def observation_unit_selector(name, selected = nil, opts = {})
opts[:data] ||= {}
opts[:multiple] = false
grouped_options = grouped_observation_unit_options
opts[:select_options] = grouped_options_for_select(grouped_options, selected)
opts[:select_options] = grouped_options_for_select(grouped_options, selected&.id)

objects_input(name, [selected&.id], opts)
objects_input(name, [], opts)
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/views/samples/_associate_observation_unit.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= folding_panel(t('observation_unit'), resource.observation_unit.present?) do %>
<%= observation_unit_selector('sample[observation_unit_id]', resource.observation_unit) %>
<%= folding_panel(t('observation_unit'), resource.observation_unit.blank?) do %>
<%= observation_unit_selector('sample[observation_unit_id]', resource.observation_unit, id:'observation_unit-select', class: 'form-control') %>
<% end %>

0 comments on commit 2d99efe

Please sign in to comment.