diff --git a/app/controllers/paginable/orgs_controller.rb b/app/controllers/paginable/orgs_controller.rb index 61446f7..16bd7df 100644 --- a/app/controllers/paginable/orgs_controller.rb +++ b/app/controllers/paginable/orgs_controller.rb @@ -1,13 +1,11 @@ -module Paginable - class OrgsController < ApplicationController - include Paginable - # /paginable/guidances/index/:page - def index - authorize(Org) - paginable_renderise( - partial: 'index', - scope: Org.includes(:templates, :users).all - ) - end +class Paginable::OrgsController < ApplicationController + include Paginable + # /paginable/guidances/index/:page + def index + authorize(Org) + paginable_renderise( + partial: 'index', + scope: Org.includes(:templates, :users).joins(:templates, :users) + ) end -end \ No newline at end of file +end diff --git a/app/controllers/super_admin/orgs_controller.rb b/app/controllers/super_admin/orgs_controller.rb index 34c56af..014fa72 100644 --- a/app/controllers/super_admin/orgs_controller.rb +++ b/app/controllers/super_admin/orgs_controller.rb @@ -4,7 +4,7 @@ def index authorize Org - render 'index', locals: { orgs: Org.includes(:templates, :users).all.order(name: :desc) } + render 'index', locals: { orgs: Org.includes(:templates, :users).joins(:templates, :users).order('orgs.name') } end def new diff --git a/app/models/org.rb b/app/models/org.rb index a013eff..c5e5e63 100644 --- a/app/models/org.rb +++ b/app/models/org.rb @@ -4,10 +4,6 @@ extend Dragonfly::Model::Validations validates_with OrgLinksValidator - ## - # Sort order: Name ASC - default_scope { order(name: :asc) } - # Stores links as an JSON object: { org: [{"link":"www.example.com","text":"foo"}, ...] } # The links are validated against custom validator allocated at validators/template_links_validator.rb serialize :links, JSON diff --git a/app/views/paginable/orgs/_index.html.erb b/app/views/paginable/orgs/_index.html.erb index 4fd10e6..7dd18b6 100644 --- a/app/views/paginable/orgs/_index.html.erb +++ b/app/views/paginable/orgs/_index.html.erb @@ -5,7 +5,7 @@ <%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %> <%= _('Administrator Email') %> <%= paginable_sort_link('orgs.contact_email') %> <%= _('Organisation Type(s)') %> <%= paginable_sort_link('orgs.org_type') %> - <%= _('Templates') %> <%= paginable_sort_link('orgs.updated_at') %> + <%= _('Templates') %> <%= _('Actions') %>