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
65b8bcd6
Commit
65b8bcd6
authored
Sep 05, 2012
by
Ibrahim Awwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make voting render properly in inline discussions. Also might have fixed
following if it wasn't working before.
parent
f33b98fa
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
11 deletions
+20
-11
lms/djangoapps/django_comment_client/base/views.py
+1
-2
lms/djangoapps/django_comment_client/forum/views.py
+6
-0
lms/djangoapps/django_comment_client/utils.py
+2
-2
lms/static/coffee/src/discussion/discussion_module.coffee
+1
-1
lms/static/coffee/src/discussion/views/discussion_thread_inline_view.coffee
+0
-4
lms/templates/discussion/mustache/_inline_thread.mustache
+10
-2
No files found.
lms/djangoapps/django_comment_client/base/views.py
View file @
65b8bcd6
...
...
@@ -38,11 +38,10 @@ def permitted(fn):
else
:
content
=
None
return
content
if
check_permissions_by_view
(
request
.
user
,
kwargs
[
'course_id'
],
fetch_content
(),
request
.
view_name
):
return
fn
(
request
,
*
args
,
**
kwargs
)
else
:
return
JsonError
(
"unauthorized"
)
return
JsonError
(
"unauthorized"
,
status
=
401
)
return
wrapper
def
ajax_content_response
(
request
,
course_id
,
content
,
template_name
):
...
...
lms/djangoapps/django_comment_client/forum/views.py
View file @
65b8bcd6
...
...
@@ -136,10 +136,16 @@ def inline_discussion(request, course_id, discussion_id):
# html = render_inline_discussion(request, course_id, threads, discussion_id=discussion_id, \
# query_params=query_params)
user_info
=
cc
.
User
.
from_django_user
(
request
.
user
)
.
to_dict
()
def
infogetter
(
thread
):
return
utils
.
get_annotated_content_infos
(
course_id
,
thread
,
request
.
user
,
user_info
)
annotated_content_info
=
reduce
(
merge_dict
,
map
(
infogetter
,
threads
),
{})
return
utils
.
JsonResponse
({
# 'html': html,
'discussion_data'
:
map
(
utils
.
safe_content
,
threads
),
'user_info'
:
user_info
,
'annotated_content_info'
:
annotated_content_info
})
def
render_search_bar
(
request
,
course_id
,
discussion_id
=
None
,
text
=
''
):
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
65b8bcd6
...
...
@@ -149,14 +149,14 @@ class JsonResponse(HttpResponse):
mimetype
=
'application/json; charset=utf8'
)
class
JsonError
(
HttpResponse
):
def
__init__
(
self
,
error_messages
=
[]):
def
__init__
(
self
,
error_messages
=
[]
,
status
=
400
):
if
isinstance
(
error_messages
,
str
):
error_messages
=
[
error_messages
]
content
=
simplejson
.
dumps
({
'errors'
:
error_messages
},
indent
=
2
,
ensure_ascii
=
False
)
super
(
JsonError
,
self
)
.
__init__
(
content
,
mimetype
=
'application/json; charset=utf8'
,
status
=
400
)
mimetype
=
'application/json; charset=utf8'
,
status
=
status
)
class
HtmlResponse
(
HttpResponse
):
def
__init__
(
self
,
html
=
''
):
...
...
lms/static/coffee/src/discussion/discussion_module.coffee
View file @
65b8bcd6
...
...
@@ -23,8 +23,8 @@ if Backbone?
type
:
"GET"
dataType
:
'json'
success
:
(
response
,
textStatus
)
=>
#@$el.append(response.html)
window
.
user
=
new
DiscussionUser
(
response
.
user_info
)
Content
.
loadContentInfos
(
response
.
annotated_content_info
)
$
(
event
.
target
).
html
(
"Hide Discussion"
)
discussion
=
new
Discussion
()
discussion
.
reset
(
response
.
discussion_data
,
{
silent
:
false
})
...
...
lms/static/coffee/src/discussion/views/discussion_thread_inline_view.coffee
View file @
65b8bcd6
...
...
@@ -21,10 +21,6 @@ class @DiscussionThreadInlineView extends DiscussionContentView
@
model
.
on
"change"
,
@
updateModelDetails
render
:
->
#TODO: Debugging, remove when done
if
not
window
.
$disc
window
.
$disc
=
[]
window
.
$disc
.
push
(
@
)
if
not
@
model
.
has
(
'abbreviatedBody'
)
@
abbreviateBody
()
@
$el
.
html
(
Mustache
.
render
(
@
template
(),
$
.
extend
(
@
model
.
toJSON
(),{
expanded
:
@
expanded
})
))
...
...
lms/templates/discussion/mustache/_inline_thread.mustache
View file @
65b8bcd6
...
...
@@ -2,11 +2,14 @@
<div
class=
"local"
><a
href=
"#"
class=
"dogear action-follow"
></a></div>
<div
class=
"discussion-post local"
>
<header>
<a
href=
"#"
class=
"vote-btn discussion-vote discussion-vote-up"
><span
class=
"plus-icon"
>
+
</span>
<span
class=
'votes-count-number'
>
{{
votes
.
up_count
}}
</span></a>
<a
href=
"#"
class=
"vote-btn discussion-vote discussion-vote-up"
data-role=
"discussion-vote"
><span
class=
"plus-icon"
>
+
</span>
<span
class=
'votes-count-number'
>
{{
votes
.
up_count
}}
</span></a>
<h1>
{{
title
}}
</h1>
<p
class=
"posted-details"
>
<span
class=
"timeago"
title=
"
{{
created_at
}}
"
>
sometime
</span>
by
<span
class=
"timeago"
title=
"
{{
created_at
}}
"
>
{{
created_at
}}
</span>
by
<a
href=
"
{{
user_url
}}
"
>
{{
username
}}
</a>
<span
class=
"post-status-closed top-post-status"
style=
"display: none"
>
•
This thread is closed.
</span>
</p>
<div
class=
"local post-tools"
>
<a
href=
"javascript:void(0)"
class=
"expand-post"
>
Expand...
</a>
...
...
@@ -16,6 +19,11 @@
<div
class=
"post-body"
>
{{
abbreviatedBody
}}
</div>
<ul
class=
"moderator-actions"
>
<li
style=
"display: none"
><a
class=
"action-edit"
href=
"javascript:void(0)"
><span
class=
"edit-icon"
></span>
Edit
</a></li>
<li
style=
"display: none"
><a
class=
"action-delete"
href=
"javascript:void(0)"
><span
class=
"delete-icon"
></span>
Delete
</a></li>
<li
style=
"display: none"
><a
class=
"action-openclose"
href=
"javascript:void(0)"
><span
class=
"edit-icon"
></span>
Close
</a></li>
</ul>
</div>
<ol
class=
"responses post-extended-content"
>
<li
class=
"loading"
><div
class=
"loading-animation"
></div></li>
...
...
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