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
1ad838ac
Commit
1ad838ac
authored
Jul 28, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix random js stuff; tag fields; override mathjax config for now
parent
0790a3ad
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
7 deletions
+47
-7
common/lib/xmodule/xmodule/discussion_module.py
+1
-0
lms/djangoapps/django_comment_client/forum/views.py
+2
-1
lms/lib/comment_client.py
+6
-0
lms/templates/courseware.html
+22
-1
lms/templates/discussion/inline.html
+9
-4
lms/templates/discussion/single_thread.html
+7
-1
No files found.
common/lib/xmodule/xmodule/discussion_module.py
View file @
1ad838ac
...
...
@@ -19,6 +19,7 @@ class DiscussionModule(XModule):
'discussion_id'
:
self
.
discussion_id
,
'search_bar'
:
''
,
'user_info'
:
comment_client
.
get_user_info
(
self
.
user_id
,
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
self
.
course_id
,
}
return
self
.
system
.
render_template
(
'discussion/inline.html'
,
context
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
1ad838ac
...
...
@@ -32,6 +32,7 @@ def render_discussion(request, course_id, threads, discussion_id=None, search_te
'discussion_id'
:
discussion_id
,
'search_bar'
:
render_search_bar
(
request
,
course_id
,
discussion_id
,
text
=
search_text
),
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
course_id
,
}
return
render_to_string
(
'discussion/inline.html'
,
context
)
...
...
@@ -78,6 +79,7 @@ def render_single_thread(request, course_id, thread_id):
context
=
{
'thread'
:
comment_client
.
get_thread
(
thread_id
,
recursive
=
True
),
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
course_id
,
}
return
render_to_string
(
'discussion/single_thread.html'
,
context
)
...
...
@@ -91,7 +93,6 @@ def single_thread(request, course_id, thread_id):
'init'
:
''
,
'content'
:
render_single_thread
(
request
,
course_id
,
thread_id
),
'accordion'
:
''
,
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'course'
:
course
,
}
...
...
lms/lib/comment_client.py
View file @
1ad838ac
...
...
@@ -11,6 +11,9 @@ def delete_threads(commentable_id, *args, **kwargs):
def
get_threads
(
commentable_id
,
recursive
=
False
,
*
args
,
**
kwargs
):
return
_perform_request
(
'get'
,
_url_for_threads
(
commentable_id
),
{
'recursive'
:
recursive
},
*
args
,
**
kwargs
)
def
get_threads_tags
(
*
args
,
**
kwargs
):
return
_perform_request
(
'get'
,
_url_for_threads_tags
(),
{},
*
args
,
**
kwargs
)
def
create_thread
(
commentable_id
,
attributes
,
*
args
,
**
kwargs
):
return
_perform_request
(
'post'
,
_url_for_threads
(
commentable_id
),
attributes
,
*
args
,
**
kwargs
)
...
...
@@ -126,3 +129,6 @@ def _url_for_user(user_id):
def
_url_for_search
():
return
"{prefix}/search"
.
format
(
prefix
=
PREFIX
)
def
_url_for_threads_tags
():
return
"{prefix}/threads/tags"
.
format
(
prefix
=
PREFIX
)
lms/templates/courseware.html
View file @
1ad838ac
...
...
@@ -28,7 +28,28 @@
<
%
static:js
group=
'courseware'
/>
<
%
include
file=
"mathjax_include.html"
/>
<script
type=
"text/x-mathjax-config"
>
MathJax
.
Hub
.
Config
({
tex2jax
:
{
inlineMath
:
[
[
"$"
,
"$"
],
],
displayMath
:
[
[
"$$"
,
"$$"
],
]
}
});
</script>
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates.
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
MathJax extension libraries -->
<script
type=
"text/javascript"
src=
"/static/js/vendor/mathjax-MathJax-c9db6ac/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/split.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/jquery.ajaxfileupload.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/Markdown.Converter.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/Markdown.Sanitizer.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/Markdown.Editor.js')}"
></script>
<!-- TODO: http://docs.jquery.com/Plugins/Validation -->
<script
type=
"text/javascript"
>
...
...
lms/templates/discussion/inline.html
View file @
1ad838ac
...
...
@@ -8,10 +8,9 @@
${search_bar}
<form
class=
"new-post-form"
_id=
"${discussion_id}"
>
<input
type=
"text"
class=
"new-post-title"
placeholder=
"Title"
/>
<div
class=
"new-post-body"
>
<
/div
>
<div
class=
"new-post-body"
>
</div>
<
input
type=
"text"
class=
"new-pot-tags"
placeholder=
"tag1, tag2"
/
>
<a
class=
"discussion-new-post"
href=
"javascript:void(0)"
>
New Post
</a>
</form>
</div>
% for thread in threads:
...
...
@@ -19,7 +18,13 @@
% endfor
</section>
<
%!
def
escape_quotes
(
text
)
:
return
text
.
replace
('\"',
'\\\"').
replace
("\'",
"\\\'")
%
>
<script
type=
"text/javascript"
>
var
$$user_info
=
JSON
.
parse
(
'${user_info}'
);
var
$$user_info
=
JSON
.
parse
(
'${user_info
| escape_quotes
}'
);
var
$$course_id
=
"${course_id}"
;
var
$$tags
=
JSON
.
parse
(
"${tags | escape_quotes}"
);
</script>
lms/templates/discussion/single_thread.html
View file @
1ad838ac
...
...
@@ -5,7 +5,13 @@
${renderer.render_thread(course_id, thread, edit_thread=True, show_comments=True)}
</section>
<
%!
def
escape_quotes
(
text
)
:
return
text
.
replace
('\"',
'\\\"').
replace
("\'",
"\\\'")
%
>
<script
type=
"text/javascript"
>
var
$$user_info
=
JSON
.
parse
(
'${user_info}'
);
var
$$user_info
=
JSON
.
parse
(
'${user_info
| escape_quotes
}'
);
var
$$course_id
=
"${course_id}"
;
var
$$tags
=
JSON
.
parse
(
"${tags | escape_quotes}"
);
</script>
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