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
007de179
Commit
007de179
authored
Aug 22, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add user profile page back
parent
4dae36cd
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
55 deletions
+58
-55
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
+1
-1
lms/static/coffee/src/discussion/main.coffee
+5
-0
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/mustache/_content.mustache
+1
-1
lms/templates/discussion/user_profile.html
+3
-3
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
007de179
...
...
@@ -282,7 +282,7 @@ def update_moderator_status(request, course_id, user_id):
'course_id'
:
course_id
,
'user'
:
request
.
user
,
'django_user'
:
user
,
'
discussion
_user'
:
discussion_user
.
to_dict
(),
'
profiled
_user'
:
discussion_user
.
to_dict
(),
}
return
JsonResponse
({
'html'
:
render_to_string
(
'discussion/ajax_user_profile.html'
,
context
)
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
007de179
...
...
@@ -83,7 +83,7 @@ def render_discussion(request, course_id, threads, *args, **kwargs):
'base_url'
:
base_url
,
'query_params'
:
strip_blank
(
strip_none
(
extract
(
query_params
,
[
'page'
,
'sort_key'
,
'sort_order'
,
'tags'
,
'text'
]))),
'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
())
return
render_to_string
(
template
,
context
)
...
...
@@ -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
)
if
request
.
is_ajax
():
return
utils
.
HtmlResponse
(
content
)
return
utils
.
JsonResponse
({
'html'
:
content
,
'discussionData'
:
threads
,
})
else
:
context
=
{
'course'
:
course
,
...
...
lms/static/coffee/src/discussion/content.coffee
View file @
007de179
...
...
@@ -257,7 +257,7 @@ if Backbone?
else
view
.
body
=
@
$
(
".comment-raw-body"
).
html
()
@
$discussionContent
().
append
Mustache
.
render
DiscussionUtil
.
getTemplate
(
"_edit_
#{
@
model
.
get
(
'type'
)
}
"
),
view
Discussion
.
makeWmdEditor
@
$el
,
$
.
proxy
(
@
$
,
@
),
"
#{
@
model
.
get
(
'type'
)
}
-body-edit"
Discussion
Util
.
makeWmdEditor
@
$el
,
$
.
proxy
(
@
$
,
@
),
"
#{
@
model
.
get
(
'type'
)
}
-body-edit"
@
$
(
".thread-tags-edit"
).
tagsInput
DiscussionUtil
.
tagsInputOptions
()
@
$
(
".discussion-submit-update"
).
unbind
(
"click"
).
click
$
.
proxy
(
@
submitEdit
,
@
)
@
$
(
".discussion-cancel-update"
).
unbind
(
"click"
).
click
$
.
proxy
(
@
cancelEdit
,
@
)
...
...
lms/static/coffee/src/discussion/main.coffee
View file @
007de179
...
...
@@ -14,3 +14,8 @@ $ ->
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 @
007de179
if
not
@
Discussion
?
@
Discussion
=
{}
class
@
DiscussionUserProfileView
extends
Backbone
.
View
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
@
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
)
->
events
:
"click .sidebar-toggle-moderator-button"
:
"toggleModeratorStatus"
lms/templates/discussion/_content_renderer.html
View file @
007de179
<
%!
import
django_comment_client
.
helpers
as
helpers
%
>
<
%
def
name=
"render_content(content)"
>
${helpers.render_content(content)}
<
%
def
name=
"render_content(content
, *args, **kwargs
)"
>
${helpers.render_content(content
, *args, **kwargs
)}
</
%
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'))}"
>
${render_content(content)}
${render_comments(content.get('children', []))}
${render_content(content
, *args, **kwargs
)}
${render_comments(content.get('children', [])
, *args, **kwargs
)}
</div>
</
%
def>
<
%
def
name=
"render_comments(comments)"
>
<
%
def
name=
"render_comments(comments
, *args, **kwargs
)"
>
<div
class=
"comments"
>
% for comment in comments:
${render_content_with_comments(comment)}
${render_content_with_comments(comment
, *args, **kwargs
)}
% endfor
</div>
</
%
def>
lms/templates/discussion/_user_active_threads.html
View file @
007de179
<
%
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"
>
% for thread in threads:
${renderer.render_
thread(course_id, thread, show_comments=True
)}
${renderer.render_
content_with_comments(thread, {'partial_comments': True}
)}
% endfor
</div>
...
...
lms/templates/discussion/_user_profile.html
View file @
007de179
<
%!
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
operator
import
attrgetter
%
>
...
...
@@ -15,9 +15,9 @@
<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 "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:
<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
</div>
lms/templates/discussion/mustache/_content.mustache
View file @
007de179
...
...
@@ -37,7 +37,7 @@
anonymous
{{/
content
.
anonymous
}}
{{^
content
.
anonymous
}}
{{
content
.
username
}}
<a
href=
"
{{#
#
url_for_user
}}{{
content
.
user_id
}}{{/
url_for_user
}}
"
>
{{
content
.
username
}}
</a>
{{/
content
.
anonymous
}}
</div>
<div
class=
"show-comments-wrapper"
>
...
...
lms/templates/discussion/user_profile.html
View file @
007de179
<
%!
from
django
.
template
.
defaultfilters
import
escapejs
%
>
<
%
namespace
name=
"renderer"
file=
"_thread.html"
/>
<
%
inherit
file=
"../main.html"
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
...
...
@@ -8,13 +7,14 @@
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
<
%
include
file=
"_js_head_dependencies.html"
/>
</
%
block>
<
%
block
name=
"js_extra"
>
<
%
include
file=
"_js_dependencies.html"
/>
<
%
include
file=
"_js_
body_
dependencies.html"
/>
</
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='discussion'"
/>
<
%
include
file=
"
..
/courseware/course_navigation.html"
args=
"active_page='discussion'"
/>
<section
class=
"container"
>
<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