Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-platform
Commits
5c969554
Commit
5c969554
authored
Oct 19, 2017
by
Eric Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make messages available in DOM
parent
45a5e785
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
cms/templates/asset_index.html
+1
-0
common/djangoapps/pipeline_mako/templates/static_content.html
+25
-0
webpack.config.js
+11
-0
No files found.
cms/templates/asset_index.html
View file @
5c969554
...
...
@@ -58,6 +58,7 @@
% if waffle_flag_enabled:
<div
id=
"root"
></div>
<
%
static:webpack
entry=
"AssetsPage"
></
%
static:webpack>
<
%
static:ericfischer
locale=
"fr"
></
%
static:ericfischer>
% else:
<div
class=
"wrapper-assets"
></div>
% endif
...
...
common/djangoapps/pipeline_mako/templates/static_content.html
View file @
5c969554
...
...
@@ -86,6 +86,31 @@ engine = Engine(dirs=settings.DEFAULT_TEMPLATE_ENGINE['DIRS'])
source
,
template_path =
Loader(engine).load_template_source(path)
%
>
${source | n, decode.utf8}
</
%
def>
<
%
def
name=
"ericfischer(locale)"
>
<
%
from
django
.
conf
import
settings
from
django
.
template
import
Template
,
Context
from
webpack_loader
.
exceptions
import
WebpackLoaderBadStatsError
path =
"{base}/bundles/studio-frontend/locale_messages/{locale}.json"
.
format
(
base=
settings.STATIC_ROOT,
locale=
locale
)
messages =
""
with
open
(
path
)
as
input:
messages =
input.read()
return
Template
("""
<
div
id=
studio-frontend-messages
style=
"display: none;"
>
{{ messages }}
</div>
""").render(Context({
'messages': messages,
}))
%>
</
%
def>
<
%
def
name=
"webpack(entry)"
>
<
%
doc
>
Loads Javascript onto your page from a Webpack-generated bundle.
...
...
webpack.config.js
View file @
5c969554
...
...
@@ -126,6 +126,17 @@ var wpconfig = {
use
:
'babel-loader'
},
{
test
:
/
\.
json$/
,
include
:
/studio-frontend
\/
i18n
\/
locales/
,
use
:
{
loader
:
'file-loader'
,
options
:
{
name
:
'[name].[ext]'
,
outputPath
:
'studio-frontend/locale_messages/'
}
}
},
{
test
:
/
(
.scss|.css
)
$/
,
include
:
[
/studio-frontend/
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment