Skip to content

Commit

Permalink
Fix template.visibilty checkbox behaviour
Browse files Browse the repository at this point in the history
Prior to this commit, the default checked/unchecked values were used (i.e. "1" would be returned when checked, and "0" would be returned when unchecked). However, the box is meant to be checked when selecting 'organisationally_visible' ('for internal %{org_name} use only'), which makes the default checked/unchecked values opposite to the mapping of our enums (i.e. `{"organisationally_visible"=>0, "publicly_visible"=>1}`).
  • Loading branch information
aaronskiba committed Jul 10, 2024
1 parent 15e4d4d commit 4bd0e9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/views/org_admin/templates/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
placement: 'right' }%>
<div class="form-check">
<%= f.label(:visibility) do %>
<%= f.check_box(:visibility, checked: f.object.organisationally_visible?) %>
<%= f.check_box(:visibility,
{ checked: f.object.organisationally_visible? },
f.object.class.visibilities[:organisationally_visible],
f.object.class.visibilities[:publicly_visible]) %>
<%= _('for internal %{org_name} use only') % { org_name: f.object.org.name } %>
<% end %>
Expand Down

0 comments on commit 4bd0e9a

Please sign in to comment.