Sha256: 049c68ca381b5bc5f43c484ad82057c349a3b642ee7652564691e7818a798790

Contents?: true

Size: 1.53 KB

Versions: 12

Compression:

Stored size: 1.53 KB

Contents

ActiveAdmin.register Identity.user_class, as: "Users" do
  permit_params :email, :password, :password_confirmation

  filter :email
  filter :active
  filter :current_sign_in_at
  filter :created_at

  scope :all
  scope :active, default: true

  index do
    selectable_column
    id_column
    column :active
    column :email
    if Devise.mappings[:user].confirmable?
      column :confirmed do |user|
        status_tag user.confirmed_at ? 'yes' : 'no'
      end
    end
    if Devise.mappings[:user].trackable?
      column :current_sign_in_ip
      column :current_sign_in_at
    end
    column :created_at
    column :updated_at
    actions
  end

  show do
    attributes_table do
      row :active do |user|
        status_tag user.active? ? 'yes' : 'no'
      end
      row :email
      if Devise.mappings[:user].trackable?
        row :sign_in_count
        row :current_sign_in_ip
        row :current_sign_in_at
        row :last_sign_in_ip
        row :last_sign_in_at
      end

      if Devise.mappings[:user].confirmable?
        row :confirmed_at
      end

      row :created_at
      row :updated_at
    end
  end

  form do |f|
    inputs 'Basic' do
      input :email
      input :password
      input :password_confirmation
    end
    f.actions
  end

  controller do
    def update
      if params[:identity_user][:password].blank? && params[:identity_user][:password_confirmation].blank?
        params[:identity_user].delete("password")
        params[:identity_user].delete("password_confirmation")
      end
      super
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
anadea-identity-0.5.4 lib/identity/admin/user.rb
anadea-identity-0.5.3 lib/identity/admin/user.rb
anadea-identity-0.5.2 lib/identity/admin/user.rb
anadea-identity-0.5.1 lib/identity/admin/user.rb
anadea-identity-0.5.0 lib/identity/admin/user.rb
anadea-identity-0.4.2 lib/identity/admin/user.rb
anadea-identity-0.4.1 lib/identity/admin/user.rb
anadea-identity-0.4.0 lib/identity/admin/user.rb
anadea-identity-0.3.3 lib/identity/admin/user.rb
anadea-identity-0.3.2 lib/identity/admin/user.rb
anadea-identity-0.3.1 lib/identity/admin/user.rb
anadea-identity-0.3.0 lib/identity/admin/user.rb