Rails 3- Active Admin (Formtastic), set the Width column

I am setting up an index form in active admin. I have a few columns:

column :id
column :name 

I want to set the width of these columns. Is there an easy way?

+5
source share
3 answers

The easiest way is to wait for the version of active_admin that offers the function that Greg Bell talks about at https://github.com/gregbell/active_admin/issues/63

There is currently no “easy way” to do this.

+3
source

eg:

column :name do |name|
   div :class => "name" do 
     name  
   end  
end  

then in the file app/assets/stylesheets/active_admin.css.scss:

div.name { width: 500px; }

this should work i think

+17
source

- div-. :

column :name

app/assets/stylesheets/active_admin.css.scss :

.active_admin {
  .index_as_table {
    td.name {
      max-width: 150px;
      min-width: 100px;
    }
  }
}

, :

.active_admin {
  .index_as_table {
    td {
      max-width: 150px;      
    }
  }
}

If you use other indexing renderers, just look at the source html and adjust the stylesheet of the active administrator accordingly.

+3
source

All Articles