Browse Source

Better orga admin

remotes/origin/master
echarp 3 years ago
parent
commit
4307d2b7e2
  1. 9
      app/admin/orga.rb
  2. 1
      app/models/orga.rb

9
app/admin/orga.rb

@ -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

1
app/models/orga.rb

@ -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 }

Loading…
Cancel
Save