Active Admin is a Ruby on Rails plugin for generating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort.
Active admin custom page
add gem ‘activeadmin’ to Gemfile
[code languade=”ruby”]
ActiveAdmin.register Communication do
menu parent: "Message Management"
permit_params :sender_id, :receiver_id, :created_at, :updated_at
config.batch_actions = false
config.clear_action_items!
filter :sender_id , :as => :select, :collection => User.all.map{|s| [s.username, s.id]}
index do
selectable_column
column :sender_id do |communication|
User.where(id: communication.try(:sender_id)).first.try(:username)
end
column :receiver_id do |communication|
User.where(id: communication.try(:receiver_id)).first.try(:username)
end
column :updated_at
column :Chat do |communication|
link_to ‘Show chat’, user_communication_path(communication), style: ‘color: #fff;’
end
end
show do
@admin = Store.where(username: ‘[email protected]’).first
panel "Communication" do
render partial: ‘chats’, locals: { communication: communication }
end
end
end
[/code]