Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ttqureshi committed Nov 8, 2024
1 parent 62faccc commit 7046de4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion xblocks_contrib/discussion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Init for the DiscussionXBlock.
DiscussionXBlock.
"""

from .discussion import DiscussionXBlock
21 changes: 18 additions & 3 deletions xblocks_contrib/discussion/discussion.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
"""TO-DO: Write a description of what this XBlock is."""
"""
Discussion XBlock
"""

import logging
import urllib
from importlib.resources import files

from django.utils import translation
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse, translation
from django.utils.translation import get_language_bidi
from web_fragments.fragment import Fragment
from xblock.completable import XBlockCompletionMode
from xblock.core import XBlock
from xblock.fields import Integer, Scope
from xblock.fields import UNIQUE_ID, Scope, String
from xblock.utils.resources import ResourceLoader
from xblock.utils.studio_editable import StudioEditableXBlockMixin

from lms.djangoapps.discussion.django_comment_client.permissions import has_permission
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration, Provider
from openedx.core.djangolib.markup import HTML, Text
from openedx.core.lib.xblock_utils import get_css_dependencies, get_js_dependencies
from xmodule.xml_block import XmlMixin


resource_loader = ResourceLoader(__name__)

Expand Down
18 changes: 18 additions & 0 deletions xblocks_contrib/discussion/static/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This static directory is for files that should be included in your kit as plain
static files.

You can ask the runtime for a URL that will retrieve these files with:

url = self.runtime.local_resource_url(self, "static/js/lib.js")

The default implementation is very strict though, and will not serve files from
the static directory. It will serve files from a directory named "public".
Create a directory alongside this one named "public", and put files there.
Then you can get a url with code like this:

url = self.runtime.local_resource_url(self, "public/js/lib.js")

The sample code includes a function you can use to read the content of files
in the static directory, like this:

frag.add_javascript(self.resource_string("static/js/my_block.js"))

0 comments on commit 7046de4

Please sign in to comment.