samedi 1 novembre 2014

activeadmin dashboard doesnot show a logout button


Vote count:

0




hi I am using active admin gem in my project


I cannot see logout link on active admin dashboard.


I have only one table for all users that is users table


routes.rb



Rails.application.routes.draw do

ActiveAdmin.routes(self)
devise_for :users, controllers: { sessions: 'sessions' , :registrations => "registrations" }
namespace :api do
namespace :v1 do
resources :users
end
end

resources :users
devise_scope :user do
match '/users/sign_in', to: 'sessions#create', via: :post
#registration seems to much cooler for authenticable and other stuff
#match 'api/v1/users' , to: 'registrations#create' , via: :post
end

end


in /admin/dashboard



ActiveAdmin.register_page "Dashboard" do

menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }

content title: proc{ I18n.t("active_admin.dashboard") } do
div class: "blank_slate_container", id: "dashboard_default_message" do
span class: "blank_slate" do
span I18n.t("active_admin.dashboard_welcome.welcome")
small I18n.t("active_admin.dashboard_welcome.call_to_action")
end
end
end # content
end


and this how my admin/users look like



ActiveAdmin.register User do
#permit_params :email , :role_ids ,:password
permit_params :email , :password ,:role_ids => []

form do |f|
f.inputs "Users" do
f.input :email
f.input :password
f.input :roles, as: :select, multiple: false, collection: Role.all

end
f.actions

end

show do
attributes_table do
row :email
row :encrypted_password
row :reset_password_token
row :reset_password_sent_at
row :remember_created_at
row :sign_in_count
row :current_sign_in_at
row :last_sign_in_at
row :current_sign_in_ip
row :last_sign_in_ip
row :created_at
row :updated_at
row :authentication_token
row :roles do | user |
user.roles.first.name unless user.roles.blank?
end
end
end

index do
column :email
#column :encrypted_password
#column :reset_password_token
#column :reset_password_sent_at
column :remember_created_at
column :sign_in_count
column :current_sign_in_at
column :last_sign_in_at
#column :current_sign_in_ip
#column :last_sign_in_ip
column :created_at
column :updated_at
#column :authentication_token
column :roles do | user |
user.roles.first.name unless user.roles.blank?
end
actions
end
controller do
def create
@user = User.new(user_params)
binding.pry

add_roles(@user)
create!
end

def update
add_roles(resource)
update!(user_params)
end

private
def add_roles(resource)
resource.roles = []
params[:user][:role_ids].each {
|r| resource.add_role(Role.find(r).name.downcase!) unless r.blank?
}
end
def user_params
params.require(:user).permit(:email, :password, :role_ids => [])
end
end
end


asked 1 min ago

Rigel

311






activeadmin dashboard doesnot show a logout button

Aucun commentaire:

Enregistrer un commentaire