Skip to content

Instantly share code, notes, and snippets.

@wtpayne
Created January 9, 2021 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtpayne/f7cc02bd56f0e65f11fb4b76b80a0cad to your computer and use it in GitHub Desktop.
Save wtpayne/f7cc02bd56f0e65f11fb4b76b80a0cad to your computer and use it in GitHub Desktop.
# -----------------------------------------------------------------------------
def _get_page(title, id_topic, list_id_ui):
"""
Return the HTML page.
"""
html = xact.lib.ui.web.markup.html
page = html.document(title = title)
with page.head:
html.meta(charset = 'utf-8')
html.meta(name = 'viewport',
content = 'width=device-width, initial-scale=1.0')
html.link(rel = 'stylesheet',
href = ('https://unpkg.com/tailwindcss'
'@^2/dist/tailwind.min.css'))
html.script(type = 'text/javascript',
src = '/htmx')
html.script(type = 'text/javascript',
src = '/xact_htmx_extension')
with page:
connect = 'connect:/{id_topic}'.format(id_topic = id_topic)
with html.div(data_hx_sse = connect,
_class = ('bg-gray-100', 'h-screen')) as parent:
for id_ui in list_id_ui:
html.div(data_hx_ext = 'xact',
data_hx_sse = 'swap:{id}'.format(id = id_ui),
data_hx_trigger = 'load',
data_hx_get = '/{id}'.format(id = id_ui))
return page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment