> For the complete documentation index, see [llms.txt](https://docs.matestack.io/matestack-ui-bootstrap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.matestack.io/matestack-ui-bootstrap/2.1/api/templates/apps/admin.md).

# Admin App Template

App Template including a top navbar and sidebar and reactive toasts.

Docs in progress. Please review the examples

## Examples

### Example 1: Usage with sidebar

```ruby
class Dummy::App < Matestack::Ui::Bootstrap::Apps::AdminTemplate

  def sidebar_top_partial
    div class: "text-center" do
      transition path: root_path, delay: 300 do
        heading size: 4, text: "Your Rails Backend"
      end
    end
    div class: "text-center my-5" do
      bs_avatar img_path: asset_pack_url('media/images/avatar-placeholder.png')
      div class: "mt-3" do
        plain current_admin.email
      end
      action sign_out_config do
        bs_btn variant: :link, size: :sm, class: "text-muted" do
          bs_icon name: "box-arrow-in-right", size: 25
        end
      end
    end
  end

  def sidebar_navigation_items
    [
      { type: :transition, path: dummy_dashboard_path, text: "Dashboard", icon: "columns-gap" },
      { type: :transition, path: dummy_customers_path, text: "Customers", icon: "people-fill" },
      { type: :transition, path: dummy_orders_path, text: "Orders", icon: "cart-check-fill"},
      { type: :transition, path: dummy_products_path, text: "Products", icon: "box" }
    ]
  end

  # not working right now, please use sidebar only
  # def navbar_items
  #   [
  #     { type: :transition, path: dummy_shared_implementation_path, text: "Shared Implementation"}
  #   ]
  # end

  # not working right now, please use sidebar only
  # def navbar_end_partial
  #   action sign_out_config do
  #     btn variant: :link, size: :lg, class: "text-muted" do
  #       bs_icon name: "box-arrow-in-right", size: 25
  #     end
  #   end
  # end

  def sign_out_config
    {
       method: :get,
       path: destroy_admin_session_path,
       success: {
         redirect: {
           follow_response: true
         }
       }
    }
  end

  def toasts
    [
      { show_on: "failure", class: "bg-danger text-white", body: "{{ eventData.message }}".html_safe },
      { show_on: "success", class: "bg-primary text-white", body: "Performed successfully" },
    ]
  end

end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.matestack.io/matestack-ui-bootstrap/2.1/api/templates/apps/admin.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
