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
eae9c268
Commit
eae9c268
authored
Sep 12, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark responses and comments as staff
parent
5101f512
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
4 deletions
+29
-4
lms/djangoapps/django_comment_client/forum/views.py
+2
-0
lms/djangoapps/django_comment_client/utils.py
+8
-0
lms/static/coffee/src/discussion/utils.coffee
+5
-0
lms/static/coffee/src/discussion/views/response_comment_view.coffee
+5
-0
lms/static/coffee/src/discussion/views/thread_response_view.coffee
+6
-0
lms/templates/discussion/index.html
+2
-3
lms/templates/discussion/single_thread.html
+1
-1
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
eae9c268
...
...
@@ -236,6 +236,7 @@ def forum_form_discussion(request, course_id):
'annotated_content_info'
:
saxutils
.
escape
(
json
.
dumps
(
annotated_content_info
),
escapedict
),
'course_id'
:
course
.
id
,
'category_map'
:
category_map
,
'roles'
:
saxutils
.
escape
(
json
.
dumps
(
utils
.
get_role_ids
(
course_id
)),
escapedict
),
}
# print "start rendering.."
return
render_to_response
(
'discussion/index.html'
,
context
)
...
...
@@ -315,6 +316,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
'thread_id'
:
thread_id
,
'threads'
:
saxutils
.
escape
(
json
.
dumps
(
threads
),
escapedict
),
'category_map'
:
category_map
,
'roles'
:
saxutils
.
escape
(
json
.
dumps
(
utils
.
get_role_ids
(
course_id
)),
escapedict
),
}
return
render_to_response
(
'discussion/single_thread.html'
,
context
)
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
eae9c268
...
...
@@ -39,6 +39,14 @@ def strip_blank(dic):
def
merge_dict
(
dic1
,
dic2
):
return
dict
(
dic1
.
items
()
+
dic2
.
items
())
def
get_role_ids
(
course_id
):
roles
=
Role
.
objects
.
filter
(
course_id
=
course_id
)
staff
=
list
(
User
.
objects
.
filter
(
is_staff
=
True
)
.
values_list
(
'id'
,
flat
=
True
))
roles_with_ids
=
{
'Staff'
:
staff
}
for
role
in
roles
:
roles_with_ids
[
role
.
name
]
=
list
(
role
.
users
.
values_list
(
'id'
,
flat
=
True
))
return
roles_with_ids
def
get_full_modules
():
global
_FULLMODULES
if
not
_FULLMODULES
:
...
...
lms/static/coffee/src/discussion/utils.coffee
View file @
eae9c268
...
...
@@ -15,6 +15,11 @@ class @DiscussionUtil
@
getTemplate
:
(
id
)
->
$
(
"script#
#{
id
}
"
).
html
()
@
isStaff
:
(
user_id
)
->
ids
=
$
(
"#discussion-container"
).
data
(
"roles"
)
staff
=
_
.
union
(
ids
[
'Staff'
],
ids
[
'Moderator'
],
ids
[
'Administrator'
])
_
.
include
(
staff
,
parseInt
(
user_id
))
@
bulkUpdateContentInfo
:
(
infos
)
->
for
id
,
info
of
infos
Content
.
getContent
(
id
).
updateInfo
(
info
)
...
...
lms/static/coffee/src/discussion/views/response_comment_view.coffee
View file @
eae9c268
...
...
@@ -18,6 +18,7 @@ if Backbone?
@
initLocal
()
@
delegateEvents
()
@
renderAttrs
()
@
markAsStaff
()
@
$el
.
find
(
".timeago"
).
timeago
()
@
convertMath
()
@
...
...
@@ -29,3 +30,7 @@ if Backbone?
body
.
children
(
"p"
).
each
(
index
,
elem
)
->
$
(
elem
).
replaceWith
(
$
(
elem
).
html
())
MathJax
.
Hub
.
Queue
[
"Typeset"
,
MathJax
.
Hub
,
body
[
0
]]
markAsStaff
:
->
if
DiscussionUtil
.
isStaff
(
@
model
.
get
(
"user_id"
))
@
$el
.
find
(
"a"
).
after
(
'<span class="staff-label">staff</span>'
)
lms/static/coffee/src/discussion/views/thread_response_view.coffee
View file @
eae9c268
...
...
@@ -18,6 +18,7 @@ if Backbone?
@
renderAttrs
()
@
$el
.
find
(
".posted-details"
).
timeago
()
@
convertMath
()
@
markAsStaff
()
@
renderComments
()
@
...
...
@@ -26,6 +27,11 @@ if Backbone?
element
.
html
DiscussionUtil
.
postMathJaxProcessor
DiscussionUtil
.
markdownWithHighlight
element
.
html
()
MathJax
.
Hub
.
Queue
[
"Typeset"
,
MathJax
.
Hub
,
element
[
0
]]
markAsStaff
:
->
if
DiscussionUtil
.
isStaff
(
@
model
.
get
(
"user_id"
))
@
$el
.
addClass
(
"staff"
)
@
$el
.
prepend
(
'<div class="staff-banner">staff</div>'
)
renderComments
:
->
comments
=
new
Comments
()
comments
.
comparator
=
(
comment
)
->
...
...
lms/templates/discussion/index.html
View file @
eae9c268
...
...
@@ -23,7 +23,7 @@
<script
type=
"text/javascript"
src=
"${static.url('js/discussions-temp.js')}"
></script>
<section
class=
"discussion container"
id=
"discussion-container"
data-course-id=
"${course_id}"
data-user-info=
"${user_info}"
data-threads=
"${threads}"
>
<section
class=
"discussion container"
id=
"discussion-container"
data-
roles=
"${roles}"
data-
course-id=
"${course_id}"
data-user-info=
"${user_info}"
data-threads=
"${threads}"
>
<div
class=
"discussion-body"
>
<div
class=
"sidebar"
></div>
<div
class=
"discussion-column"
>
...
...
@@ -36,4 +36,4 @@
</section>
<
%
include
file=
"_underscore_templates.html"
/>
<
%
include
file=
"_thread_list_template.html"
/>
\ No newline at end of file
<
%
include
file=
"_thread_list_template.html"
/>
lms/templates/discussion/single_thread.html
View file @
eae9c268
...
...
@@ -24,7 +24,7 @@
<
%
include
file=
"_new_post.html"
/>
<section
class=
"discussion container"
id=
"discussion-container"
data-course-id=
"${course_id}"
data-user-info=
"${user_info}"
data-threads=
"${threads}"
data-content-info=
"${annotated_content_info}"
>
<section
class=
"discussion container"
id=
"discussion-container"
data-
roles=
"${roles}"
data-
course-id=
"${course_id}"
data-user-info=
"${user_info}"
data-threads=
"${threads}"
data-content-info=
"${annotated_content_info}"
>
<div
class=
"discussion-body"
>
<div
class=
"sidebar"
></div>
<div
class=
"discussion-column"
></div>
...
...
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