Created
September 25, 2015 23:50
-
-
Save iGallina/726018beafead1c964d0 to your computer and use it in GitHub Desktop.
ActiveAdmin example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register User do | |
index do | |
column "Nome", :name | |
column "CPF", :cpf | |
column "Login", :login | |
column "Setor no MC", :sector_mc | |
column "Login da Anatel", :anatel_status do | |
status_tag 'ATIVO' | |
end | |
column "Expiração(login)", :expiration_date do |user| | |
raw format_date_br(user.expiration_date) | |
end | |
column "Permissões", :permissions | |
column "Permissões detalhadas", :permission_details | |
column "Última atualização", :updated_at do |user| | |
raw format_date_br(user.expiration_date) | |
end | |
end | |
menu label: "Acessos Anatel" | |
ActiveAdmin.setup do |config| | |
config.comments = false | |
config.site_title = "Acessos Anatel" | |
end | |
scope("Todos") { User.all } | |
scope("Sem Login") { |scope| scope.where(login: "") } | |
scope("Sem Permissões") { |scope| scope.where(permissions: "") } | |
filter :name, label: "Nome" | |
filter :cpf, label: "CPF" | |
filter :permissions, label: "Acessos" | |
filter :permission_details, label: "Acessos Detalhes" | |
config.paginate = false | |
index download_links: [:csv, :xml] | |
config.sort_order = 'id_asc' | |
end | |
def format_date_br(datetime) | |
datetime.strftime("%d/%m/%Y") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment