Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
85a375a3
Commit
85a375a3
authored
6 years ago
by
Calen Pennington
Browse files
Options
Downloads
Patches
Plain Diff
Add webpack assets directly to xmodule fragments, rather than injecting them in fragment contents
parent
0abe75a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/templates/xblock_wrapper.html
+0
-6
0 additions, 6 deletions
common/templates/xblock_wrapper.html
openedx/core/lib/xblock_utils/__init__.py
+7
-3
7 additions, 3 deletions
openedx/core/lib/xblock_utils/__init__.py
with
7 additions
and
9 deletions
common/templates/xblock_wrapper.html
+
0
−
6
View file @
85a375a3
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
% if is_xmodule:
<
%
static:webpack
entry=
"${class_name}"
/>
% endif
<!-- This is the xblock wrapper ${is_xmodule} -->
<div
class=
"${' '.join(classes) | n}"
${
data_attributes
}
>
% if js_init_parameters:
<script
type=
"json/xblock-args"
class=
"xblock-json-init-args"
>
...
...
This diff is collapsed.
Click to expand it.
openedx/core/lib/xblock_utils/__init__.py
+
7
−
3
View file @
85a375a3
...
...
@@ -29,6 +29,8 @@ from xmodule.seq_module import SequenceModule
from
xmodule.vertical_block
import
VerticalBlock
from
xmodule.x_module
import
shim_xmodule_js
,
XModuleDescriptor
,
XModule
,
PREVIEW_VIEWS
,
STUDIO_VIEW
import
webpack_loader.utils
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -134,8 +136,6 @@ def wrap_xblock(
'
display_name
'
:
block
.
display_name_with_default_escaped
,
'
data_attributes
'
:
u
'
'
.
join
(
u
'
data-{}=
"
{}
"'
.
format
(
markupsafe
.
escape
(
key
),
markupsafe
.
escape
(
value
))
for
key
,
value
in
data
.
iteritems
()),
'
class_name
'
:
class_name
,
'
is_xmodule
'
:
isinstance
(
block
,
(
XModule
,
XModuleDescriptor
)),
}
if
hasattr
(
frag
,
'
json_init_args
'
)
and
frag
.
json_init_args
is
not
None
:
...
...
@@ -144,6 +144,11 @@ def wrap_xblock(
else
:
template_context
[
'
js_init_parameters
'
]
=
""
if
isinstance
(
block
,
(
XModule
,
XModuleDescriptor
)):
# Add the webpackified asset tags
for
tag
in
webpack_loader
.
utils
.
get_as_tags
(
class_name
):
frag
.
add_resource
(
tag
,
mimetype
=
'
text/html
'
,
placement
=
'
head
'
)
return
wrap_fragment
(
frag
,
render_to_string
(
'
xblock_wrapper.html
'
,
template_context
))
...
...
@@ -202,7 +207,6 @@ def wrap_xblock_aside(
'
classes
'
:
css_classes
,
'
data_attributes
'
:
u
'
'
.
join
(
u
'
data-{}=
"
{}
"'
.
format
(
markupsafe
.
escape
(
key
),
markupsafe
.
escape
(
value
))
for
key
,
value
in
data
.
iteritems
()),
'
is_xmodule
'
:
False
,
}
if
hasattr
(
frag
,
'
json_init_args
'
)
and
frag
.
json_init_args
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment