thingspeak/app/admin/user.rb

49 lines
1.0 KiB
Ruby
Raw Permalink Normal View History

2014-03-22 18:21:45 +01:00
ActiveAdmin.register User do
require 'csv'
filter :email
filter :login
filter :created_at
permit_params :email, :login, :bio, :website
index do
column :id
column :email
column :login
column :created_at
2014-10-06 17:42:02 +02:00
actions
2014-03-22 18:21:45 +01:00
end
show do
attributes_table do
rows :id, :email, :login, :time_zone, :bio, :website, :created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip
end
panel 'Channels' do
table_for user.channels do
column :id
column(:name) { |channel| link_to channel.name, channel }
end
end
end
form do |f|
f.semantic_errors *f.object.errors.keys
f.inputs :email, :login
f.actions
end
# custom action for signups per day
collection_action :signups, :method => :get, :format => :csv do
@csv_headers = [:day, :signups]
@days = User.signups_per_day
end
# custom action for emails list
collection_action :emails, :method => :get do
@users = User.all
end
end