From 2664d330542159b51b34789c550d4bd13e2615ee Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Fri, 20 Dec 2024 17:16:04 +0500 Subject: [PATCH] init args --- src/ol_openedx_chat/block.py | 2 +- src/ol_openedx_chat/static/js/ai_chat.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ol_openedx_chat/block.py b/src/ol_openedx_chat/block.py index 15d9f016..5b7b034c 100644 --- a/src/ol_openedx_chat/block.py +++ b/src/ol_openedx_chat/block.py @@ -69,7 +69,7 @@ def student_view_aside(self, block, context=None): # noqa: ARG002 fragment.add_content(render_template("static/html/student_view.html", {"block_key": self.scope_ids.usage_id.usage_key.block_id})) fragment.add_css(get_resource_bytes("static/css/ai_chat.css")) fragment.add_javascript(get_resource_bytes("static/js/ai_chat.js")) - fragment.initialize_js("AiChatAsideView") + fragment.initialize_js("AiChatAsideView", json_args={"test_arg": "test_value"}) return fragment @XBlock.handler diff --git a/src/ol_openedx_chat/static/js/ai_chat.js b/src/ol_openedx_chat/static/js/ai_chat.js index 6e42b8fb..57bbeddb 100644 --- a/src/ol_openedx_chat/static/js/ai_chat.js +++ b/src/ol_openedx_chat/static/js/ai_chat.js @@ -1,4 +1,4 @@ -function AiChatAsideView(runtime, element) { +function AiChatAsideView(runtime, element, block_element, init_args) { $('.chat-button').on('click', function () { const blockKey = $(this).data("block-key") const chatWindowSelector = '#chat-window-' + blockKey @@ -72,4 +72,5 @@ function AiChatAsideView(runtime, element) { sendMessage(); } }); + console.log(init_args) }