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
1805ed8a
Commit
1805ed8a
authored
Aug 06, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search highlighting
parent
30f5bdb4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
7 deletions
+34
-7
lms/static/coffee/src/customwmd.coffee
+0
-2
lms/static/coffee/src/discussion/content.coffee
+24
-3
lms/templates/discussion/_thread.html
+10
-2
No files found.
lms/static/coffee/src/customwmd.coffee
View file @
1805ed8a
...
@@ -105,7 +105,6 @@ $ ->
...
@@ -105,7 +105,6 @@ $ ->
replaceMath
:
(
text
)
->
replaceMath
:
(
text
)
->
text
=
text
.
replace
/@@(\d+)@@/g
,
(
$0
,
$1
)
=>
@
math
[
$1
]
text
=
text
.
replace
/@@(\d+)@@/g
,
(
$0
,
$1
)
=>
@
math
[
$1
]
@
math
=
null
@
math
=
null
console
.
log
text
text
text
@
replaceMathWrapper
:
(
_this
)
->
@
replaceMathWrapper
:
(
_this
)
->
...
@@ -163,7 +162,6 @@ $ ->
...
@@ -163,7 +162,6 @@ $ ->
$
(
'#file-upload'
).
unbind
(
'change'
).
change
(
startUploadHandler
)
$
(
'#file-upload'
).
unbind
(
'change'
).
change
(
startUploadHandler
)
imageUploadHandler
=
(
elem
,
input
)
->
imageUploadHandler
=
(
elem
,
input
)
->
console
.
log
"here"
ajaxFileUpload
(
imageUploadUrl
,
input
,
imageUploadHandler
)
ajaxFileUpload
(
imageUploadUrl
,
input
,
imageUploadHandler
)
editor
=
new
Markdown
.
Editor
(
editor
=
new
Markdown
.
Editor
(
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
1805ed8a
...
@@ -278,15 +278,36 @@ initializeFollowThread = (thread) ->
...
@@ -278,15 +278,36 @@ initializeFollowThread = (thread) ->
handleEditComment
(
this
)
handleEditComment
(
this
)
initializeContent
:
(
content
)
->
initializeContent
:
(
content
)
->
unescapeHighlightTag
=
(
text
)
->
text
.
replace
(
/\<\;highlight\>\;/g
,
"<span class='search-highlight'>"
)
.
replace
(
/\<\;\/highlight\>\;/g
,
"</span>"
)
stripLatexHighlight
=
(
text
)
->
text
markdownWithHighlight
=
(
text
)
->
converter
=
Markdown
.
getMathCompatibleConverter
()
unescapeHighlightTag
stripLatexHighlight
converter
.
makeHtml
text
$content
=
$
(
content
)
$content
=
$
(
content
)
initializeVote
$content
initializeVote
$content
if
$content
.
hasClass
(
"thread"
)
if
$content
.
hasClass
(
"thread"
)
initializeFollowThread
$content
initializeFollowThread
$content
$local
=
Discussion
.
generateLocal
(
$content
.
children
(
".discussion-content"
))
$local
=
Discussion
.
generateLocal
(
$content
.
children
(
".discussion-content"
))
$contentTitle
=
$local
(
".thread-title"
)
if
$contentTitle
.
length
$contentTitle
.
html
unescapeHighlightTag
stripLatexHighlight
$contentTitle
.
html
()
$contentBody
=
$local
(
".content-body"
)
$contentBody
=
$local
(
".content-body"
)
raw_text
=
$contentBody
.
html
()
converter
=
Markdown
.
getMathCompatibleConverter
()
console
.
log
"raw html:"
$contentBody
.
html
(
converter
.
makeHtml
(
raw_text
))
console
.
log
$contentBody
.
html
()
$contentBody
.
html
markdownWithHighlight
$contentBody
.
html
()
MathJax
.
Hub
.
Queue
[
"Typeset"
,
MathJax
.
Hub
,
$contentBody
.
attr
(
"id"
)]
MathJax
.
Hub
.
Queue
[
"Typeset"
,
MathJax
.
Hub
,
$contentBody
.
attr
(
"id"
)]
id
=
$content
.
attr
(
"_id"
)
id
=
$content
.
attr
(
"_id"
)
if
not
Discussion
.
getContentInfo
id
,
'editable'
if
not
Discussion
.
getContentInfo
id
,
'editable'
...
...
lms/templates/discussion/_thread.html
View file @
1805ed8a
...
@@ -42,7 +42,11 @@
...
@@ -42,7 +42,11 @@
<div
class=
"discussion-right-wrapper clearfix"
>
<div
class=
"discussion-right-wrapper clearfix"
>
${render_title(content, type, **kwargs)}
${render_title(content, type, **kwargs)}
<div
class=
"discussion-content-view"
>
<div
class=
"discussion-content-view"
>
<div
class=
"content-body ${type}-body"
id=
"content-body-${content['id']}"
>
${content['body'] | h}
</div>
% if content.get('highlighted_body', None):
<div
class=
"content-body ${type}-body"
id=
"content-body-${content['id']}"
>
${content['highlighted_body'] | h}
</div>
% else:
<div
class=
"content-body ${type}-body"
id=
"content-body-${content['id']}"
>
${content['body'] | h}
</div>
% endif
<div
class=
"content-raw-body ${type}-raw-body"
style=
"display: none"
>
${content['body'] | h}
</div>
<div
class=
"content-raw-body ${type}-raw-body"
style=
"display: none"
>
${content['body'] | h}
</div>
${render_tags(content, type, **kwargs)}
${render_tags(content, type, **kwargs)}
${render_bottom_bar(content, type, **kwargs)}
${render_bottom_bar(content, type, **kwargs)}
...
@@ -54,7 +58,11 @@
...
@@ -54,7 +58,11 @@
<
%
def
name=
"render_title(content, type, **kwargs)"
>
<
%
def
name=
"render_title(content, type, **kwargs)"
>
% if type == "thread":
% if type == "thread":
<a
class=
"thread-title"
name=
"${content['id']}"
href=
"javascript:void(0)"
>
${content['title'] | h}
</a>
% if content.get('highlighted_title', None):
<a
class=
"thread-title"
name=
"${content['id']}"
href=
"javascript:void(0)"
>
${content['highlighted_title'] | h}
</a>
% else:
<a
class=
"thread-title"
name=
"${content['id']}"
href=
"javascript:void(0)"
>
${content['title'] | h}
</a>
% endif
% endif
% endif
</
%
def>
</
%
def>
...
...
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