Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails ActiveAdmin index formatting numbers

I'd like to have my numbers right aligned and with a thousands separator. Can someone point me in the right direction?

ActiveAdmin.register Thing do
  index do
    column :id
    column :amount  #  need to make this fomatted nicely

    default_actions
 end
end
like image 878
Robert Brown Avatar asked Apr 01 '12 05:04

Robert Brown


1 Answers

You can pass a block to the column.

column :amount do |thing|
  div :class => "amount" do
    number_to_currency thing.amount
  end
end 

css

.amount {
  text-align :right;
}

This railscast goes through some pretty good info too http://railscasts.com/episodes/284-active-admin?view=asciicast

like image 127
Scott Avatar answered Sep 17 '22 23:09

Scott