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
701f8716
Commit
701f8716
authored
Jul 31, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only show edit button when user can edit
parent
e301be4a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
lms/djangoapps/django_comment_client/forum/views.py
+15
-1
lms/static/coffee/src/discussion.coffee
+6
-1
lms/templates/discussion/single_thread.html
+1
-0
No files found.
lms/djangoapps/django_comment_client/forum/views.py
View file @
701f8716
...
...
@@ -78,9 +78,23 @@ def forum_form_discussion(request, course_id, discussion_id):
def
render_single_thread
(
request
,
course_id
,
thread_id
):
def
get_annotated_content_info
(
thread
,
user_id
):
infos
=
{}
def
_annotate
(
content
):
infos
[
str
(
content
[
'id'
])]
=
{
'editable'
:
str
(
content
[
'user_id'
])
==
str
(
user_id
),
# TODO may relax this to instructors
}
for
child
in
content
[
'children'
]:
_annotate
(
child
)
_annotate
(
thread
)
return
infos
thread
=
comment_client
.
get_thread
(
thread_id
,
recursive
=
True
)
context
=
{
'thread'
:
comment_client
.
get_thread
(
thread_id
,
recursive
=
True
)
,
'thread'
:
thread
,
'user_info'
:
comment_client
.
get_user_info
(
request
.
user
.
id
,
raw
=
True
),
'annotated_content_info'
:
json
.
dumps
(
get_annotated_content_info
(
thread
=
thread
,
user_id
=
request
.
user
.
id
)),
'tags'
:
comment_client
.
get_threads_tags
(
raw
=
True
),
'course_id'
:
course_id
,
}
...
...
lms/static/coffee/src/discussion.coffee
View file @
701f8716
...
...
@@ -197,7 +197,7 @@ Discussion =
else
view
=
{
id
:
id
showWatchCheckbox
:
$discussionContent
.
parent
(
".thread"
).
attr
(
"_id"
)
not
in
$$user_info
.
subscribed_thread_ids
showWatchCheckbox
:
$discussionContent
.
parent
s
(
".thread"
).
attr
(
"_id"
)
not
in
$$user_info
.
subscribed_thread_ids
}
$discussionContent
.
append
Mustache
.
render
Discussion
.
replyTemplate
,
view
Markdown
.
makeWmdEditor
$local
(
".reply-body"
),
"-reply-body-
#{
id
}
"
,
Discussion
.
urlFor
(
'upload'
)
...
...
@@ -339,6 +339,11 @@ Discussion =
raw_text
=
$local
(
".content-body"
).
html
()
converter
=
Markdown
.
getMathCompatibleConverter
()
$local
(
".content-body"
).
html
(
converter
.
makeHtml
(
raw_text
))
id
=
$content
.
attr
(
"_id"
)
if
not
(
$$annotated_content_info
[
id
]
||
[])[
'editable'
]
$local
(
".discussion-edit"
).
remove
()
bindDiscussionEvents
:
(
discussion
)
->
$discussion
=
$
(
discussion
)
...
...
lms/templates/discussion/single_thread.html
View file @
701f8716
...
...
@@ -14,4 +14,5 @@
var
$$user_info
=
JSON
.
parse
(
'${user_info | escape_quotes}'
);
var
$$course_id
=
"${course_id}"
;
var
$$tags
=
JSON
.
parse
(
"${tags | escape_quotes}"
);
var
$$annotated_content_info
=
JSON
.
parse
(
"${annotated_content_info | 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