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
d0f2f310
Commit
d0f2f310
authored
Aug 24, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #547 from MITx/feature/rocky/discussion
fixed profiled user id (toggle moderator status)
parents
10c953e8
eb4068cc
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
88 additions
and
51 deletions
+88
-51
lms/djangoapps/django_comment_client/base/views.py
+13
-13
lms/djangoapps/django_comment_client/forum/views.py
+6
-6
lms/djangoapps/django_comment_client/utils.py
+14
-0
lms/static/coffee/src/discussion/content.coffee
+18
-6
lms/static/coffee/src/discussion/discussion.coffee
+5
-1
lms/static/coffee/src/discussion/utils.coffee
+8
-2
lms/static/sass/_discussion.scss
+4
-0
lms/templates/discussion/_content_renderer.html
+1
-1
lms/templates/discussion/_discussion_module.html
+1
-1
lms/templates/discussion/_forum.html
+1
-1
lms/templates/discussion/_inline.html
+1
-1
lms/templates/discussion/_paginator.html
+2
-2
lms/templates/discussion/_recent_active_posts.html
+1
-1
lms/templates/discussion/_search_bar.html
+2
-2
lms/templates/discussion/_similar_posts.html
+1
-1
lms/templates/discussion/_single_thread.html
+1
-1
lms/templates/discussion/_sort.html
+1
-1
lms/templates/discussion/_trending_tags.html
+1
-1
lms/templates/discussion/_user_active_threads.html
+1
-1
lms/templates/discussion/_user_profile.html
+3
-3
lms/templates/discussion/index.html
+1
-1
lms/templates/discussion/mustache/_content.mustache
+0
-3
lms/templates/discussion/user_profile.html
+2
-2
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
d0f2f310
...
@@ -55,7 +55,7 @@ def ajax_content_response(request, course_id, content, template_name):
...
@@ -55,7 +55,7 @@ def ajax_content_response(request, course_id, content, template_name):
annotated_content_info
=
utils
.
get_annotated_content_info
(
course_id
,
content
,
request
.
user
,
user_info
)
annotated_content_info
=
utils
.
get_annotated_content_info
(
course_id
,
content
,
request
.
user
,
user_info
)
return
JsonResponse
({
return
JsonResponse
({
'html'
:
html
,
'html'
:
html
,
'content'
:
content
,
'content'
:
utils
.
safe_content
(
content
)
,
'annotated_content_info'
:
annotated_content_info
,
'annotated_content_info'
:
annotated_content_info
,
})
})
...
@@ -78,7 +78,7 @@ def create_thread(request, course_id, commentable_id):
...
@@ -78,7 +78,7 @@ def create_thread(request, course_id, commentable_id):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
thread
.
to_dict
(),
'discussion/ajax_create_thread.html'
)
return
ajax_content_response
(
request
,
course_id
,
thread
.
to_dict
(),
'discussion/ajax_create_thread.html'
)
else
:
else
:
return
JsonResponse
(
thread
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -90,7 +90,7 @@ def update_thread(request, course_id, thread_id):
...
@@ -90,7 +90,7 @@ def update_thread(request, course_id, thread_id):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
thread
.
to_dict
(),
'discussion/ajax_update_thread.html'
)
return
ajax_content_response
(
request
,
course_id
,
thread
.
to_dict
(),
'discussion/ajax_update_thread.html'
)
else
:
else
:
return
JsonResponse
(
thread
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()
))
def
_create_comment
(
request
,
course_id
,
thread_id
=
None
,
parent_id
=
None
):
def
_create_comment
(
request
,
course_id
,
thread_id
=
None
,
parent_id
=
None
):
post
=
request
.
POST
post
=
request
.
POST
...
@@ -109,7 +109,7 @@ def _create_comment(request, course_id, thread_id=None, parent_id=None):
...
@@ -109,7 +109,7 @@ def _create_comment(request, course_id, thread_id=None, parent_id=None):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
(),
'discussion/ajax_create_comment.html'
)
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
(),
'discussion/ajax_create_comment.html'
)
else
:
else
:
return
JsonResponse
(
comment
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -126,7 +126,7 @@ def create_comment(request, course_id, thread_id):
...
@@ -126,7 +126,7 @@ def create_comment(request, course_id, thread_id):
def
delete_thread
(
request
,
course_id
,
thread_id
):
def
delete_thread
(
request
,
course_id
,
thread_id
):
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
.
delete
()
thread
.
delete
()
return
JsonResponse
(
thread
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -138,7 +138,7 @@ def update_comment(request, course_id, comment_id):
...
@@ -138,7 +138,7 @@ def update_comment(request, course_id, comment_id):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
(),
'discussion/ajax_update_comment.html'
)
return
ajax_content_response
(
request
,
course_id
,
comment
.
to_dict
(),
'discussion/ajax_update_comment.html'
)
else
:
else
:
return
JsonResponse
(
comment
.
to_dict
()),
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -147,7 +147,7 @@ def endorse_comment(request, course_id, comment_id):
...
@@ -147,7 +147,7 @@ def endorse_comment(request, course_id, comment_id):
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
.
endorsed
=
request
.
POST
.
get
(
'endorsed'
,
'false'
)
.
lower
()
==
'true'
comment
.
endorsed
=
request
.
POST
.
get
(
'endorsed'
,
'false'
)
.
lower
()
==
'true'
comment
.
save
()
comment
.
save
()
return
JsonResponse
(
comment
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -158,7 +158,7 @@ def openclose_thread(request, course_id, thread_id):
...
@@ -158,7 +158,7 @@ def openclose_thread(request, course_id, thread_id):
thread
.
save
()
thread
.
save
()
thread
=
thread
.
to_dict
()
thread
=
thread
.
to_dict
()
return
JsonResponse
({
return
JsonResponse
({
'content'
:
thread
,
'content'
:
utils
.
safe_content
(
thread
)
,
'ability'
:
utils
.
get_ability
(
course_id
,
thread
,
request
.
user
),
'ability'
:
utils
.
get_ability
(
course_id
,
thread
,
request
.
user
),
})
})
...
@@ -177,7 +177,7 @@ def create_sub_comment(request, course_id, comment_id):
...
@@ -177,7 +177,7 @@ def create_sub_comment(request, course_id, comment_id):
def
delete_comment
(
request
,
course_id
,
comment_id
):
def
delete_comment
(
request
,
course_id
,
comment_id
):
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
.
delete
()
comment
.
delete
()
return
JsonResponse
(
comment
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -186,7 +186,7 @@ def vote_for_comment(request, course_id, comment_id, value):
...
@@ -186,7 +186,7 @@ def vote_for_comment(request, course_id, comment_id, value):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
user
.
vote
(
comment
,
value
)
user
.
vote
(
comment
,
value
)
return
JsonResponse
(
comment
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -195,7 +195,7 @@ def undo_vote_for_comment(request, course_id, comment_id):
...
@@ -195,7 +195,7 @@ def undo_vote_for_comment(request, course_id, comment_id):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
comment
=
cc
.
Comment
.
find
(
comment_id
)
user
.
unvote
(
comment
)
user
.
unvote
(
comment
)
return
JsonResponse
(
comment
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
comment
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -204,7 +204,7 @@ def vote_for_thread(request, course_id, thread_id, value):
...
@@ -204,7 +204,7 @@ def vote_for_thread(request, course_id, thread_id, value):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
user
.
vote
(
thread
,
value
)
user
.
vote
(
thread
,
value
)
return
JsonResponse
(
thread
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()
))
@require_POST
@require_POST
@login_required
@login_required
...
@@ -213,7 +213,7 @@ def undo_vote_for_thread(request, course_id, thread_id):
...
@@ -213,7 +213,7 @@ def undo_vote_for_thread(request, course_id, thread_id):
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
user
=
cc
.
User
.
from_django_user
(
request
.
user
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
thread
=
cc
.
Thread
.
find
(
thread_id
)
user
.
unvote
(
thread
)
user
.
unvote
(
thread
)
return
JsonResponse
(
thread
.
to_dict
(
))
return
JsonResponse
(
utils
.
safe_content
(
thread
.
to_dict
()
))
@require_POST
@require_POST
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
d0f2f310
...
@@ -83,7 +83,7 @@ def render_discussion(request, course_id, threads, *args, **kwargs):
...
@@ -83,7 +83,7 @@ def render_discussion(request, course_id, threads, *args, **kwargs):
'base_url'
:
base_url
,
'base_url'
:
base_url
,
'query_params'
:
strip_blank
(
strip_none
(
extract
(
query_params
,
[
'page'
,
'sort_key'
,
'sort_order'
,
'tags'
,
'text'
]))),
'query_params'
:
strip_blank
(
strip_none
(
extract
(
query_params
,
[
'page'
,
'sort_key'
,
'sort_order'
,
'tags'
,
'text'
]))),
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
'discussion_data'
:
json
.
dumps
({
(
discussion_id
or
user_id
):
threads
})
'discussion_data'
:
json
.
dumps
({
(
discussion_id
or
user_id
):
map
(
utils
.
safe_content
,
threads
)
})
}
}
context
=
dict
(
context
.
items
()
+
query_params
.
items
())
context
=
dict
(
context
.
items
()
+
query_params
.
items
())
return
render_to_string
(
template
,
context
)
return
render_to_string
(
template
,
context
)
...
@@ -128,7 +128,7 @@ def inline_discussion(request, course_id, discussion_id):
...
@@ -128,7 +128,7 @@ def inline_discussion(request, course_id, discussion_id):
return
utils
.
JsonResponse
({
return
utils
.
JsonResponse
({
'html'
:
html
,
'html'
:
html
,
'discussion
Data'
:
threads
,
'discussion
_data'
:
map
(
utils
.
safe_content
,
threads
)
,
})
})
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
...
@@ -149,7 +149,7 @@ def forum_form_discussion(request, course_id):
...
@@ -149,7 +149,7 @@ def forum_form_discussion(request, course_id):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
utils
.
JsonResponse
({
return
utils
.
JsonResponse
({
'html'
:
content
,
'html'
:
content
,
'discussion
Data'
:
threads
,
'discussion
_data'
:
map
(
utils
.
safe_content
,
threads
)
,
})
})
else
:
else
:
recent_active_threads
=
cc
.
search_recent_active_threads
(
recent_active_threads
=
cc
.
search_recent_active_threads
(
...
@@ -186,7 +186,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
...
@@ -186,7 +186,7 @@ def render_single_thread(request, discussion_id, course_id, thread_id):
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
'annotated_content_info'
:
json
.
dumps
(
annotated_content_info
),
'course_id'
:
course_id
,
'course_id'
:
course_id
,
'request'
:
request
,
'request'
:
request
,
'discussion_data'
:
json
.
dumps
({
discussion_id
:
[
thread
]
}),
'discussion_data'
:
json
.
dumps
({
discussion_id
:
[
utils
.
safe_content
(
thread
)
]
}),
}
}
return
render_to_string
(
'discussion/_single_thread.html'
,
context
)
return
render_to_string
(
'discussion/_single_thread.html'
,
context
)
...
@@ -202,7 +202,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
...
@@ -202,7 +202,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
return
utils
.
JsonResponse
({
return
utils
.
JsonResponse
({
'html'
:
html
,
'html'
:
html
,
'content'
:
thread
.
to_dict
(
),
'content'
:
utils
.
safe_content
(
thread
.
to_dict
()
),
'annotated_content_info'
:
annotated_content_info
,
'annotated_content_info'
:
annotated_content_info
,
})
})
...
@@ -252,7 +252,7 @@ def user_profile(request, course_id, user_id):
...
@@ -252,7 +252,7 @@ def user_profile(request, course_id, user_id):
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
utils
.
JsonResponse
({
return
utils
.
JsonResponse
({
'html'
:
content
,
'html'
:
content
,
'discussion
Data'
:
threads
,
'discussion
_data'
:
map
(
utils
.
safe_content
,
threads
)
,
})
})
else
:
else
:
context
=
{
context
=
{
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
d0f2f310
...
@@ -219,3 +219,17 @@ def extend_content(content):
...
@@ -219,3 +219,17 @@ def extend_content(content):
'permalink'
:
permalink
(
content
),
'permalink'
:
permalink
(
content
),
}
}
return
merge_dict
(
content
,
content_info
)
return
merge_dict
(
content
,
content_info
)
def
safe_content
(
content
):
fields
=
[
'id'
,
'title'
,
'body'
,
'course_id'
,
'anonymous'
,
'endorsed'
,
'parent_id'
,
'thread_id'
,
'votes'
,
'closed'
,
'created_at'
,
'updated_at'
,
'depth'
,
'type'
,
'commentable_id'
,
'comments_count'
,
'at_position_list'
,
'children'
,
'highlighted_title'
,
'highlighted_body'
,
]
if
content
.
get
(
'anonymous'
)
is
False
:
fields
+=
[
'username'
,
'user_id'
]
return
strip_none
(
extract
(
content
,
fields
))
lms/static/coffee/src/discussion/content.coffee
View file @
d0f2f310
...
@@ -284,11 +284,11 @@ if Backbone?
...
@@ -284,11 +284,11 @@ if Backbone?
view
=
{}
view
=
{}
view
.
id
=
@
model
.
id
view
.
id
=
@
model
.
id
if
@
model
.
get
(
'type'
)
==
'thread'
if
@
model
.
get
(
'type'
)
==
'thread'
view
.
title
=
@
$
(
".thread-raw-title"
).
html
(
)
view
.
title
=
@
model
.
get
(
'title'
)
view
.
body
=
@
$
(
".thread-raw-body"
).
html
(
)
view
.
body
=
@
model
.
get
(
'body'
)
view
.
tags
=
@
$
(
".thread-raw-tags"
).
html
(
)
view
.
tags
=
@
model
.
get
(
'tags'
)
else
else
view
.
body
=
@
$
(
".comment-raw-body"
).
html
(
)
view
.
body
=
@
model
.
get
(
'body'
)
@
$discussionContent
().
append
Mustache
.
render
DiscussionUtil
.
getTemplate
(
"_edit_
#{
@
model
.
get
(
'type'
)
}
"
),
view
@
$discussionContent
().
append
Mustache
.
render
DiscussionUtil
.
getTemplate
(
"_edit_
#{
@
model
.
get
(
'type'
)
}
"
),
view
DiscussionUtil
.
makeWmdEditor
@
$el
,
$
.
proxy
(
@
$
,
@
),
"
#{
@
model
.
get
(
'type'
)
}
-body-edit"
DiscussionUtil
.
makeWmdEditor
@
$el
,
$
.
proxy
(
@
$
,
@
),
"
#{
@
model
.
get
(
'type'
)
}
-body-edit"
@
$
(
".thread-tags-edit"
).
tagsInput
DiscussionUtil
.
tagsInputOptions
()
@
$
(
".thread-tags-edit"
).
tagsInput
DiscussionUtil
.
tagsInputOptions
()
...
@@ -316,8 +316,12 @@ if Backbone?
...
@@ -316,8 +316,12 @@ if Backbone?
success
:
(
response
,
textStatus
)
=>
success
:
(
response
,
textStatus
)
=>
DiscussionUtil
.
clearFormErrors
@
$
(
".discussion-update-errors"
)
DiscussionUtil
.
clearFormErrors
@
$
(
".discussion-update-errors"
)
@
$discussionContent
().
replaceWith
(
response
.
html
)
@
$discussionContent
().
replaceWith
(
response
.
html
)
@
model
.
set
response
.
content
if
@
model
.
get
(
'type'
)
==
'thread'
@
model
.
updateInfo
response
.
annotated_content_info
@
model
=
new
Thread
response
.
content
else
@
model
=
new
Comment
$
.
extend
{},
response
.
content
,
{
thread
:
@
model
.
get
(
'thread'
)
}
@
reconstruct
()
@
model
.
updateInfo
response
.
annotated_content_info
,
{
forceUpdate
:
true
}
cancelEdit
:
(
event
)
->
cancelEdit
:
(
event
)
->
@
$
(
".discussion-content-edit"
).
hide
()
@
$
(
".discussion-content-edit"
).
hide
()
...
@@ -388,6 +392,14 @@ if Backbone?
...
@@ -388,6 +392,14 @@ if Backbone?
@
initTitle
()
@
initTitle
()
@
initBody
()
@
initBody
()
@
initCommentViews
()
@
initCommentViews
()
reconstruct
:
->
@
initBindings
()
@
initLocal
()
@
initTimeago
()
@
initTitle
()
@
initBody
()
@
delegateEvents
()
class
@
Thread
extends
@
Content
class
@
Thread
extends
@
Content
urlMappers
:
urlMappers
:
...
...
lms/static/coffee/src/discussion/discussion.coffee
View file @
d0f2f310
...
@@ -42,13 +42,17 @@ if Backbone?
...
@@ -42,13 +42,17 @@ if Backbone?
DiscussionUtil
.
safeAjax
DiscussionUtil
.
safeAjax
$elem
:
$elem
$elem
:
$elem
$loading
:
$elem
$loading
:
$elem
loadingCallback
:
->
$
(
this
).
parent
().
append
(
"<span class='discussion-loading'></span>"
)
loadedCallback
:
->
$
(
this
).
parent
().
children
(
".discussion-loading"
).
remove
()
url
:
url
url
:
url
type
:
"GET"
type
:
"GET"
success
:
(
response
,
textStatus
)
=>
success
:
(
response
,
textStatus
)
=>
$parent
=
@
$el
.
parent
()
$parent
=
@
$el
.
parent
()
@
$el
.
replaceWith
(
response
.
html
)
@
$el
.
replaceWith
(
response
.
html
)
$discussion
=
$parent
.
find
(
"section.discussion"
)
$discussion
=
$parent
.
find
(
"section.discussion"
)
@
model
.
reset
(
response
.
discussion
D
ata
,
{
silent
:
false
})
@
model
.
reset
(
response
.
discussion
_d
ata
,
{
silent
:
false
})
view
=
new
DiscussionView
el
:
$discussion
[
0
],
model
:
@
model
view
=
new
DiscussionView
el
:
$discussion
[
0
],
model
:
@
model
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
$
(
"html, body"
).
animate
({
scrollTop
:
0
},
0
)
$
(
"html, body"
).
animate
({
scrollTop
:
0
},
0
)
...
...
lms/static/coffee/src/discussion/utils.coffee
View file @
d0f2f310
...
@@ -72,11 +72,17 @@ class @DiscussionUtil
...
@@ -72,11 +72,17 @@ class @DiscussionUtil
params
[
"beforeSend"
]
=
->
params
[
"beforeSend"
]
=
->
$elem
.
attr
(
"disabled"
,
"disabled"
)
$elem
.
attr
(
"disabled"
,
"disabled"
)
if
params
[
"$loading"
]
if
params
[
"$loading"
]
params
[
"$loading"
].
loading
()
if
params
[
"loadingCallback"
]
?
params
[
"loadingCallback"
].
apply
(
params
[
"$loading"
])
else
params
[
"$loading"
].
loading
()
$
.
ajax
(
params
).
always
->
$
.
ajax
(
params
).
always
->
$elem
.
removeAttr
(
"disabled"
)
$elem
.
removeAttr
(
"disabled"
)
if
params
[
"$loading"
]
if
params
[
"$loading"
]
params
[
"$loading"
].
loaded
()
if
params
[
"loadedCallback"
]
?
params
[
"loadedCallback"
].
apply
(
params
[
"$loading"
])
else
params
[
"$loading"
].
loaded
()
@
get
:
(
$elem
,
url
,
data
,
success
)
->
@
get
:
(
$elem
,
url
,
data
,
success
)
->
@
safeAjax
@
safeAjax
...
...
lms/static/sass/_discussion.scss
View file @
d0f2f310
...
@@ -150,6 +150,10 @@ $tag-text-color: #5b614f;
...
@@ -150,6 +150,10 @@ $tag-text-color: #5b614f;
//user profile
//user profile
.user-profile
{
margin-top
:
24px
;
}
.sidebar-username
{
.sidebar-username
{
font-size
:
1
.5em
;
font-size
:
1
.5em
;
font-weight
:
bold
;
font-weight
:
bold
;
...
...
lms/templates/discussion/_content_renderer.html
View file @
d0f2f310
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
</
%
def>
</
%
def>
<
%
def
name=
"render_content_with_comments(content, *args, **kwargs)"
>
<
%
def
name=
"render_content_with_comments(content, *args, **kwargs)"
>
<div
class=
"${content['type']
}${helpers.show_if(' endorsed', content.get('endorsed'))}"
_id=
"${content['id']}"
_discussion_id=
"${content.get('commentable_id', '')}"
_author_id=
"${helpers.show_if(content['user_id'], not content.get('anonymous'))
}"
>
<div
class=
"${content['type']
| h}${helpers.show_if(' endorsed', content.get('endorsed')) | h}"
_id=
"${content['id'] | h}"
_discussion_id=
"${content.get('commentable_id', '') | h}"
_author_id=
"${helpers.show_if(content['user_id'], not content.get('anonymous')) | h
}"
>
${render_content(content, *args, **kwargs)}
${render_content(content, *args, **kwargs)}
${render_comments(content.get('children', []), *args, **kwargs)}
${render_comments(content.get('children', []), *args, **kwargs)}
</div>
</div>
...
...
lms/templates/discussion/_discussion_module.html
View file @
d0f2f310
<div
class=
"discussion-module"
>
<div
class=
"discussion-module"
>
<a
class=
"discussion-show control-button"
href=
"javascript:void(0)"
discussion_id=
"${discussion_id}"
>
Show Discussion
</a>
<a
class=
"discussion-show control-button"
href=
"javascript:void(0)"
discussion_id=
"${discussion_id
| h
}"
>
Show Discussion
</a>
</div>
</div>
lms/templates/discussion/_forum.html
View file @
d0f2f310
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion forum-discussion"
_id=
"${discussion_id}"
>
<section
class=
"discussion forum-discussion"
_id=
"${discussion_id
| h
}"
>
<div
class=
"discussion-non-content local"
>
<div
class=
"discussion-non-content local"
>
<div
class=
"search-wrapper"
>
<div
class=
"search-wrapper"
>
...
...
lms/templates/discussion/_inline.html
View file @
d0f2f310
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion inline-discussion"
_id=
"${discussion_id}"
>
<section
class=
"discussion inline-discussion"
_id=
"${discussion_id
| h
}"
>
<div
class=
"discussion-non-content local"
></div>
<div
class=
"discussion-non-content local"
></div>
...
...
lms/templates/discussion/_paginator.html
View file @
d0f2f310
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
%
>
%
>
<
%
def
name=
"link_to_page(_page, text)"
>
<
%
def
name=
"link_to_page(_page, text)"
>
<a
class=
"discussion-page-link"
href=
"javascript:void(0)"
page-url=
"${url_for_page(_page)}"
>
${text}
</a>
<a
class=
"discussion-page-link"
href=
"javascript:void(0)"
page-url=
"${url_for_page(_page)
| h
}"
>
${text}
</a>
</
%
def>
</
%
def>
<
%
def
name=
"div_page(_page)"
>
<
%
def
name=
"div_page(_page)"
>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
% endfor
% endfor
</
%
def>
</
%
def>
<div
class=
"discussion-${discussion_type}-paginator discussion-paginator local"
>
<div
class=
"discussion-${discussion_type
| h
}-paginator discussion-paginator local"
>
<div
class=
"prev-page"
>
<div
class=
"prev-page"
>
% if page > 1:
% if page > 1:
${link_to_page(page - 1, "
<
Previous page")}
${link_to_page(page - 1, "
<
Previous page")}
...
...
lms/templates/discussion/_recent_active_posts.html
View file @
d0f2f310
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
</header>
</header>
<ol
class=
"discussion-sidebar-following-list"
>
<ol
class=
"discussion-sidebar-following-list"
>
% for thread in recent_active_threads:
% for thread in recent_active_threads:
<li><a
href=
"${helpers.permalink(thread)
}"
><span
class=
"sidebar-following-name"
>
${thread['title']}
</span>
<span
class=
"sidebar-vote-count"
>
${thread['votes']['point']
}
</span></a></li>
<li><a
href=
"${helpers.permalink(thread)
| h}"
><span
class=
"sidebar-following-name"
>
${thread['title'] | h}
</span>
<span
class=
"sidebar-vote-count"
>
${thread['votes']['point'] | h
}
</span></a></li>
% endfor
% endfor
<ol>
<ol>
</article>
</article>
...
...
lms/templates/discussion/_search_bar.html
View file @
d0f2f310
...
@@ -10,9 +10,9 @@ def base_url_for_search():
...
@@ -10,9 +10,9 @@ def base_url_for_search():
<form
action=
"${base_url_for_search()}"
method=
"get"
class=
"discussion-search-form"
>
<form
action=
"${base_url_for_search()}"
method=
"get"
class=
"discussion-search-form"
>
% if query_params.get('tags', None):
% if query_params.get('tags', None):
<input
class=
"search-input"
type=
"text"
value=
"[${tags
}]${text
}"
id=
"keywords"
autocomplete=
"off"
/>
<input
class=
"search-input"
type=
"text"
value=
"[${tags
| h}]${text | h
}"
id=
"keywords"
autocomplete=
"off"
/>
% else:
% else:
<input
class=
"search-input"
type=
"text"
value=
"${text}"
id=
"keywords"
autocomplete=
"off"
/>
<input
class=
"search-input"
type=
"text"
value=
"${text
| h
}"
id=
"keywords"
autocomplete=
"off"
/>
% endif
% endif
<div
class=
"discussion-link discussion-search-link"
href=
"javascript:void(0)"
>
Search posts
</div>
<div
class=
"discussion-link discussion-search-link"
href=
"javascript:void(0)"
>
Search posts
</div>
</form>
</form>
lms/templates/discussion/_similar_posts.html
View file @
d0f2f310
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<a
class=
"hide-similar-posts"
href=
"javascript:void(0)"
>
Hide
</a>
<a
class=
"hide-similar-posts"
href=
"javascript:void(0)"
>
Hide
</a>
<div
class=
"new-post-similar-posts"
>
<div
class=
"new-post-similar-posts"
>
% for thread in threads:
% for thread in threads:
<a
class=
"similar-post"
href=
"${thread['permalink']
}"
>
${thread['title']
}
</a>
<a
class=
"similar-post"
href=
"${thread['permalink']
| h}"
>
${thread['title'] | h
}
</a>
% endfor
% endfor
</div>
</div>
% endif
% endif
lms/templates/discussion/_single_thread.html
View file @
d0f2f310
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion"
_id=
"${discussion_id}"
>
<section
class=
"discussion"
_id=
"${discussion_id
| h
}"
>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
<a
class=
"discussion-title"
href=
"javascript:void(0)"
>
Discussion
</a>
<div
class=
"threads"
>
<div
class=
"threads"
>
${renderer.render_content_with_comments(thread)}
${renderer.render_content_with_comments(thread)}
...
...
lms/templates/discussion/_sort.html
View file @
d0f2f310
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
else:
else:
return
base_url
+
'?'
+
urlencode
(
merge
(
query_params
,
{'
page
'
:
1
,
'
sort_key
'
:
key
,
'
sort_order
'
:
order
}))
return
base_url
+
'?'
+
urlencode
(
merge
(
query_params
,
{'
page
'
:
1
,
'
sort_key
'
:
key
,
'
sort_order
'
:
order
}))
%
>
%
>
<a
class=
"discussion-sort-link ${cls
}"
href=
"javascript:void(0)"
sort-url=
"${url_for_sort(key, order)
}"
>
${title}
</a>
<a
class=
"discussion-sort-link ${cls
| h}"
href=
"javascript:void(0)"
sort-url=
"${url_for_sort(key, order) | h
}"
>
${title}
</a>
</
%
def>
</
%
def>
<div
class=
"discussion-sort local"
>
<div
class=
"discussion-sort local"
>
...
...
lms/templates/discussion/_trending_tags.html
View file @
d0f2f310
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
</header>
</header>
<ol
class=
"discussion-sidebar-tags-list"
>
<ol
class=
"discussion-sidebar-tags-list"
>
% for tag, count in trending_tags:
% for tag, count in trending_tags:
<li><a
href=
"${helpers.url_for_tags(course.id, tag)
}"
class=
"thread-tag"
>
${tag}
</a><span
class=
"sidebar-tag-count"
>
×
${count
}
</span></li>
<li><a
href=
"${helpers.url_for_tags(course.id, tag)
| h}"
class=
"thread-tag"
>
${tag | h}
</a><span
class=
"sidebar-tag-count"
>
×
${count | h
}
</span></li>
% endfor
% endfor
<ol>
<ol>
</article>
</article>
...
...
lms/templates/discussion/_user_active_threads.html
View file @
d0f2f310
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<
%
namespace
name=
"renderer"
file=
"_content_renderer.html"
/>
<section
class=
"discussion user-active-discussion"
_id=
"${user_id}"
>
<section
class=
"discussion user-active-discussion"
_id=
"${user_id
| h
}"
>
<div
class=
"discussion-non-content local"
></div>
<div
class=
"discussion-non-content local"
></div>
...
...
lms/templates/discussion/_user_profile.html
View file @
d0f2f310
...
@@ -7,12 +7,12 @@
...
@@ -7,12 +7,12 @@
<
%
<
%
role_names =
sorted(map(attrgetter('name'),
django_user
.
roles
.
all
()))
role_names =
sorted(map(attrgetter('name'),
django_user
.
roles
.
all
()))
%
>
%
>
<div
class=
"sidebar-username"
>
${django_user.username}
</div>
<div
class=
"sidebar-username"
>
${django_user.username
| h
}
</div>
<div
class=
"sidebar-user-roles"
>
<div
class=
"sidebar-user-roles"
>
${", ".join(role_names)}
${", ".join(role_names)}
</div>
</div>
<div
class=
"sidebar-threads-count"
><span>
${profiled_user['threads_count']
}
</span>
${pluralize('discussion', profiled_user['threads_count'])
} started
</div>
<div
class=
"sidebar-threads-count"
><span>
${profiled_user['threads_count']
| h}
</span>
${pluralize('discussion', profiled_user['threads_count']) | h
} started
</div>
<div
class=
"sidebar-comments-count"
><span>
${profiled_user['comments_count']
}
</span>
${pluralize('comment', profiled_user['comments_count'])
}
</div>
<div
class=
"sidebar-comments-count"
><span>
${profiled_user['comments_count']
| h}
</span>
${pluralize('comment', profiled_user['comments_count']) | h
}
</div>
% if check_permissions_by_view(user, course.id, content=None, name='update_moderator_status'):
% if check_permissions_by_view(user, course.id, content=None, name='update_moderator_status'):
% if "Moderator" in role_names:
% if "Moderator" in role_names:
<a
href=
"javascript:void(0)"
class=
"sidebar-toggle-moderator-button sidebar-revoke-moderator-button"
>
Revoke Moderator provileges
</a>
<a
href=
"javascript:void(0)"
class=
"sidebar-toggle-moderator-button sidebar-revoke-moderator-button"
>
Revoke Moderator provileges
</a>
...
...
lms/templates/discussion/index.html
View file @
d0f2f310
<
%
inherit
file=
"../main.html"
/>
<
%
inherit
file=
"../main.html"
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
block
name=
"bodyclass"
>
discussion
</
%
block>
<
%
block
name=
"bodyclass"
>
discussion
</
%
block>
<
%
block
name=
"title"
><title>
Discussion – ${course.number}
</title></
%
block>
<
%
block
name=
"title"
><title>
Discussion – ${course.number
| h
}
</title></
%
block>
<
%
block
name=
"headextra"
>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
static:css
group=
'course'
/>
...
...
lms/templates/discussion/mustache/_content.mustache
View file @
d0f2f310
...
@@ -16,19 +16,16 @@
...
@@ -16,19 +16,16 @@
</ul>
</ul>
{{#
thread
}}
{{#
thread
}}
<a
class=
"thread-title"
name=
"
{{
content
.
id
}}
"
href=
"javascript:void(0)"
>
{{
content
.
displayed_title
}}
</a>
<a
class=
"thread-title"
name=
"
{{
content
.
id
}}
"
href=
"javascript:void(0)"
>
{{
content
.
displayed_title
}}
</a>
<div
class=
"thread-raw-title"
style=
"display: none"
>
{{{
content
.
title
}}}
</div>
{{/
thread
}}
{{/
thread
}}
<div
class=
"discussion-content-view"
>
<div
class=
"discussion-content-view"
>
<a
name=
"
{{
content
.
id
}}
"
style=
"width: 0; height: 0; padding: 0; border: none;"
></a>
<a
name=
"
{{
content
.
id
}}
"
style=
"width: 0; height: 0; padding: 0; border: none;"
></a>
<div
class=
"content-body
{{
content
.
type
}}
-body"
id=
"content-body-
{{
content
.
id
}}
"
>
{{
content
.
displayed_body
}}
</div>
<div
class=
"content-body
{{
content
.
type
}}
-body"
id=
"content-body-
{{
content
.
id
}}
"
>
{{
content
.
displayed_body
}}
</div>
<div
class=
"content-raw-body
{{
content
.
type
}}
-raw-body"
style=
"display: none"
>
{{{
content
.
body
}}}
</div>
{{#
thread
}}
{{#
thread
}}
<div
class=
"thread-tags"
>
<div
class=
"thread-tags"
>
{{#
content
.
tags
}}
{{#
content
.
tags
}}
<a
class=
"thread-tag"
href=
"
{{#
#
url_for_tags
}}{{
.
}}{{/
url_for_tags
}}
"
>
{{
.
}}
</a>
<a
class=
"thread-tag"
href=
"
{{#
#
url_for_tags
}}{{
.
}}{{/
url_for_tags
}}
"
>
{{
.
}}
</a>
{{/
content
.
tags
}}
{{/
content
.
tags
}}
</div>
</div>
<div
class=
"thread-raw-tags"
style=
"display: none"
>
{{
content
.
raw_tags
}}
</div>
{{/
thread
}}
{{/
thread
}}
<div
class=
"info"
>
<div
class=
"info"
>
<div
class=
"comment-time"
>
<div
class=
"comment-time"
>
...
...
lms/templates/discussion/user_profile.html
View file @
d0f2f310
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<
%
inherit
file=
"../main.html"
/>
<
%
inherit
file=
"../main.html"
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
block
name=
"bodyclass"
>
discussion
</
%
block>
<
%
block
name=
"bodyclass"
>
discussion
</
%
block>
<
%
block
name=
"title"
><title>
Discussion – ${course.number}
</title></
%
block>
<
%
block
name=
"title"
><title>
Discussion – ${course.number
| h
}
</title></
%
block>
<
%
block
name=
"headextra"
>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
static:css
group=
'course'
/>
...
@@ -36,6 +36,6 @@
...
@@ -36,6 +36,6 @@
</section>
</section>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
$$profiled_user_id
=
"${user.id | escapejs}"
;
var
$$profiled_user_id
=
"${
django_
user.id | escapejs}"
;
var
$$course_id
=
"${course.id | escapejs}"
;
var
$$course_id
=
"${course.id | escapejs}"
;
</script>
</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