diff --git a/app/controllers/org_admin/plans_controller.rb b/app/controllers/org_admin/plans_controller.rb index f673fc18cf..64e16b59d0 100644 --- a/app/controllers/org_admin/plans_controller.rb +++ b/app/controllers/org_admin/plans_controller.rb @@ -17,7 +17,11 @@ def index @super_admin = current_user.can_super_admin? @clicked_through = params[:click_through].present? - @plans = @super_admin ? Plan.all.page(1) : current_user.org.org_admin_plans.page(1) + @plans = if @super_admin + Plan.all.page(1).includes(:template, roles: { user: :org }) + else + current_user.org.org_admin_plans.page(1) + end end # rubocop:enable Metrics/AbcSize diff --git a/app/controllers/public_pages_controller.rb b/app/controllers/public_pages_controller.rb index 99fd1dcd1f..1b5d9cff93 100644 --- a/app/controllers/public_pages_controller.rb +++ b/app/controllers/public_pages_controller.rb @@ -85,7 +85,7 @@ def template_export # GET /plans_index # ------------------------------------------------------------------------------------ def plan_index - @plans = Plan.publicly_visible.includes(:template) + @plans = Plan.publicly_visible.includes(:template, roles: { user: :org }) render 'plan_index', locals: { query_params: { page: paginable_params.fetch(:page, 1), diff --git a/app/views/org_admin/plans/index.html.erb b/app/views/org_admin/plans/index.html.erb index 2689adab13..e51c845cfd 100644 --- a/app/views/org_admin/plans/index.html.erb +++ b/app/views/org_admin/plans/index.html.erb @@ -34,7 +34,7 @@ <% end %> - <% if @plans.length > 0 %> + <% if @plans.any? %> <% unless @super_admin %> <%= link_to sanitize(_('Download plans (new window)%{open_in_new_window_text}') % { open_in_new_window_text: _('Opens in new window') }, diff --git a/app/views/super_admin/api_clients/_form.html.erb b/app/views/super_admin/api_clients/_form.html.erb index 02d33f2116..4d22402d50 100644 --- a/app/views/super_admin/api_clients/_form.html.erb +++ b/app/views/super_admin/api_clients/_form.html.erb @@ -1,7 +1,7 @@ <% url = @api_client.new_record? ? super_admin_api_clients_path : super_admin_api_client_path(@api_client) method = @api_client.new_record? ? :post : :put -orgs = Org.where(is_other: false) +orgs = Org.where(is_other: false).includes(identifiers: :identifier_scheme) %> <%= form_for @api_client, url: url, method: method,