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
edx
edx-platform
Commits
114dbeb2
Commit
114dbeb2
authored
Nov 25, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #329 from open-craft/eugeny/discussion-backport
Production deployment fixes -> staticfiles url rewriting
parents
c6a859a3
a7a5d9db
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
common/djangoapps/pipeline_mako/__init__.py
+11
-7
common/djangoapps/pipeline_mako/templates/static_content.html
+3
-3
common/templates/discussion/_discussion_inline.html
+2
-2
No files found.
common/djangoapps/pipeline_mako/__init__.py
View file @
114dbeb2
...
@@ -40,7 +40,7 @@ def render_individual_css(package, paths, raw=False):
...
@@ -40,7 +40,7 @@ def render_individual_css(package, paths, raw=False):
return
'
\n
'
.
join
(
tags
)
return
'
\n
'
.
join
(
tags
)
def
compressed_js
(
package_name
):
def
compressed_js
(
package_name
,
raw
=
False
):
package
=
settings
.
PIPELINE_JS
.
get
(
package_name
,
{})
package
=
settings
.
PIPELINE_JS
.
get
(
package_name
,
{})
if
package
:
if
package
:
package
=
{
package_name
:
package
}
package
=
{
package_name
:
package
}
...
@@ -49,19 +49,23 @@ def compressed_js(package_name):
...
@@ -49,19 +49,23 @@ def compressed_js(package_name):
package
=
packager
.
package_for
(
'js'
,
package_name
)
package
=
packager
.
package_for
(
'js'
,
package_name
)
if
settings
.
PIPELINE
:
if
settings
.
PIPELINE
:
return
render_js
(
package
,
package
.
output_filename
)
return
render_js
(
package
,
package
.
output_filename
,
raw
=
raw
)
else
:
else
:
paths
=
packager
.
compile
(
package
.
paths
)
paths
=
packager
.
compile
(
package
.
paths
)
templates
=
packager
.
pack_templates
(
package
)
templates
=
packager
.
pack_templates
(
package
)
return
render_individual_js
(
package
,
paths
,
templates
)
return
render_individual_js
(
package
,
paths
,
templates
,
raw
=
raw
)
def
render_js
(
package
,
path
):
def
render_js
(
package
,
path
,
raw
=
False
):
template_name
=
package
.
template_name
or
"mako/js.html"
template_name
=
package
.
template_name
or
"mako/js.html"
context
=
package
.
extra_context
context
=
package
.
extra_context
url
=
try_staticfiles_lookup
(
path
)
if
raw
:
url
+=
"?raw"
context
.
update
({
context
.
update
({
'type'
:
guess_type
(
path
,
'text/javascript'
),
'type'
:
guess_type
(
path
,
'text/javascript'
),
'url'
:
try_staticfiles_lookup
(
path
)
'url'
:
url
})
})
return
render_to_string
(
template_name
,
context
)
return
render_to_string
(
template_name
,
context
)
...
@@ -74,8 +78,8 @@ def render_inline_js(package, js):
...
@@ -74,8 +78,8 @@ def render_inline_js(package, js):
return
render_to_string
(
"mako/inline_js.html"
,
context
)
return
render_to_string
(
"mako/inline_js.html"
,
context
)
def
render_individual_js
(
package
,
paths
,
templates
=
None
):
def
render_individual_js
(
package
,
paths
,
templates
=
None
,
raw
=
False
):
tags
=
[
render_js
(
package
,
js
)
for
js
in
paths
]
tags
=
[
render_js
(
package
,
js
,
raw
)
for
js
in
paths
]
if
templates
:
if
templates
:
tags
.
append
(
render_inline_js
(
package
,
templates
))
tags
.
append
(
render_inline_js
(
package
,
templates
))
return
'
\n
'
.
join
(
tags
)
return
'
\n
'
.
join
(
tags
)
common/djangoapps/pipeline_mako/templates/static_content.html
View file @
114dbeb2
...
@@ -19,12 +19,12 @@ except:
...
@@ -19,12 +19,12 @@ except:
% endfor
% endfor
%endif
%endif
</
%
def>
</
%
def>
<
%
def
name=
'js(group)'
>
<
%
def
name=
'js(group
, raw=False
)'
>
% if settings.FEATURES['USE_DJANGO_PIPELINE']:
% if settings.FEATURES['USE_DJANGO_PIPELINE']:
${compressed_js(group)}
${compressed_js(group
, raw=raw
)}
% else:
% else:
% for filename in settings.PIPELINE_JS[group]['source_filenames']:
% for filename in settings.PIPELINE_JS[group]['source_filenames']:
<script
type=
"text/javascript"
src=
"${staticfiles_storage.url(filename.replace('.coffee', '.js'))}"
></script>
<script
type=
"text/javascript"
src=
"${staticfiles_storage.url(filename.replace('.coffee', '.js'))}
${"
?
raw
"
if
raw
else
""}
"
></script>
% endfor
% endfor
%endif
%endif
</
%
def>
</
%
def>
...
...
common/templates/discussion/_discussion_inline.html
View file @
114dbeb2
...
@@ -5,11 +5,11 @@
...
@@ -5,11 +5,11 @@
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
block
name=
"js_extra"
>
<
%
block
name=
"js_extra"
>
<
%
static:js
group=
'discussion'
/>
<
%
static:js
group=
'discussion'
raw=
'true'
/>
</
%
block>
</
%
block>
<
%
block
name=
"css_extra"
>
<
%
block
name=
"css_extra"
>
<
%
static:css
group=
'discussion'
/>
<
%
static:css
group=
'discussion'
raw=
'true'
/>
</
%
block>
</
%
block>
<div
class=
"discussion-module"
data-discussion-id=
"${discussion_id | h}"
>
<div
class=
"discussion-module"
data-discussion-id=
"${discussion_id | h}"
>
...
...
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