class ActiveAdmin::Views::Columns
than 100px.
Now the first column will not grow bigger than 200px and will not shrink smaller
end
end
span “Column # 2
column do
end
span ”Column # 1
column :max_width => “200px”, :min_width => “100px” do
colums do
To overcome this, columns include a :max_width and :min_width option.
to shrink or expand past a certain point.
using percentages. Sometimes this can cause issues if you don’t want a column
Active Admin is a fluid width layout, which means that columns are all defined
== Max and Mix Column Sizes
the first being 2 time bigger than the second.
By default, each column spans 1 column. So the above layout would have 2 columns,
end
end
span “Column # 2
column do
end
span ”Column # 1
column :span => 2 do
colums do
To make a column span multiple, pass the :span option to the column method:
== Multiple Span Columns
end
end
span “Column # 2
column do
end
span ”Column # 1
column do
colums do
To createa a two column layout:
#column method to create a new column.
To display columns, use the #columns method. Within the block, call the
== Simple Columns
take care of the rest.
you need to do is define the number of columns and the component will
The Columns component allows you draw content into scalable columns. All
= Columns Component
def add_child(*)
def add_child(*) super calculate_columns! end
def calculate_columns!
def calculate_columns! span_count = columns_span_count columns_count = children.size all_margins_width = margin_size * (span_count - 1) column_width = (100.00 - all_margins_width) / span_count children.each_with_index do |col, i| is_last_column = i == (columns_count - 1) col.set_column_styles(column_width, margin_size, is_last_column) end end
def closing_tag
def closing_tag "<div style=\"clear:both;\"></div>" + super end
def column(*args, &block)
def column(*args, &block) insert_tag Column, *args, &block end
def columns_span_count
def columns_span_count count = 0 children.each {|column| count += column.span_size } count end
def margin_size
def margin_size 2 end