6

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

3 Answers 3

13

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

5

Alternately:

column :amount, :class => 'text-right' do |thing|
  number_to_currency thing.amount
end

then in your CSS

.text-right { text-align: right;}
1

you can use Active Admin Addons gem to improve the UI

https://github.com/platanus/activeadmin_addons/blob/master/docs/number-formatting.md

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.