diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index e601777..70138ea 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -450,11 +450,7 @@ end def set_templates - @templates = current_user - .org - .templates - .published - .organisationally_visible - .where(customization_of: nil) + @templates = current_user.org.templates.published.organisationally_visible.where(customization_of: nil) if current_user.org + @templates ||= [] end end diff --git a/app/views/plans/_form_v2.html.erb b/app/views/plans/_form_v2.html.erb index fb31c57..11de526 100644 --- a/app/views/plans/_form_v2.html.erb +++ b/app/views/plans/_form_v2.html.erb @@ -30,8 +30,10 @@ <%= _('Would you like to use the default template "Default Template"?') %>
- <%= hidden_field_tag('own_org_name', @default_org.name) %> - <%= hidden_field_tag('own_org_id', @default_org.id) %> + <% if @default_org %> + <%= hidden_field_tag('own_org_name', @default_org.name) %> + <%= hidden_field_tag('own_org_id', @default_org.id) %> + <% end %> @@ -68,6 +70,8 @@ <%= check_box_tag(:plan_no_org, '', false, style: 'display: none;') %> <%= check_box_tag(:plan_no_funder, '', true, style: 'display: none;') %> + + + + + <% unless @default_org %> ++ <%= _('You are not linked to an organisation, we can\'t suggest you a template. Please choose an organisation in your profile') %> +
+