Skip to content

Commit 2918fb6

Browse files
committed
fix issue with template visibility setting when creating new templates
1 parent a5b76ba commit 2918fb6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/controllers/org_admin/templates_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ def edit
157157
def new
158158
authorize Template
159159
@template = current_org.templates.new
160+
# If the Org is a funder set the visibility to Public otherwise set to Organizational
161+
# for Orgs that are both, the admin will see controls on the page to let them choose.
162+
# The default is already 'organisationally_visible' so change it if this is a funder
163+
@template.visibility = Template.visibilities[:publicly_visible] if current_org.funder?
160164
end
161165

162166
# POST /org_admin/templates

app/views/org_admin/templates/_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<% else %>
3030
<%
3131
visibility = f.object.visibility
32-
visibility = f.object.funder? ? 'publicly_visible' : 'organisationally_visible' if visibility.nil?
32+
visibility = f.object.org.funder? ? 'publicly_visible' : 'organisationally_visible' if visibility.nil?
3333
%>
3434
<%= f.hidden_field :visibility, value: visibility %>
3535
<% end %>

0 commit comments

Comments
 (0)