PhxAdmin v0.9.1 PhxAdmin.Page

Define pages in PhxAdmin that don’t render models, like a dashboard page.

Summary

Macros

Define a column

Start one or more columns

Display contents on a page. Use Xain markup to create the page

Macros

column(list)

Define a column.

columns(list)

Start one or more columns.

content(opts \\ [], list)

Display contents on a page. Use Xain markup to create the page.

Examples

register_page "Dashboard" do
  menu priority: 1, label: "Dashboard"
  content do
    columns do
      column do
        panel "Recent Orders" do
          Repo.all Order.complete(5)
          |> table_for do
            column "State", fn(o) -> status_tag Order.state(o) end
            column "Customer", fn(o) ->
              a o.user.email, href: "/admin/users/#{o.user.id}"
            end
            column "Total", fn(o) -> text decimal_to_currency(o.total_price) end
          end
        end
      end
      column do
        panel "Recent Customers" do
          order_by(User, desc: :id)
          |> limit(5)
          |> Repo.all
          |> table_for do
            column "email", fn(c) -> a c.email, href: "/admin/users/#{c.id}" end
          end
        end
      end
    end
  end
end