Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
92820226
Unverified
Commit
92820226
authored
Apr 05, 2018
by
Bill Filler
Committed by
GitHub
Apr 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "WL-1452 | add support for linkifying submissions"
parent
a56eaaf9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2 additions
and
67 deletions
+2
-67
openassessment/templates/openassessmentblock/oa_submission_answer.html
+1
-2
openassessment/templates/openassessmentblock/response/oa_response.html
+1
-2
openassessment/templatetags/__init__.py
+0
-0
openassessment/templatetags/oa_extras.py
+0
-20
openassessment/tests/test_templatetags.py
+0
-41
requirements/base.txt
+0
-2
No files found.
openassessment/templates/openassessmentblock/oa_submission_answer.html
View file @
92820226
{% spaceless %}
{% load i18n %}
{% load oa_extras %}
<ol
class=
"submission__answer__display__content"
>
{% for part in answer.parts %}
<li
class=
"submission__answer__part"
>
...
...
@@ -20,7 +19,7 @@
<div
class=
"submission__answer__part__text"
>
<h5
class=
"submission__answer__part__text__title"
>
{{ answer_text_label }}
</h5>
<div
class=
"submission__answer__part__text__value"
>
{{ part.text|
escape|link_and_linebreak
}}
{{ part.text|
linebreaks
}}
</div>
</div>
{% endif %}
...
...
openassessment/templates/openassessmentblock/response/oa_response.html
View file @
92820226
{% load tz %}
{% load i18n %}
{% load oa_extras %}
{% spaceless %}
{% block list_item %}
<li
class=
"openassessment__steps__step step--response is--in-progress is--showing ui-slidable__container"
...
...
@@ -104,7 +103,7 @@
aria-describedby=
"submission__answer__tip__{{ xblock_id }}"
placeholder=
"{% trans "
Enter
your
response
to
the
prompt
above
."
%}"
maxlength=
"100000"
>
{{ part.text
|escape|link_and_linebreak
}}
</textarea>
>
{{ part.text }}
</textarea>
</div>
{% with forloop.counter|stringformat:"s" as submission_num %}
{% include "openassessmentblock/oa_latex_preview.html" with id="submission__"|add:xblock_id|add:submission_num elem="div" preview_name="submission__"|add:submission_num %}
...
...
openassessment/templatetags/__init__.py
deleted
100644 → 0
View file @
a56eaaf9
openassessment/templatetags/oa_extras.py
deleted
100644 → 0
View file @
a56eaaf9
from
django
import
template
from
django.template.defaultfilters
import
linebreaks
,
stringfilter
from
django.utils.safestring
import
mark_safe
from
django.utils.html
import
conditional_escape
from
bleach
import
callbacks
import
bleach
register
=
template
.
Library
()
@register.filter
(
needs_autoescape
=
True
)
@stringfilter
def
link_and_linebreak
(
text
,
autoescape
=
True
):
if
text
and
len
(
text
)
>
0
:
the_text
=
conditional_escape
(
text
)
return
mark_safe
(
linebreaks
(
bleach
.
linkify
(
the_text
,
callbacks
=
[
callbacks
.
target_blank
])))
else
:
return
text
openassessment/tests/test_templatetags.py
deleted
100644 → 0
View file @
a56eaaf9
import
ddt
from
django.template
import
Context
,
Template
import
unittest
@ddt.ddt
class
OAExtrasTests
(
unittest
.
TestCase
):
template
=
Template
(
"{
%
load oa_extras
%
}"
"{{ text|link_and_linebreak }}"
)
@ddt.data
(
(
""
,
""
),
(
'check this https://dummy-url.com'
,
'https://dummy-url.com'
),
(
'Visit this URL http://dummy-url.com'
,
'http://dummy-url.com'
),
(
'dummy-text http://dummy-url.org'
,
'http://dummy-url.org'
),
(
'dummy-url.com dummy-text'
,
'dummy-url.com'
)
)
@ddt.unpack
def
test_link_and_linebreak
(
self
,
text
,
link_text
):
rendered_template
=
self
.
template
.
render
(
Context
({
'text'
:
text
}))
self
.
assertIn
(
link_text
,
rendered_template
)
if
text
:
self
.
assertRegexpMatches
(
rendered_template
,
r'<a.*target="_blank".*>{link_text}</a>'
.
format
(
link_text
=
link_text
),
)
@ddt.data
(
(
"hello <script></script>"
,
"script"
),
(
"http://dummy-url.com <applet></applet>"
,
"applet"
),
(
"<iframe></iframe>"
,
"iframe"
),
(
"<link></link>"
,
"link"
),
)
@ddt.unpack
def
test_html_tags
(
self
,
text
,
tag
):
rendered_template
=
self
.
template
.
render
(
Context
({
'text'
:
text
}))
escaped_tag
=
"<{tag}>"
.
format
(
tag
=
tag
)
self
.
assertIn
(
escaped_tag
,
rendered_template
)
requirements/base.txt
View file @
92820226
...
...
@@ -5,8 +5,6 @@ git+https://github.com/edx/XBlock.git@xblock-1.0.1#egg=XBlock==1.0.1
git+https://github.com/edx/xblock-sdk.git@v0.1.4#egg=xblock-sdk==0.1.4
# Third Party Requirements
bleach==1.4
html5lib==0.999
boto>=2.39.0,<3.0.0
python-swiftclient>=3.1.0,<4.0.0
defusedxml>=0.4.1,<1.0.0
...
...
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