Skip to content

Commit

Permalink
init args
Browse files Browse the repository at this point in the history
  • Loading branch information
asadali145 committed Dec 20, 2024
1 parent 9190d9c commit 2664d33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ol_openedx_chat/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/ol_openedx_chat/static/js/ai_chat.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -72,4 +72,5 @@ function AiChatAsideView(runtime, element) {
sendMessage();
}
});
console.log(init_args)
}

0 comments on commit 2664d33

Please sign in to comment.