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
29fe2c7b
Commit
29fe2c7b
authored
Feb 05, 2016
by
Robert Raposa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move markup helpers to djangolib
parent
158c4e58
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
cms/templates/container.html
+1
-1
lms/templates/enrollment/course_enrollment_message.html
+1
-1
openedx/core/djangolib/markup.py
+3
-3
openedx/core/djangolib/tests/test_markup.py
+5
-5
No files found.
cms/templates/container.html
View file @
29fe2c7b
...
@@ -12,7 +12,7 @@ from contentstore.views.helpers import xblock_studio_url, xblock_type_display_na
...
@@ -12,7 +12,7 @@ from contentstore.views.helpers import xblock_studio_url, xblock_type_display_na
from
openedx
.
core
.
djangolib
.
js_utils
import
(
from
openedx
.
core
.
djangolib
.
js_utils
import
(
dump_js_escaped_json
,
js_escaped_string
dump_js_escaped_json
,
js_escaped_string
)
)
from
util
.
markup
import
HTML
,
ugettext
as
_
from
openedx
.
core
.
djangolib
.
markup
import
HTML
,
ugettext
as
_
%
>
%
>
<
%
block
name=
"title"
>
${xblock.display_name_with_default_escaped} ${xblock_type_display_name(xblock) | h}
</
%
block>
<
%
block
name=
"title"
>
${xblock.display_name_with_default_escaped} ${xblock_type_display_name(xblock) | h}
</
%
block>
<
%
block
name=
"bodyclass"
>
is-signedin course container view-container
</
%
block>
<
%
block
name=
"bodyclass"
>
is-signedin course container view-container
</
%
block>
...
...
lms/templates/enrollment/course_enrollment_message.html
View file @
29fe2c7b
<
%!
from
util
.
markup
import
ugettext
as
_
%
>
<
%!
from
openedx
.
core
.
djangolib
.
markup
import
ugettext
as
_
%
>
<
%
page
expression_filter=
"h"
/>
<
%
page
expression_filter=
"h"
/>
% for course_msg in course_enrollment_messages:
% for course_msg in course_enrollment_messages:
<div
class=
"wrapper-msg urgency-high"
>
<div
class=
"wrapper-msg urgency-high"
>
...
...
common/djangoapps/util
/markup.py
→
openedx/core/djangolib
/markup.py
View file @
29fe2c7b
...
@@ -16,12 +16,12 @@ def ugettext(text):
...
@@ -16,12 +16,12 @@ def ugettext(text):
Use like this in Mako::
Use like this in Mako::
<
%
from
util
.markup import ugettext as _
%
>
<
%
from
openedx.core.djangolib
.markup import ugettext as _
%
>
<p>${_("Hello, world!")}</p>
<p>${_("Hello, world!")}</p>
Or with formatting::
Or with formatting::
<
%
from
util
.markup import HTML, ugettext as _
%
>
<
%
from
openedx.core.djangolib
.markup import HTML, ugettext as _
%
>
${_("Write & send {start}email{end}").format(
${_("Write & send {start}email{end}").format(
start=HTML("<a href='mailto:ned@edx.org'>"),
start=HTML("<a href='mailto:ned@edx.org'>"),
end=HTML("</a>"),
end=HTML("</a>"),
...
@@ -41,7 +41,7 @@ def HTML(html): # pylint: disable=invalid-name
...
@@ -41,7 +41,7 @@ def HTML(html): # pylint: disable=invalid-name
Use this when formatting HTML into other strings::
Use this when formatting HTML into other strings::
<
%
from
util
.markup import HTML, ugettext as _
%
>
<
%
from
openedx.core.djangolib
.markup import HTML, ugettext as _
%
>
${_("Write & send {start}email{end}").format(
${_("Write & send {start}email{end}").format(
start=HTML("<a href='mailto:ned@edx.org'>"),
start=HTML("<a href='mailto:ned@edx.org'>"),
end=HTML("</a>"),
end=HTML("</a>"),
...
...
common/djangoapps/util
/tests/test_markup.py
→
openedx/core/djangolib
/tests/test_markup.py
View file @
29fe2c7b
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Tests for
util
.markup
Tests for
openedx.core.djangolib
.markup
"""
"""
import
unittest
import
unittest
import
ddt
import
ddt
from
mako.template
import
Template
from
edxmako.template
import
Template
from
openedx.core.djangolib.markup
import
escape
,
HTML
,
ugettext
as
_
,
ungettext
from
util.markup
import
escape
,
HTML
,
ugettext
as
_
,
ungettext
@ddt.ddt
@ddt.ddt
...
@@ -54,12 +54,12 @@ class FormatHtmlTest(unittest.TestCase):
...
@@ -54,12 +54,12 @@ class FormatHtmlTest(unittest.TestCase):
# The default_filters used here have to match the ones in edxmako.
# The default_filters used here have to match the ones in edxmako.
template
=
Template
(
template
=
Template
(
"""
"""
<
%
! from
util
.markup import HTML, ugettext as _
%
>
<
%
! from
openedx.core.djangolib
.markup import HTML, ugettext as _
%
>
${_(u"A & {BC}").format(BC=HTML("B & C"))}
${_(u"A & {BC}").format(BC=HTML("B & C"))}
"""
,
"""
,
default_filters
=
[
'decode.utf8'
,
'h'
],
default_filters
=
[
'decode.utf8'
,
'h'
],
)
)
out
=
template
.
render
(
{}
)
out
=
template
.
render
()
self
.
assertEqual
(
out
.
strip
(),
u"A & B & C"
)
self
.
assertEqual
(
out
.
strip
(),
u"A & B & C"
)
def
test_ungettext
(
self
):
def
test_ungettext
(
self
):
...
...
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