2024-02-09 16:59:00 +07:00
|
|
|
# CostaPy Template - Black Dashboard
|
|
|
|
Dashboard template from [Creative Tim](https://www.creative-tim.com/product/black-dashboard#) that has been designed for CostaPy
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
- Put the folder in your templates directory
|
|
|
|
- Add to handler
|
|
|
|
|
|
|
|
import templates.blackdashboard.main as blackdashboard
|
|
|
|
|
|
|
|
kwargs["mako"] = {
|
|
|
|
"website" : blackdashboard.main(directory.page["public"], "dashboard") # page_directory, file_name
|
|
|
|
}
|
|
|
|
|
|
|
|
- Define a necessary variable on your modules function
|
|
|
|
|
|
|
|
title = "CostaPy"
|
|
|
|
baseurl = "http://localhost"
|
|
|
|
|
|
|
|
logout = "http://localhost/logout"
|
|
|
|
|
|
|
|
color = "blue" # blue | green | orange | red
|
|
|
|
logo = "http://localhost/logo.png"
|
2024-02-20 16:49:42 +07:00
|
|
|
roles = [2] # A roles that user have
|
2024-02-09 16:59:00 +07:00
|
|
|
active_page = "Dashboard" # Current active page name
|
|
|
|
|
|
|
|
copyright = "Dita Aji Pratama" # Copyright on the footer
|
|
|
|
|
|
|
|
- Config a navbar menu on your modules function
|
|
|
|
|
|
|
|
navbar_menu = [
|
|
|
|
{
|
2024-02-20 16:49:42 +07:00
|
|
|
"icon" :"tim-icons icon-bell-55",
|
|
|
|
"name" :"Notifications",
|
|
|
|
"list" :[
|
|
|
|
{
|
|
|
|
"name" :"See all notifications",
|
|
|
|
"href" :"#"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"notification":False
|
2024-02-09 16:59:00 +07:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2024-02-20 16:49:42 +07:00
|
|
|
- Config a profile on your modules function
|
|
|
|
|
|
|
|
data_profile = {
|
|
|
|
"picture" : "http://localhost/profile/1.jpg",
|
|
|
|
"name" : "John Smith",
|
|
|
|
"menu" : [
|
|
|
|
{
|
|
|
|
"name" :"Profile",
|
|
|
|
"href" :"/profile"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name" :"Setting",
|
|
|
|
"href" :"/setting"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2024-02-09 16:59:00 +07:00
|
|
|
|
|
|
|
- Config a sidebar menu on your modules function
|
|
|
|
|
|
|
|
sidebar_menu = [
|
|
|
|
{
|
|
|
|
"icon" :"fa fa-home",
|
|
|
|
"name" :"Dashboard",
|
|
|
|
"href" :"/",
|
2024-02-20 16:49:42 +07:00
|
|
|
"roles" :[1,2]
|
2024-02-09 16:59:00 +07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"icon" :"fa fa-users",
|
|
|
|
"name" :"Users",
|
|
|
|
"href" :"/users",
|
2024-02-20 16:49:42 +07:00
|
|
|
"roles" :[1]
|
2024-02-09 16:59:00 +07:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
- Config a footer menu on your modules function
|
|
|
|
|
|
|
|
footer_menu = [
|
|
|
|
{
|
|
|
|
"name" :"CostaPy Website",
|
|
|
|
"href" :"https://costapy.ditaajipratama.com"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
- Set a template on your modules function
|
|
|
|
|
|
|
|
from mako.template import Template
|
|
|
|
|
|
|
|
interface = Template(params["mako"]["website"]['template']).render(
|
|
|
|
title = title,
|
|
|
|
baseurl = baseurl,
|
|
|
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
|
|
|
title = title,
|
|
|
|
menu = navbar_menu,
|
2024-02-20 16:49:42 +07:00
|
|
|
profile = data_profile,
|
2024-02-09 16:59:00 +07:00
|
|
|
logout = logout
|
|
|
|
),
|
|
|
|
sidebar = Template(params["mako"]["website"]['sidebar']).render(
|
|
|
|
color = color,
|
|
|
|
logo = logo,
|
|
|
|
title = title,
|
2024-02-20 16:49:42 +07:00
|
|
|
roles = roles,
|
2024-02-09 16:59:00 +07:00
|
|
|
active_page = active_page,
|
|
|
|
menu = sidebar_menu
|
|
|
|
),
|
|
|
|
footer = Template(params["mako"]["website"]['footer']).render(
|
|
|
|
copyright = copyright,
|
|
|
|
menu = footer_menu,
|
|
|
|
),
|
|
|
|
container = Template(params["mako"]["website"]['container']).render(
|
|
|
|
# your container content here
|
|
|
|
)
|
|
|
|
)
|