Skip to content

Latest commit

 

History

History
98 lines (79 loc) · 1.76 KB

list.md

File metadata and controls

98 lines (79 loc) · 1.76 KB

List

list_[row|column] takes as first param an attribute (or method) that must return an Array or Hash. For example:

resource.skills
#=> ["Animation", "Branding", "Creative Director"]
resource.contact
#=> { "twitter" => "goku84", "facebook" => "kamehouse" }

List Row

show do
  attributes_table do
    list_row :skills, list_type: :ol
    list_row :contact, localize: true
  end
end

List Column

index do
  list_column :skills
  list_column :contact
end

Options

  • localize: allows you to translate array values or hash keys using the following structure:
[languaje]:
  addons_list:
    [model_name]:
      [method]:
        key1: value1
        key2: value2
es:
  addons_list:
    resource:
      contact:
        twitter: TwiTTer
        facebook: Face
  • list_type: allows you to pick between :ul (unordered list) and :ol (ordered list) types.

Nested Lists

You can use list_row and list_column with nested data:

{
  title: "Detalle",
  categories: ["home", "investment"],
  picture: {
    path: "invoice.png",
    size: "5MB",
    geo: {
      lat: 12.34343,
      lng: 34.4343
    }
  }
}

When working with nested lists, the locales must be defined in the following way:

es:
  addons_list:
    invoice:
      details:
        title: Título
        categories: Categorías
        categories_home: Hogar
        categories_investment: Inversión
        picture: Foto
        picture_path: Path
        picture_size: Tamaño
        picture_geo: Geo
        picture_geo_lat: Latitud
        picture_geo_lng: Longitud