ExAdmin v0.7.4 ExAdmin.Show
Override the default show page for an ExAdmin resource.
By default, ExAdmin renders the show page without any additional configuration. It renders each column in the model, except the id, inserted_at, and updated_at columns in an attributes table.
To customize the show page, use the show
macro.
Examples
register_resource Survey.Seating do
show seating do
attributes_table do
row :id
row :name
row :image, [image: true, height: 100], &(ExAdminDemo.Image.url({&1.image, &1}, :thumb))
end
panel "Answers" do
table_for(seating.answers) do
column "Question", fn(answer) ->
"#{answer.question.name}"
end
column "Answer", fn(answer) ->
"#{answer.choice.name}"
end
end
end
end
Summary
Macros
Display a table of the model’s attributes
Display a table of a specific model’s attributes
Add a markup block to a form
Adds a new panel to the show page
Customize the show page
Add a table for a :has_many
association
Macros
Display a table of the model’s attributes.
When called with a block, the rows specified in the block will be displayed.
When called without a block, the default attributes table will be displayed.
Display a table of a specific model’s attributes.
When called with a block, the rows specified in the block will be displayed.
When called without a block, the default attributes table will be displayed.
Add a markup block to a form.
Allows the use of the Xain markup to be used in a panel.
Examples
show user do
attributes_table
panel "Testing" do
markup_contents do
div ".my-class" do
test "Tesing"
end
end
end
Adds a new panel to the show page.
The block given must include one of two commands:
table_for
- Displays a table for a:has_many
association.contents
- Add HTML to a panel
Add a table for a :has_many
association.
Examples
show account do
attributes_table do
row :username
row :email
row :contact
end
panel "Inventory" do
table_for account.inventory do
column "Asset", &__MODULE__.inventory_name/1
column "PO", &(&1.sales_order.po)
column :quantity
end
end
end