Add example
This commit is contained in:
parent
79578ff141
commit
2b30e08381
@ -62,6 +62,14 @@ class WebsiteConsumer(AsyncWebsocketConsumer):
|
||||
self.room_group_name, {"type": "send_page_profiles"}
|
||||
)
|
||||
|
||||
# Chat
|
||||
if data["value"] == "chat":
|
||||
await self.channel_layer.group_send(
|
||||
self.room_group_name, {
|
||||
"type": "send_page_chat",
|
||||
}
|
||||
)
|
||||
|
||||
# About
|
||||
if data["value"] == "about":
|
||||
await self.channel_layer.group_send(
|
||||
@ -104,6 +112,14 @@ class WebsiteConsumer(AsyncWebsocketConsumer):
|
||||
html = await sync_to_async(self._get_profiles)()
|
||||
await self.send(text_data=html)
|
||||
|
||||
def _get_chat(self):
|
||||
return page_chat()
|
||||
|
||||
async def send_page_chat(self, event):
|
||||
"""Send Chat page"""
|
||||
html = await sync_to_async(self._get_chat)()
|
||||
await self.send(text_data=html)
|
||||
|
||||
def _get_about(self):
|
||||
return page_about()
|
||||
|
||||
|
@ -36,6 +36,10 @@
|
||||
{# To page Profiles #}
|
||||
{% #link action="page" value="profiles" scroll-up="true" %}Profiles{% /link %}
|
||||
</li>
|
||||
<li>
|
||||
{# To page Chat #}
|
||||
{% #link action="page" value="chat" scroll-up="true" %}Chat{% /link %}
|
||||
</li>
|
||||
<li>
|
||||
{# To page About #}
|
||||
{% #link action="page" value="about" scroll-up="true" %}About{% /link %}
|
||||
|
3
app/website/templates/pages/chat.html
Normal file
3
app/website/templates/pages/chat.html
Normal file
@ -0,0 +1,3 @@
|
||||
<main id="main" data-scroll-to-top="true">
|
||||
soy el chat
|
||||
</main>
|
Loading…
Reference in New Issue
Block a user