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
c223fa0b
Commit
c223fa0b
authored
Apr 06, 2018
by
Zia Fazal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed linkify of text when it is in response textarea
parent
81d6ab51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
openassessment/templates/openassessmentblock/response/oa_response.html
+1
-2
openassessment/templatetags/oa_extras.py
+12
-8
No files found.
openassessment/templates/openassessmentblock/response/oa_response.html
View file @
c223fa0b
{% 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/oa_extras.py
View file @
c223fa0b
...
...
@@ -9,12 +9,16 @@ import bleach
register
=
template
.
Library
()
@register.filter
(
needs_autoescape
=
True
)
@register.filter
()
@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
def
link_and_linebreak
(
text
):
"""
Converts URLs in text into clickable links with their target attribute set to `_blank`.
It wraps givent tags into <p> tags and converts line breaks(
\n
) to <br> tags.
Args:
text: (str) Text having URLs to be converted
Returns: (str) Text with URLs convert to links
"""
if
text
:
escaped_text
=
conditional_escape
(
text
)
return
mark_safe
(
linebreaks
(
bleach
.
linkify
(
escaped_text
,
callbacks
=
[
callbacks
.
target_blank
])))
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