Update the guide on the sample
This commit is contained in:
parent
7ad3f98471
commit
3189bad447
@ -6,156 +6,150 @@
|
|||||||
<li><p>Put the folder in your <code>templates</code> directory</p></li>
|
<li><p>Put the folder in your <code>templates</code> directory</p></li>
|
||||||
<li>
|
<li>
|
||||||
<p>Add to handler</p>
|
<p>Add to handler</p>
|
||||||
<code>
|
<code>
|
||||||
import templates.prime.main as template_dashboard
|
<pre>import templates.prime.main as template_dashboard
|
||||||
|
|
||||||
params["mako"] = {
|
params["mako"] = {
|
||||||
"website" : template_dashboard.main("pages/dashboard", "users")
|
"website" : template_dashboard.main("pages/dashboard", "users")
|
||||||
}
|
}</pre>
|
||||||
</code>
|
</code>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
- Define a necessary variable on your modules
|
<p>Define a necessary variable on your modules</p>
|
||||||
|
<code>
|
||||||
|
<pre>title = "CostaPy"
|
||||||
|
|
||||||
```python
|
user_roles = [1,2] # A roles that user have
|
||||||
title = "CostaPy"
|
active_page = "Users" # Current active page name
|
||||||
|
|
||||||
user_roles = [1,2] # A roles that user have
|
copyright = "Copyright (C) 2022 Dita Aji Pratama"
|
||||||
active_page = "Users" # Current active page name
|
greeting = "Hello world"</pre>
|
||||||
|
</code>
|
||||||
copyright = "Copyright (C) 2022 Dita Aji Pratama"
|
|
||||||
greeting = "Hello world"
|
|
||||||
```
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
- Define a navbar menu on your modules
|
<p>Define a navbar menu on your modules</p>
|
||||||
|
<code>
|
||||||
```python
|
<pre>menu_navbar = [
|
||||||
menu_navbar = [
|
{
|
||||||
{
|
"name":"Home",
|
||||||
"name":"Home",
|
"target":"_self",
|
||||||
"target":"_self",
|
"href":"#",
|
||||||
"href":"#",
|
"notification":0,
|
||||||
"notification":0,
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"name":"Customize",
|
||||||
"name":"Customize",
|
"href":"#",
|
||||||
"href":"#",
|
"target":"_self",
|
||||||
"target":"_self",
|
"notification":0,
|
||||||
"notification":0,
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"name":"Notification",
|
||||||
"name":"Notification",
|
"href":"#",
|
||||||
"href":"#",
|
"target":"_self",
|
||||||
"target":"_self",
|
"notification":1,
|
||||||
"notification":1,
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
}
|
||||||
}
|
]</pre>
|
||||||
]
|
</code>
|
||||||
```
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
- Define a profile menu on your modules
|
<p>Define a profile menu on your modules</p>
|
||||||
|
<code>
|
||||||
```python
|
<pre>menu_profile = {
|
||||||
menu_profile = {
|
"picture" : "https://ditaajipratama.net/img/no-profile-donut.png",
|
||||||
"picture" : "https://ditaajipratama.net/img/no-profile-donut.png",
|
"name" : "Dita Aji Pratama",
|
||||||
"name" : "Dita Aji Pratama",
|
"menu" : [
|
||||||
"menu" : [
|
{
|
||||||
{
|
"name" :"Profile",
|
||||||
"name" :"Profile",
|
"href" :"/profile",
|
||||||
"href" :"/profile",
|
"target":"_self",
|
||||||
"target":"_self",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"name" :"Settings",
|
||||||
"name" :"Settings",
|
"href" :"/settings",
|
||||||
"href" :"/settings",
|
"target":"_self",
|
||||||
"target":"_self",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"name" :"Logout",
|
||||||
"name" :"Logout",
|
"href" :"/logout",
|
||||||
"href" :"/logout",
|
"target":"_self",
|
||||||
"target":"_self",
|
"roles":[1,2,3]
|
||||||
"roles":[1,2,3]
|
}
|
||||||
}
|
]
|
||||||
]
|
}</pre>
|
||||||
}
|
</code>
|
||||||
```
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
- Define a sidebar menu on your modules
|
<p>Define a sidebar menu on your modules</p>
|
||||||
|
<code>
|
||||||
```python
|
<pre>menu_sidebar = [
|
||||||
menu_sidebar = [
|
{
|
||||||
{
|
"icon":"fa-solid fa-gauge",
|
||||||
"icon":"fa-solid fa-gauge",
|
"name":"Dashboard",
|
||||||
"name":"Dashboard",
|
"target":"_self",
|
||||||
"target":"_self",
|
"href":"#",
|
||||||
"href":"#",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"icon":"fa-solid fa-users",
|
||||||
"icon":"fa-solid fa-users",
|
"name":"Users",
|
||||||
"name":"Users",
|
"target":"_self",
|
||||||
"target":"_self",
|
"href":"#",
|
||||||
"href":"#",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"icon":"fa-solid fa-book",
|
||||||
"icon":"fa-solid fa-book",
|
"name":"Items",
|
||||||
"name":"Items",
|
"target":"_self",
|
||||||
"target":"_self",
|
"href":"#",
|
||||||
"href":"#",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"icon":"fa-solid fa-book",
|
||||||
"icon":"fa-solid fa-book",
|
"name":"Analytic",
|
||||||
"name":"Analytic",
|
"target":"_self",
|
||||||
"target":"_self",
|
"href":"#",
|
||||||
"href":"#",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
},
|
||||||
},
|
{
|
||||||
{
|
"icon":"fa-solid fa-book",
|
||||||
"icon":"fa-solid fa-book",
|
"name":"Reports",
|
||||||
"name":"Reports",
|
"target":"_self",
|
||||||
"target":"_self",
|
"href":"#",
|
||||||
"href":"#",
|
"roles":[1,2]
|
||||||
"roles":[1,2]
|
}
|
||||||
}
|
]</pre>
|
||||||
]
|
</code>
|
||||||
```
|
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
- Set a template on your modules
|
<p>Set a template on your modules</p>
|
||||||
|
<code>
|
||||||
```python
|
<pre>return Template(params["mako"]["website"]['index']).render(
|
||||||
return Template(params["mako"]["website"]['index']).render(
|
title = title,
|
||||||
title = title,
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
||||||
navbar = Template(params["mako"]["website"]['navbar']).render(
|
title = title,
|
||||||
title = title,
|
menu = menu_navbar,
|
||||||
menu = menu_navbar,
|
profile = menu_profile,
|
||||||
profile = menu_profile,
|
user_roles = user_roles,
|
||||||
user_roles = user_roles,
|
active_page = active_page
|
||||||
active_page = active_page
|
),
|
||||||
),
|
sidebar = Template(params["mako"]["website"]['sidebar']).render(
|
||||||
sidebar = Template(params["mako"]["website"]['sidebar']).render(
|
menu = menu_sidebar,
|
||||||
menu = menu_sidebar,
|
user_roles = user_roles,
|
||||||
user_roles = user_roles,
|
active_page = active_page
|
||||||
active_page = active_page
|
),
|
||||||
),
|
footer = Template(params["mako"]["website"]['footer']).render(
|
||||||
footer = Template(params["mako"]["website"]['footer']).render(
|
copyright = copyright,
|
||||||
copyright = copyright,
|
),
|
||||||
),
|
container = Template(params["mako"]["website"]['container']).render(
|
||||||
container = Template(params["mako"]["website"]['container']).render(
|
greeting = greeting
|
||||||
greeting = greeting
|
)
|
||||||
)
|
)</pre>
|
||||||
)
|
</code>
|
||||||
```
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<h2>License</h2>
|
<h2>License</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user