-
Notifications
You must be signed in to change notification settings - Fork 227
refactor: fold web_fragments into XBlock python project #917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ help: ## display this help message | |
|
|
||
| quality: ## check coding style with pycodestyle and pylint | ||
| pycodestyle | ||
| pylint xblock | ||
| pylint xblock web_fragments | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you try adding a quick Just something like this: I think that'll be enough to get it to automatically show up in the XBlock docs page, but LMK if it doesn't work easily and we can punt it. Example source (Fields API) Example rendered:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kdmccormick Added. Needed some slight tweaking to not throw errors/warnings, but seemed to work. |
||
|
|
||
| validate: test | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .. _Fragments API: | ||
|
|
||
| ############# | ||
| Fragments API | ||
| ############# | ||
|
|
||
| .. automodule:: web_fragments.fragment | ||
| :members: | ||
|
|
||
| .. autoclass:: web_fragments.views.FragmentView | ||
| :members: |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """ | ||
| Web fragments. | ||
| """ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| """ | ||
| Web Fragments Django application initialization. | ||
| """ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class WebFragmentsConfig(AppConfig): | ||
| """ | ||
| Configuration for the Web Fragments Django application. | ||
| """ | ||
|
|
||
| name = 'web_fragments' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| """ | ||
| Provides a URL for testing | ||
| """ | ||
| from django.urls import path | ||
|
|
||
| from web_fragments.examples.views import EXAMPLE_FRAGMENT_VIEW_NAME, ExampleFragmentView | ||
|
|
||
| urlpatterns = [ | ||
| path('test_fragment', ExampleFragmentView.as_view(), name=EXAMPLE_FRAGMENT_VIEW_NAME), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| """ | ||
| Example fragment view. | ||
| """ | ||
| from web_fragments.fragment import Fragment | ||
| from web_fragments.test_utils import TEST_CSS, TEST_HTML, TEST_JS | ||
| from web_fragments.views import FragmentView | ||
|
|
||
| EXAMPLE_FRAGMENT_VIEW_NAME = 'example_fragment_view' | ||
|
|
||
|
|
||
| class ExampleFragmentView(FragmentView): | ||
| """ | ||
| Simple fragment view for testing. | ||
| """ | ||
|
|
||
| def render_to_fragment(self, request, **kwargs): | ||
| """ | ||
| Returns a simple fragment | ||
| """ | ||
| fragment = Fragment(TEST_HTML) | ||
| fragment.add_javascript(TEST_JS) | ||
| fragment.add_css(TEST_CSS) | ||
| return fragment |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just confirming, once this PR is released, will you open an openedx-platform PR to make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kdmccormick Yep! Will do :)