Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/controllers/org_admin/templates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module OrgAdmin
# Controller that handles templates
# rubocop:disable Metrics/ClassLength
class TemplatesController < ApplicationController
include Paginable
include Versionable
Expand Down Expand Up @@ -157,6 +158,10 @@ def edit
def new
authorize Template
@template = current_org.templates.new
# If the Org is a funder set the visibility to Public otherwise set to Organizational
# for Orgs that are both, the admin will see controls on the page to let them choose.
# The default is already 'organisationally_visible' so change it if this is a funder
@template.visibility = Template.visibilities[:publicly_visible] if current_org.funder?
end

# POST /org_admin/templates
Expand Down Expand Up @@ -410,4 +415,5 @@ def get_referrer(template, referrer)
end
end
end
# rubocop:enable Metrics/ClassLength
end
2 changes: 1 addition & 1 deletion app/views/org_admin/templates/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<% else %>
<%
visibility = f.object.visibility
visibility = f.object.funder? ? 'publicly_visible' : 'organisationally_visible' if visibility.nil?
visibility = f.object.org.funder? ? 'publicly_visible' : 'organisationally_visible' if visibility.nil?
%>
<%= f.hidden_field :visibility, value: visibility %>
<% end %>
Expand Down