Admin App Layout
App Template including a top navbar and sidebar and reactive toasts.
Docs in progress. Please review the examples

Examples

Example 1: Usage with sidebar

1
class Dummy::Layout < Matestack::Ui::Bootstrap::Layouts::AdminTemplate
2
3
def sidebar_top_partial
4
div class: "text-center" do
5
transition path: root_path, delay: 300 do
6
heading size: 4, text: "Your Rails Backend"
7
end
8
end
9
div class: "text-center my-5" do
10
bs_avatar img_path: asset_pack_url('media/images/avatar-placeholder.png')
11
div class: "mt-3" do
12
plain current_admin.email
13
end
14
action sign_out_config do
15
bs_btn variant: :link, size: :sm, class: "text-muted" do
16
bs_icon name: "box-arrow-in-right", size: 25
17
end
18
end
19
end
20
end
21
22
def sidebar_navigation_items
23
[
24
{ type: :transition, path: dummy_dashboard_path, text: "Dashboard", icon: "columns-gap" },
25
{ type: :transition, path: dummy_customers_path, text: "Customers", icon: "people-fill" },
26
{ type: :transition, path: dummy_orders_path, text: "Orders", icon: "cart-check-fill"},
27
{ type: :transition, path: dummy_products_path, text: "Products", icon: "box" }
28
]
29
end
30
31
# not working right now, please use sidebar only
32
# def navbar_items
33
# [
34
# { type: :transition, path: dummy_shared_implementation_path, text: "Shared Implementation"}
35
# ]
36
# end
37
38
# not working right now, please use sidebar only
39
# def navbar_end_partial
40
# action sign_out_config do
41
# btn variant: :link, size: :lg, class: "text-muted" do
42
# bs_icon name: "box-arrow-in-right", size: 25
43
# end
44
# end
45
# end
46
47
def sign_out_config
48
{
49
method: :get,
50
path: destroy_admin_session_path,
51
success: {
52
redirect: {
53
follow_response: true
54
}
55
}
56
}
57
end
58
59
def toasts
60
[
61
{ show_on: "failure", class: "bg-danger text-white", body: "{{ vc.eventData.message }}".html_safe },
62
{ show_on: "success", class: "bg-primary text-white", body: "Performed successfully" },
63
]
64
end
65
66
end
Copied!
Last modified 26d ago