     put_layout(conn, "#{conn.assigns.theme.name}.html")
   end
 
-  def index(conn, params) do
+  def index(%{assigns: %{xhr: false}} = conn, params) do
     defn = get_registered_by_controller_route!(params[:resource], conn)
     {contents, page, scope_counts} = case defn do
       %{type: :page} = defn ->

    assign(conn, :scope_counts, scope_counts)
    |> render("admin.html", html: contents, defn: defn, resource: page,
      filters: (if false in defn.index_filters, do: false, else: defn.index_filters))
  end

  def show(conn, params) do

  end

  def action(%{private: %{phoenix_action: action}} = conn, _options) do
    conn = conn |> assign(:xhr, get_req_header(conn, "x-requested-with") == ["XMLHttpRequest"])
    handle_action(conn, action, conn.params["resource"])
  end

