authsquare/app/templates/prime
2024-09-26 21:48:35 +07:00
..
html Giving a margin between icon and name on the sidebar menu 2024-09-26 21:48:35 +07:00
static Fixing incorrect footer position when toggling sidebar drawer 2024-09-26 19:40:57 +07:00
LICENSE Add prime template for dashboard 2024-09-26 12:25:27 +07:00
main.py Add prime template for dashboard 2024-09-26 12:25:27 +07:00
README.md Add prime template for dashboard 2024-09-26 12:25:27 +07:00

CostaPy Template - Prime

A prime dashboard based on bootstrap 5

Usage

  • Put the folder in your templates directory

  • Add to handler

    import templates.prime.main as template_dashboard
    
    params["mako"] = {
        "website" : template_dashboard.main(directory.page["dashboard"], "users")
    }
    
  • Define a necessary variable on your modules

    title       = "CostaPy"
    
    user_roles  = [1,2]    # A roles that user have
    active_page = "Users"  # Current active page name
    
    copyright   = "Copyright (C) 2022 Dita Aji Pratama"
    greeting    = "Hello world"
    
  • Define a navbar menu on your modules

    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]
        }
    ]
    
  • Define a profile menu on your modules

    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]
            }
        ]
    }
    
  • Define a sidebar menu on your modules

    menu_sidebar = [
        {
            "name":"Dashboard",
            "target":"_self",
            "href":"#",
            "roles":[1,2]
        },
        {
            "name":"Users",
            "target":"_self",
            "href":"#",
            "roles":[1,2]
        },
        {
            "name":"Items",
            "target":"_self",
            "href":"#",
            "roles":[1,2]
        },
        {
            "name":"Analytic",
            "target":"_self",
            "href":"#",
            "roles":[1,2]
        },
        {
            "name":"Reports",
            "target":"_self",
            "href":"#",
            "roles":[1,2]
        }
    ]
    
  • Set a template on your modules

    return Template(params["mako"]["website"]['index']).render(
        title     = title,
        navbar    = Template(params["mako"]["website"]['navbar']).render(
            title       = title,
            menu        = menu_navbar,
            profile     = menu_profile,
            user_roles  = user_roles,
            active_page = active_page
        ),
        sidebar   = Template(params["mako"]["website"]['sidebar']).render(
            menu        = menu_sidebar,
            user_roles  = user_roles,
            active_page = active_page
        ),
        footer    = Template(params["mako"]["website"]['footer']).render(
            copyright   = copyright,
        ),
        container = Template(params["mako"]["website"]['container']).render(
            greeting    = greeting
        )
    )
    

License

MIT License

Copyright (c) 2024 Dita Aji Pratama

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.