Better orga admin

This commit is contained in:
echarp 2019-04-26 18:46:38 +02:00
parent 1675840d8b
commit 4307d2b7e2
2 changed files with 7 additions and 3 deletions

View File

@ -1,18 +1,21 @@
ActiveAdmin.register Orga do
permit_params :active, :kind_id, :name, :description, :url, :city, :region_id
scope :all, default: true
scope :moderated
scope :all
scope :active, default: true
scope :inactive
scope :unmoderated
config.sort_order = 'updated_at_desc'
filter :active, as: :radio
filter :kind, as: :check_boxes
filter :name
filter :region
index do
column :id do |orga|
link_to orga.id, orga
end
column :kind
column :name
column :city

View File

@ -22,6 +22,7 @@ class Orga < ApplicationRecord
after_validation :geocode
scope :active, ->(value = true) { where active: value }
scope :inactive, ->(value = false) { where active: value }
scope :moderated, -> { where moderated: true }
scope :unmoderated, -> { where moderated: false }