From 69f994175505c9f53dd30a8d2a738cdcffe60c21 Mon Sep 17 00:00:00 2001 From: ditaajipratama Date: Mon, 17 Jun 2024 12:43:51 +0700 Subject: [PATCH] Update handler.py, home.py, home.html, and 1 more file --- app/handler.py | 26 ++++++++++++++++++++++++++ app/modules/public/home.py | 24 ++++++++++++++++++++++++ app/pages/public/home.html | 1 + app/static/css/style.css | 1 + 4 files changed, 52 insertions(+) create mode 100644 app/handler.py create mode 100644 app/modules/public/home.py create mode 100644 app/pages/public/home.html create mode 100644 app/static/css/style.css diff --git a/app/handler.py b/app/handler.py new file mode 100644 index 0000000..9930452 --- /dev/null +++ b/app/handler.py @@ -0,0 +1,26 @@ +# CostaPy +# Copyright (C) 2022 Dita Aji Pratama +# +# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/. + +from bottle import Bottle, route, request + +from config import directory + +import templates.plain.main as template_public + +import modules.public.home as public_home + +app = Bottle() + +@app.route('/') +def index(): + + params = { + "mako":{ + "website" : template_public.main(directory.page["public"], "home") + } + } + return public_home.main().html(params) diff --git a/app/modules/public/home.py b/app/modules/public/home.py new file mode 100644 index 0000000..d9554b2 --- /dev/null +++ b/app/modules/public/home.py @@ -0,0 +1,24 @@ +from mako.template import Template +from config import globalvar + +class main: + + def __init__(self): + pass + + def html(self, params): + return Template(params["mako"]["website"]['index']).render( + title = globalvar.title, + header = "Welcome to CostaPy", + navbar = Template(params["mako"]["website"]['navbar']).render( + menu = globalvar.menu['public']['navbar'], + user_roles = ["guest"], + active_page = "Home" + ), + footer = Template(params["mako"]["website"]['footer']).render( + copyright = globalvar.copyright, + ), + container = Template(params["mako"]["website"]['container']).render( + 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." + ) + ) diff --git a/app/pages/public/home.html b/app/pages/public/home.html new file mode 100644 index 0000000..ef7c1f5 --- /dev/null +++ b/app/pages/public/home.html @@ -0,0 +1 @@ +

${greeting}

diff --git a/app/static/css/style.css b/app/static/css/style.css new file mode 100644 index 0000000..ce7b74b --- /dev/null +++ b/app/static/css/style.css @@ -0,0 +1 @@ +/* your style here */