Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom footer #153

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions pywebio/platform/tpl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@


<footer class="footer">
{% if footer_content %}
{% raw footer_content %}
{% else %}
Powered by <a href="https://www.pyweb.io/" target="_blank">PyWebIO</a>
{% end %}
</footer>

<script src="{{ base_url }}js/mustache.min.js"></script> <!--template system-->
Expand Down
22 changes: 21 additions & 1 deletion pywebio/platform/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def render_page(app, protocol, cdn):

return _index_page_tpl.generate(title=meta.title or 'PyWebIO Application',
description=meta.description, protocol=protocol,
script=True, content='', base_url=cdn, bootstrap_css=bootstrap_css)
script=True, content='',
footer_content=getattr(app, '_pywebio_footer', None),
base_url=cdn, bootstrap_css=bootstrap_css)


def bootstrap_css_url():
Expand Down Expand Up @@ -314,3 +316,21 @@ def decorator(func):
return func

return decorator

def footer(footer_html):
"""Set Custom footer information

:param str footer_html: Html that should be in footer


@footer("PyWebIO <b>2021</b>")
def foo():
pass

"""
def decorator(func):
func._pywebio_footer = footer_html
return func

return decorator