| 1 | ActiveAdmin.register User do |
| 2 | menu priority: 2, parent: 'Users' |
| 3 | permit_params :email, :username, :name, :instagram, :youtube_channel_id, :about, :password, :password_confirmation, |
| 4 | :confirmed_at, :confirmation_sent_at |
| 5 | |
| 6 | actions :all |
| 7 | |
| 8 | index do |
| 9 | selectable_column |
| 10 | column :email |
| 11 | column :name |
| 12 | column :confirmation_sent_at |
| 13 | column :confirmed_at |
| 14 | column 'Providers' do |user| |
| 15 | if user.authorizations.count.positive? |
| 16 | user.authorizations.each_with_index do |auth, index| |
| 17 | text_node "#{auth.provider}#{', ' if index != user.authorizations.size - 1}" |
| 18 | end |
| 19 | nil |
| 20 | end |
| 21 | end |
| 22 | column :created_at |
| 23 | column :updated_at |
| 24 | actions |
| 25 | end |
| 26 | |
| 27 | filter :email |
| 28 | filter :name |
| 29 | filter :created_at |
| 30 | filter :updated_at |
| 31 | |
| 32 | show do |
| 33 | attributes_table do |
| 34 | row :email |
| 35 | row :username |
| 36 | row :name |
| 37 | row :instagram |
| 38 | row :youtube_channel_id |
| 39 | row :about |
| 40 | row :created_at |
| 41 | row :updated_at |
| 42 | end |
| 43 | end |
| 44 | |
| 45 | form do |f| |
| 46 | f.inputs do |
| 47 | f.input :email |
| 48 | f.input :username |
| 49 | f.input :name |
| 50 | f.input :instagram |
| 51 | f.input :youtube_channel_id |
| 52 | f.input :about |
| 53 | f.input :confirmation_sent_at |
| 54 | f.input :confirmed_at |
| 55 | f.input :password |
| 56 | f.input :password_confirmation |
| 57 | end |
| 58 | f.actions |
| 59 | end |
| 60 | end |