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
d343baa3
Commit
d343baa3
authored
Aug 23, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/rocky/discussion' into arjun/prelaunch_premerge
parents
263eab62
74bc2329
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
95 additions
and
89 deletions
+95
-89
lms/djangoapps/django_comment_client/base/views.py
+1
-1
lms/djangoapps/django_comment_client/forum/views.py
+5
-2
lms/static/coffee/src/discussion/content.coffee
+0
-0
lms/static/coffee/src/discussion/discussion.coffee
+0
-0
lms/static/coffee/src/discussion/discussion_module.coffee
+32
-31
lms/static/coffee/src/discussion/main.coffee
+7
-1
lms/static/coffee/src/discussion/user_profile.coffee
+28
-33
lms/templates/discussion/_content_renderer.html
+7
-7
lms/templates/discussion/_user_active_threads.html
+4
-4
lms/templates/discussion/_user_profile.html
+3
-3
lms/templates/discussion/index.html
+1
-1
lms/templates/discussion/mustache/_content.mustache
+1
-1
lms/templates/discussion/single_thread.html
+1
-1
lms/templates/discussion/user_profile.html
+5
-4
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
d343baa3
...
@@ -282,7 +282,7 @@ def update_moderator_status(request, course_id, user_id):
...
@@ -282,7 +282,7 @@ def update_moderator_status(request, course_id, user_id):
'course_id'
:
course_id
,
'course_id'
:
course_id
,
'user'
:
request
.
user
,
'user'
:
request
.
user
,
'django_user'
:
user
,
'django_user'
:
user
,
'
discussion
_user'
:
discussion_user
.
to_dict
(),
'
profiled
_user'
:
discussion_user
.
to_dict
(),
}
}
return
JsonResponse
({
return
JsonResponse
({
'html'
:
render_to_string
(
'discussion/ajax_user_profile.html'
,
context
)
'html'
:
render_to_string
(
'discussion/ajax_user_profile.html'
,
context
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
d343baa3
...
@@ -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
:
threads
}),
'discussion_data'
:
json
.
dumps
({
(
discussion_id
or
user_id
):
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
)
...
@@ -250,7 +250,10 @@ def user_profile(request, course_id, user_id):
...
@@ -250,7 +250,10 @@ def user_profile(request, course_id, user_id):
content
=
render_user_discussion
(
request
,
course_id
,
threads
,
user_id
=
user_id
,
query_params
=
query_params
)
content
=
render_user_discussion
(
request
,
course_id
,
threads
,
user_id
=
user_id
,
query_params
=
query_params
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
utils
.
HtmlResponse
(
content
)
return
utils
.
JsonResponse
({
'html'
:
content
,
'discussionData'
:
threads
,
})
else
:
else
:
context
=
{
context
=
{
'course'
:
course
,
'course'
:
course
,
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
d343baa3
This diff is collapsed.
Click to expand it.
lms/static/coffee/src/discussion/discussion.coffee
View file @
d343baa3
This diff is collapsed.
Click to expand it.
lms/static/coffee/src/discussion/discussion_module.coffee
View file @
d343baa3
class
@
DiscussionModuleView
extends
Backbone
.
View
if
Backbone
?
events
:
class
@
DiscussionModuleView
extends
Backbone
.
View
"click .discussion-show"
:
"toggleDiscussion"
events
:
toggleDiscussion
:
(
event
)
->
"click .discussion-show"
:
"toggleDiscussion"
if
@
showed
toggleDiscussion
:
(
event
)
->
@
$
(
"section.discussion"
).
hide
()
if
@
showed
$
(
event
.
target
).
html
(
"Show Discussion"
)
@
$
(
"section.discussion"
).
hide
()
@
showed
=
false
$
(
event
.
target
).
html
(
"Show Discussion"
)
else
@
showed
=
false
if
@
retrieved
@
$
(
"section.discussion"
).
show
()
$
(
event
.
target
).
html
(
"Hide Discussion"
)
@
showed
=
true
else
else
$elem
=
$
(
event
.
target
)
if
@
retrieved
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
@
$
(
"section.discussion"
).
show
()
url
=
DiscussionUtil
.
urlFor
'retrieve_discussion'
,
discussion_id
$
(
event
.
target
).
html
(
"Hide Discussion"
)
Discussion
.
safeAjax
@
showed
=
true
$elem
:
$elem
else
url
:
url
$elem
=
$
(
event
.
target
)
type
:
"GET"
discussion_id
=
$elem
.
attr
(
"discussion_id"
)
dataType
:
'json'
url
=
DiscussionUtil
.
urlFor
'retrieve_discussion'
,
discussion_id
success
:
(
response
,
textStatus
)
=>
Discussion
.
safeAjax
@
$el
.
append
(
response
.
html
)
$elem
:
$elem
$discussion
=
@
$el
.
find
(
"section.discussion"
)
url
:
url
$
(
event
.
target
).
html
(
"Hide Discussion"
)
type
:
"GET"
discussion
=
new
Discussion
()
dataType
:
'json'
discussion
.
reset
(
response
.
discussionData
,
{
silent
:
false
})
success
:
(
response
,
textStatus
)
=>
view
=
new
DiscussionView
(
el
:
$discussion
[
0
],
model
:
discussion
)
@
$el
.
append
(
response
.
html
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
$discussion
=
@
$el
.
find
(
"section.discussion"
)
@
retrieved
=
true
$
(
event
.
target
).
html
(
"Hide Discussion"
)
@
showed
=
true
discussion
=
new
Discussion
()
discussion
.
reset
(
response
.
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
$discussion
[
0
],
model
:
discussion
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
@
retrieved
=
true
@
showed
=
true
lms/static/coffee/src/discussion/main.coffee
View file @
d343baa3
...
@@ -12,4 +12,10 @@ $ ->
...
@@ -12,4 +12,10 @@ $ ->
discussion
.
reset
(
discussionData
,
{
silent
:
false
})
discussion
.
reset
(
discussionData
,
{
silent
:
false
})
view
=
new
DiscussionView
(
el
:
elem
,
model
:
discussion
)
view
=
new
DiscussionView
(
el
:
elem
,
model
:
discussion
)
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
if
window
.
$
$annotated_content_info
?
DiscussionUtil
.
bulkUpdateContentInfo
(
window
.
$
$annotated_content_info
)
$userProfile
=
$
(
".discussion-sidebar>.user-profile"
)
if
$userProfile
.
length
console
.
log
"initialize user profile"
view
=
new
DiscussionUserProfileView
(
el
:
$userProfile
[
0
])
lms/static/coffee/src/discussion/user_profile.coffee
View file @
d343baa3
if
not
@
Discussion
?
class
@
DiscussionUserProfileView
extends
Backbone
.
View
@
Discussion
=
{}
toggleModeratorStatus
:
(
event
)
->
confirmValue
=
confirm
(
"Are you sure?"
)
if
not
confirmValue
then
return
$elem
=
$
(
event
.
target
)
if
$elem
.
hasClass
(
"sidebar-promote-moderator-button"
)
isModerator
=
true
else
if
$elem
.
hasClass
(
"sidebar-revoke-moderator-button"
)
isModerator
=
false
else
console
.
error
"unrecognized moderator status"
return
url
=
DiscussionUtil
.
urlFor
(
'update_moderator_status'
,
$$profiled_user_id
)
DiscussionUtil
.
safeAjax
$elem
:
$elem
url
:
url
type
:
"POST"
dataType
:
'json'
data
:
is_moderator
:
isModerator
error
:
(
response
,
textStatus
,
e
)
->
console
.
log
e
success
:
(
response
,
textStatus
)
=>
parent
=
@
$el
.
parent
()
@
$el
.
replaceWith
(
response
.
html
)
view
=
new
DiscussionUserProfileView
el
:
parent
.
children
(
".user-profile"
)
Discussion
=
@
Discussion
events
:
"click .sidebar-toggle-moderator-button"
:
"toggleModeratorStatus"
@
Discussion
=
$
.
extend
@
Discussion
,
initializeUserProfile
:
(
$userProfile
)
->
$local
=
Discussion
.
generateLocal
$userProfile
handleUpdateModeratorStatus
=
(
elem
,
isModerator
)
->
confirmValue
=
confirm
(
"Are you sure?"
)
if
not
confirmValue
then
return
url
=
Discussion
.
urlFor
(
'update_moderator_status'
,
$$profiled_user_id
)
Discussion
.
safeAjax
$elem
:
$
(
elem
)
url
:
url
type
:
"POST"
dataType
:
'json'
data
:
is_moderator
:
isModerator
error
:
(
response
,
textStatus
,
e
)
->
console
.
log
e
success
:
(
response
,
textStatus
)
->
parent
=
$userProfile
.
parent
()
$userProfile
.
replaceWith
(
response
.
html
)
Discussion
.
initializeUserProfile
parent
.
children
(
".user-profile"
)
Discussion
.
bindLocalEvents
$local
,
"click .sidebar-revoke-moderator-button"
:
(
event
)
->
handleUpdateModeratorStatus
(
this
,
false
)
"click .sidebar-promote-moderator-button"
:
(
event
)
->
handleUpdateModeratorStatus
(
this
,
true
)
initializeUserActiveDiscussion
:
(
$discussion
)
->
lms/templates/discussion/_content_renderer.html
View file @
d343baa3
<
%!
import
django_comment_client
.
helpers
as
helpers
%
>
<
%!
import
django_comment_client
.
helpers
as
helpers
%
>
<
%
def
name=
"render_content(content)"
>
<
%
def
name=
"render_content(content
, *args, **kwargs
)"
>
${helpers.render_content(content)}
${helpers.render_content(content
, *args, **kwargs
)}
</
%
def>
</
%
def>
<
%
def
name=
"render_content_with_comments(content)"
>
<
%
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']}${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'))}"
>
${render_content(content)}
${render_content(content
, *args, **kwargs
)}
${render_comments(content.get('children', []))}
${render_comments(content.get('children', [])
, *args, **kwargs
)}
</div>
</div>
</
%
def>
</
%
def>
<
%
def
name=
"render_comments(comments)"
>
<
%
def
name=
"render_comments(comments
, *args, **kwargs
)"
>
<div
class=
"comments"
>
<div
class=
"comments"
>
% for comment in comments:
% for comment in comments:
${render_content_with_comments(comment)}
${render_content_with_comments(comment
, *args, **kwargs
)}
% endfor
% endfor
</div>
</div>
</
%
def>
</
%
def>
lms/templates/discussion/_user_active_threads.html
View file @
d343baa3
<
%
namespace
name=
"renderer"
file=
"_
thread
.html"
/>
<
%
namespace
name=
"renderer"
file=
"_
content_renderer
.html"
/>
<section
class=
"discussion user-active-discussion"
>
<section
class=
"discussion user-active-discussion"
_id=
"${user_id}"
>
<div
class=
"discussion-non-content
discussion-
local"
></div>
<div
class=
"discussion-non-content local"
></div>
<div
class=
"threads"
>
<div
class=
"threads"
>
% for thread in threads:
% for thread in threads:
${renderer.render_
thread(course_id, thread, show_comments=True
)}
${renderer.render_
content_with_comments(thread, {'partial_comments': True}
)}
% endfor
% endfor
</div>
</div>
...
...
lms/templates/discussion/_user_profile.html
View file @
d343baa3
<
%!
from
django_comment_client
.
util
s
import
pluralize
%
>
<
%!
from
django_comment_client
.
helper
s
import
pluralize
%
>
<
%!
from
django_comment_client
.
permissions
import
has_permission
,
check_permissions_by_view
%
>
<
%!
from
django_comment_client
.
permissions
import
has_permission
,
check_permissions_by_view
%
>
<
%!
from
operator
import
attrgetter
%
>
<
%!
from
operator
import
attrgetter
%
>
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
<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']}
</span>
${pluralize('comment', profiled_user['comments_count'])}
</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-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>
% else:
% else:
<a
href=
"javascript:void(0)"
class=
"sidebar-promote-moderator-button"
>
Promote to Moderator
</a>
<a
href=
"javascript:void(0)"
class=
"sidebar-
toggle-moderator-button sidebar-
promote-moderator-button"
>
Promote to Moderator
</a>
% endif
% endif
% endif
% endif
</div>
</div>
lms/templates/discussion/index.html
View file @
d343baa3
<
%
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 –
MITx 6.002x
</title></
%
block>
<
%
block
name=
"title"
><title>
Discussion –
${course.number}
</title></
%
block>
<
%
block
name=
"headextra"
>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
static:css
group=
'course'
/>
...
...
lms/templates/discussion/mustache/_content.mustache
View file @
d343baa3
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
anonymous
anonymous
{{/
content
.
anonymous
}}
{{/
content
.
anonymous
}}
{{^
content
.
anonymous
}}
{{^
content
.
anonymous
}}
{{
content
.
username
}}
<a
href=
"
{{#
#
url_for_user
}}{{
content
.
user_id
}}{{/
url_for_user
}}
"
>
{{
content
.
username
}}
</a>
{{/
content
.
anonymous
}}
{{/
content
.
anonymous
}}
</div>
</div>
<div
class=
"show-comments-wrapper"
>
<div
class=
"show-comments-wrapper"
>
...
...
lms/templates/discussion/single_thread.html
View file @
d343baa3
<
%
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 –
MITx 6.002x
</title></
%
block>
<
%
block
name=
"title"
><title>
Discussion –
${course.number}
</title></
%
block>
<
%
block
name=
"headextra"
>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
static:css
group=
'course'
/>
...
...
lms/templates/discussion/user_profile.html
View file @
d343baa3
<
%!
from
django
.
template
.
defaultfilters
import
escapejs
%
>
<
%!
from
django
.
template
.
defaultfilters
import
escapejs
%
>
<
%
namespace
name=
"renderer"
file=
"_thread.html"
/>
<
%
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 –
MITx 6.002x
</title></
%
block>
<
%
block
name=
"title"
><title>
Discussion –
${course.number}
</title></
%
block>
<
%
block
name=
"headextra"
>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
static:css
group=
'course'
/>
<
%
include
file=
"_js_head_dependencies.html"
/>
</
%
block>
</
%
block>
<
%
block
name=
"js_extra"
>
<
%
block
name=
"js_extra"
>
<
%
include
file=
"_js_dependencies.html"
/>
<
%
include
file=
"_js_body_dependencies.html"
/>
<
%
static:js
group=
'discussion'
/>
</
%
block>
</
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='discussion'"
/>
<
%
include
file=
"
..
/courseware/course_navigation.html"
args=
"active_page='discussion'"
/>
<section
class=
"container"
>
<section
class=
"container"
>
<div
class=
"course-wrapper"
>
<div
class=
"course-wrapper"
>
...
...
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