Compare commits

..

No commits in common. "9f38141492f153f6ce9cfb6d3497c564ea329a8d" and "812bd0f9971e70eb1dd48bef9b7c46c05ae0d1cf" have entirely different histories.

9 changed files with 133 additions and 135 deletions

View File

@ -1,3 +1,28 @@
title = "CostaPy"
menu = {
"public": {
"navbar": [
{
"name":"Home",
"target":"_self",
"href":"/",
"roles":["guest"]
},
{
"name":"About",
"target":"_self",
"href":"/about",
"roles":["guest"]
},
{
"name":"Docs",
"target":"_blank",
"href":"https://costapy.ditaajipratama.net",
"roles":["guest"]
}
]
}
}
copyright = "Copyright (C) 2022 Dita Aji Pratama"

View File

@ -1,111 +0,0 @@
menu = {
"public": {
"navbar": [
{
"name":"Home",
"target":"_self",
"href":"/",
"roles":["guest"]
},
{
"name":"About",
"target":"_self",
"href":"/about",
"roles":["guest"]
},
{
"name":"Docs",
"target":"_blank",
"href":"https://costapy.ditaajipratama.net",
"roles":["guest"]
}
]
}
"sample": {
"navbar": [
{
"name":"Home",
"target":"_self",
"href":"#",
"notification":0,
"roles":[1,2]
},
{
"name":"Customize",
"href":"#",
"target":"_self",
"notification":0,
"roles":[1,2]
},
{
"name":"Notification",
"href":"#",
"target":"_self",
"notification":1,
"roles":[1,2]
}
],
"profile": {
"picture": "https://ditaajipratama.net/img/no-profile-donut.png",
"name" : "User Name",
"menu" : [
{
"name" :"Profile",
"href" :"/profile",
"target":"_self",
"roles" :[1,2]
},
{
"name" :"Settings",
"href" :"/settings",
"target":"_self",
"roles" :[1,2]
},
{
"name" :"Logout",
"href" :"/logout",
"target":"_self",
"roles" :[1,2,3]
}
]
},
"sidebar": [
{
"icon":"fa-solid fa-gauge",
"name":"Dashboard",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-users",
"name":"Users",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-book",
"name":"Items",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-book",
"name":"Analytic",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-book",
"name":"Reports",
"target":"_self",
"href":"#",
"roles":[1,2]
}
]
}
}

View File

@ -1,4 +0,0 @@
image = {
"favicon" : "https://ditaajipratama.net/img/no-profile-donut.png",
"profile" : "https://ditaajipratama.net/img/no-profile-donut.png"
}

View File

@ -2,16 +2,16 @@ from bottle import response
host = "localhost"
port = 11000
reloader = True
reloader = False
debug = False
server = 'wsgiref' # try 'gunicorn'
server = 'gunicorn' # default = 'wsgiref'
session_opts = {
'session.type': 'file',
'session.cookie_expires': 5*60, # Session expiration in seconds: minutes*seconds
'session.data_dir': './.beaker/data',
'session.auto': True
} # beaker's session options
}
def enable_cors():
response.headers['Access-Control-Allow-Origin' ] = '*'

12
install.sh Normal file
View File

@ -0,0 +1,12 @@
python3 -m venv .venv # Create .venv
.venv/bin/pip3 install --upgrade pip # Upgrade pip
.venv/bin/pip3 install bottle # Micro Framework
.venv/bin/pip3 install gunicorn # WSGI Server Backend
.venv/bin/pip3 install beaker # Session & caching library
.venv/bin/pip3 install mako # Template library
.venv/bin/pip3 install mysql-connector # Database connector
.venv/bin/pip3 install bcrypt # Password hash
.venv/bin/pip3 install pyjwt[crypto] # JWT

View File

@ -1,5 +1,5 @@
from mako.template import Template
from config import globalvar, navigation
from config import globalvar
class main:
@ -11,7 +11,7 @@ class main:
title = globalvar.title,
header = "Welcome to CostaPy",
navbar = Template(params["mako"]["website"]['navbar']).render(
menu = navigation.menu['public']['navbar'],
menu = globalvar.menu['public']['navbar'],
user_roles = ["guest"],
active_page = "Home"
),

View File

@ -1,5 +1,5 @@
from mako.template import Template
from config import navigation, placeholder
from config import globalvar
class main:
@ -16,19 +16,105 @@ class main:
copyright = "Copyright (C) 2022 Dita Aji Pratama"
greeting = "A prime dashboard based on bootstrap 5"
menu_navbar = [
{
"name":"Home",
"target":"_self",
"href":"#",
"notification":0,
"roles":[1,2]
},
{
"name":"Customize",
"href":"#",
"target":"_self",
"notification":0,
"roles":[1,2]
},
{
"name":"Notification",
"href":"#",
"target":"_self",
"notification":1,
"roles":[1,2]
}
]
menu_profile = {
"picture": "https://ditaajipratama.net/img/no-profile-donut.png",
"name" : "Dita Aji Pratama",
"menu" : [
{
"name" :"Profile",
"href" :"/profile",
"target":"_self",
"roles" :[1,2]
},
{
"name" :"Settings",
"href" :"/settings",
"target":"_self",
"roles" :[1,2]
},
{
"name" :"Logout",
"href" :"/logout",
"target":"_self",
"roles" :[1,2,3]
}
]
}
menu_sidebar = [
{
"icon":"fa-solid fa-gauge",
"name":"Dashboard",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-users",
"name":"Users",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-book",
"name":"Items",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-book",
"name":"Analytic",
"target":"_self",
"href":"#",
"roles":[1,2]
},
{
"icon":"fa-solid fa-book",
"name":"Reports",
"target":"_self",
"href":"#",
"roles":[1,2]
}
]
return Template(params["mako"]["website"]['index']).render(
favicon = placeholder.image["favicon"],
title = title,
navbar = Template(params["mako"]["website"]['navbar']).render(
title = title,
home = home,
menu = navigation["sample"]["navbar"],
profile = navigation["sample"]["profile"],
menu = menu_navbar,
profile = menu_profile,
user_roles = user_roles,
active_page = active_page
),
sidebar = Template(params["mako"]["website"]['sidebar']).render(
menu = navigation["sample"]["sidebar"],
menu = menu_sidebar,
user_roles = user_roles,
active_page = active_page
),
@ -39,4 +125,3 @@ class main:
greeting = greeting
)
)

View File

@ -1,8 +0,0 @@
bottle
gunicorn
beaker
mako
mysql-connector
bcrypt
pyjwt[crypto]

View File

@ -4,7 +4,6 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${title}</title>
<link rel="icon" href="${favicon}" type="image/x-icon">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/templates/prime/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">