Sha256: de1a0c678d20a66a7de68fa7cd01d71b33ad2daad53c78b4596961d4ce72e0f1

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

class Chatty::ActiveAdminIntegrator
  def self.integrate!
    ActiveAdmin.register Chatty::Chat do
      index do
        selectable_column
        id_column
        column :user
        column :resource
        column :state
        column :created_at
        actions
      end

      show do
        attributes_table do
          row :id
          row :user
          row :resource
          row :state
          row :created_at
          row :updated_at
        end

        panel Chatty::Message.model_name.human(count: 2) do
          table do
            thead do
              tr do
                th Chatty::Message.human_attribute_name(:id)
                th Chatty::Message.human_attribute_name(:user)
                th Chatty::Message.human_attribute_name(:message)
                th Chatty::Message.human_attribute_name(:created_at)
              end
            end
            tbody do
              resource.messages.each do |message|
                tr do
                  td message.id
                  td message.user.name
                  td message.message
                  td message.created_at
                end
              end
            end
          end
        end

        active_admin_comments
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chatty-0.0.6 lib/chatty/active_admin_integrator.rb
chatty-0.0.5 lib/chatty/active_admin_integrator.rb