change the default template
This commit is contained in:
parent
443a890809
commit
6e630da3cc
@ -1,24 +1,28 @@
|
|||||||
baseurl = "http://127.0.0.1:15001"
|
|
||||||
title = "CostaPy"
|
title = "CostaPy"
|
||||||
|
|
||||||
menu = {
|
menu = {
|
||||||
"public": {
|
"public": {
|
||||||
"topnav": [
|
"navbar": [
|
||||||
{
|
{
|
||||||
"name":"Home",
|
"name":"Home",
|
||||||
|
"target":"_self",
|
||||||
"href":"/",
|
"href":"/",
|
||||||
"roles":["guest"]
|
"roles":["guest"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Profile",
|
"name":"About",
|
||||||
"href":"#",
|
"target":"_self",
|
||||||
|
"href":"/about",
|
||||||
"roles":["guest"]
|
"roles":["guest"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"CostaPy Website",
|
"name":"Docs",
|
||||||
|
"target":"_blank",
|
||||||
"href":"https://costapy.ditaajipratama.net",
|
"href":"https://costapy.ditaajipratama.net",
|
||||||
"roles":["guest"]
|
"roles":["guest"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyright = "Copyright (C) 2022 Dita Aji Pratama"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
from bottle import Bottle, route
|
from bottle import Bottle, route
|
||||||
from config import directory
|
from config import directory
|
||||||
|
|
||||||
import templates.bare.main as template_public
|
import templates.plain.main as template_public
|
||||||
import modules.public.home as public_home
|
import modules.public.home as public_home
|
||||||
|
|
||||||
app = Bottle()
|
app = Bottle()
|
||||||
|
@ -7,21 +7,18 @@ class main:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def html(self, params):
|
def html(self, params):
|
||||||
return Template(params["mako"]["website"]['template']).render(
|
return Template(params["mako"]["website"]['index']).render(
|
||||||
title = globalvar.title,
|
title = globalvar.title,
|
||||||
baseurl = globalvar.baseurl,
|
header = "Welcome to CostaPy",
|
||||||
topnav = Template(params["mako"]["website"]['topnav']).render(
|
navbar = Template(params["mako"]["website"]['navbar']).render(
|
||||||
title = globalvar.title,
|
menu = globalvar.menu['public']['navbar'],
|
||||||
baseurl = globalvar.baseurl,
|
|
||||||
menu = globalvar.menu['public']['topnav'],
|
|
||||||
user_roles = ["guest"],
|
user_roles = ["guest"],
|
||||||
active_page = "Home"
|
active_page = "Home"
|
||||||
),
|
),
|
||||||
footer = Template(params["mako"]["website"]['footer']).render(
|
footer = Template(params["mako"]["website"]['footer']).render(
|
||||||
copyright = "Dita Aji Pratama",
|
copyright = globalvar.copyright,
|
||||||
),
|
),
|
||||||
container = Template(params["mako"]["website"]['container']).render(
|
container = Template(params["mako"]["website"]['container']).render(
|
||||||
baseurl = globalvar.baseurl,
|
greeting = f"Welcome to your new web application! This placeholder page is here to let you know that your web framework is successfully set up and ready to go. Now, it's time to start building your project. Dive into the documentation to explore the features and capabilities at your disposal."
|
||||||
greeting = f"Hello world, welcome to {globalvar.title}"
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1,9 +1 @@
|
|||||||
<div class="container-fluid my-3">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<h1>Welcome</h1>
|
|
||||||
<h3>This is your first pages</h3>
|
|
||||||
<p>${greeting}</p>
|
<p>${greeting}</p>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<footer class="mt-auto bg-dark text-light p-3 text-center">
|
|
||||||
© 2022 ${copyright}
|
|
||||||
</footer>
|
|
@ -1,20 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
||||||
<title>${title}</title>
|
|
||||||
<script src="${baseurl}/bare/lib/jquery/jquery-3.7.0.min.js"></script>
|
|
||||||
<link href="${baseurl}/bare/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
|
||||||
<script src="${baseurl}/bare/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<link rel="stylesheet" href="${baseurl}/bare/css/style.css">
|
|
||||||
</head>
|
|
||||||
<body class="d-flex flex-column" style="min-height:100vh;">
|
|
||||||
${topnav}
|
|
||||||
<div class="mb-5">
|
|
||||||
${container}
|
|
||||||
</div>
|
|
||||||
${footer}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,17 +0,0 @@
|
|||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
|
|
||||||
<a class="navbar-brand" href="${baseurl}">${title}</a>
|
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
||||||
<ul class="navbar-nav ml-auto">
|
|
||||||
% for item in menu:
|
|
||||||
% if any(role in item['roles'] for role in user_roles):
|
|
||||||
<li class="nav-item ${'active' if item['name'] == active_page else ''}">
|
|
||||||
<a class="nav-link" href="${item['href']}">${item['name']}</a>
|
|
||||||
</li>
|
|
||||||
% endif
|
|
||||||
% endfor
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
@ -1,20 +0,0 @@
|
|||||||
from core import html
|
|
||||||
|
|
||||||
static = [
|
|
||||||
{
|
|
||||||
"route" :"/bare/lib/<filepath:re:.*\.(css|sass|css.map|js|js.map)>",
|
|
||||||
"root" :"./templates/bare/static/lib"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
def main(dir, page):
|
|
||||||
|
|
||||||
html_template = html.main.get_html("templates/bare/html")
|
|
||||||
html_page = html.main.get_html(dir)
|
|
||||||
params_list = {
|
|
||||||
"template" : html_template ["template.html" ],
|
|
||||||
"topnav" : html_template ["topnav.html" ],
|
|
||||||
"footer" : html_template ["footer.html" ],
|
|
||||||
"container" : html_page [ page+".html" ]
|
|
||||||
}
|
|
||||||
return params_list
|
|
@ -1,22 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2011-2020 Twitter, Inc.
|
|
||||||
Copyright (c) 2011-2020 The Bootstrap Authors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
templates/plain
Submodule
1
templates/plain
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 910f395e6aee59afe942e628ac8ab3b141286c39
|
Loading…
Reference in New Issue
Block a user